Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dealing with columns on the fly
Message
From
07/07/2006 01:23:43
Aman Bains
Jaguar Computers
Jalandhar, India
 
 
To
06/07/2006 18:03:47
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP1
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01134305
Message ID:
01134359
Views:
13
>Can I add columns, change expressions, etc. (on the fly) ?

You can add a new column and change a lot of it's properties. you can create a method in the Form, and call it from Init method. have a look at the following code:
lPara cName, cData, cHeader, nWidth, cFormat, cFont, cForeColor, cTag
local nPos

with Thisform.grid1
nPos= .ColumnCount+ 1
.addcolumn( nPos)
with .Columns( nPos)
		.Name = cName
		.ControlSource = cData
		.FontSize= thisform.gridfont && 9

		.Header1.caption= iif(left(cHeader,1)='-',substr(cHeader,2),cHeader)
		.width= nWidth
		.readonly=.t.
		if !empty( cFormat) and type( 'cFormat')= "C"
			.Inputmask= cFormat
		endif
		if !empty( cForeColor) and type( 'cForeColor')= "C"
			.ForeColor= &cForeColor
		endif
		if !empty( cFont) and type( 'cFont')= "C"
			.FontBold= iif( "B"$ cFont, .t., .f.)
			.FontItalic= iif( "I"$ cFont, .t., .f.)
			.Fontunderline= iif( "U"$ cFont, .t., .f.)
			do case		&& Text Alignment
			case "R" $ cFont 
				.alignment=  1
			case "C" $ cFont 
				.alignment= 2
			Endcase	
	
			.tag= cFont
		endif
		*	Header
		with .Header1
			.alignment= 2
			.ForeColor= RGB(29,29,29) 
			.BackColor= rgb(253,245,222)
			.FontBold= .t.
			.FontSize= thisform.gridfont && 9
			.FontName= "Arial"	&&"MS Sans Serif"
		endwith
endwith
endWith
Aman
-------
Lets fly away to the Land where there is Love & Peace
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform