Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Centering a checkbox in grid column
Message
 
 
To
27/06/2003 06:30:19
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00804414
Message ID:
00804685
Views:
30
Andrus,

Last night when I tried this, I swear I emptied the caption before I ran the form, the first run of the form from the deisgner didn't work... When the designer opened back up the chk still had it's caption. There was some other grid thing I was testing a couple of weeks ago where it took a couple of saves to actually get the change to stick.

In earlier versions you have to create a container class, but the chk in it and put this composite class into the grid.

Here's a dump of the form I greated last night that's centering the checkbox quite nicely:
DEFINE CLASS form1 AS form
	Top = 0
	Left = 0
	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"

	ADD OBJECT grid1 AS grid WITH ;
		ColumnCount = 3, ;
		Height = 215, ;
		Left = 15, ;
		Panel = 1, ;
		Top = 17, ;
		Width = 344, ;
		Name = "Grid1", ;
		Column1.Sparse = .F., ;
		Column1.Name = "Column1", ;
		Column2.Sparse = .F., ;
		Column2.Name = "Column2", ;
		Column3.Name = "Column3"

	ADD OBJECT form1.grid1.column1.header1 AS header WITH ;
		Caption = "Header1", ;
		Name = "Header1"

	ADD OBJECT form1.grid1.column1.check1 AS checkbox WITH ;
		Top = 24, ;
		Left = 8, ;
		Height = 17, ;
		Width = 60, ;
		Centered = .T., ;
		Caption = "", ;
		Name = "Check1"

	ADD OBJECT form1.grid1.column2.header1 AS header WITH ;
		Caption = "Header1", ;
		Name = "Header1"

	ADD OBJECT form1.grid1.column2.check1 AS checkbox WITH ;
		Top = 32, ;
		Left = 18, ;
		Height = 17, ;
		Width = 60, ;
		Centered = .T., ;
		Caption = "", ;
		Name = "Check1"

	ADD OBJECT form1.grid1.column3.header1 AS header WITH ;
		Caption = "Header1", ;
		Name = "Header1"

	ADD OBJECT form1.grid1.column3.check1 AS checkbox WITH ;
		Top = 23, ;
		Left = 24, ;
		Height = 17, ;
		Width = 60, ;
		Centered = .T., ;
		Caption = "", ;
		Name = "Check1"

	PROCEDURE Load
		create cursor x1 ( l1 l, l2 l, l3 l )
		insert into x1 values ( .t., .t., .t. )
		insert into x1 values ( .f., .f., .f. )
		go top
	ENDPROC

ENDDEFINE
>Yes .caption property displays (none) in property sheet.
>
>In my checkbox class init event I have :
>
>
>IF TYPE('this.parent.sparse')='L'
>  * Checkbox is in grid column. Make it centered.
>  this.parent.sparse= .f.
>  IF VERSION()>='Visual FoxPro 08'
>    this.centered = .t.
>    ENDIF
>  ENDIF
>
>But the checkbox is still left-aligned!
>
>According to VFP 8 help file in .centered property, it is possible
>to center a checkbox in grid. Unfortunately, I havent found ANY sample
>which shows this.
>
>Is there any sample code which shows centered checkbox in grid ?
>Is it possible to center checkbox in VFP 7 ?
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform