Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Checkbox in grid - any new solution for center
Message
 
 
To
21/10/2004 16:28:12
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro Beta
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00953492
Message ID:
00953521
Views:
10
It can be done since VFP8 by setting column's Alignment property to 2. See sample code below.
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN

DEFINE CLASS form1 AS form

	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"

	ADD OBJECT grid1 AS grid WITH ;
		ColumnCount = 2, ;
		DeleteMark = .F., ;
		HeaderHeight = 0, ;
		Height = 204, ;
		Left = 12, ;
		Panel = 1, ;
		RecordMark = .F., ;
		RecordSource = "products", ;
		ScrollBars = 2, ;
		SplitBar = .F., ;
		Top = 24, ;
		Width = 348, ;
		AllowCellSelection = .F., ;
		Name = "Grid1", ;
		Column1.ControlSource = "products.eng_name", ;
		Column1.Width = 268, ;
		Column1.Name = "Column1", ;
		Column2.ControlSource = "products.discontinu", ;
		Column2.Width = 50, ;
		Column2.Sparse = .F., ;
		Column2.Name = "Column2"

	PROCEDURE Load
		CLOSE DATABASES 
		OPEN DATABASE (HOME(2) + "\data\testdata.DBC")
		USE testdata!products
	ENDPROC

	PROCEDURE Init 
		thisform.grid1.Column2.AddObject("Checkbox1", "Checkbox")
		thisform.grid1.Column2.CurrentControl = "Checkbox1"
		thisform.grid1.Column2.Checkbox1.Caption = ""
		thisform.grid1.Column2.Alignment= 2
	ENDPROC
	
ENDDEFINE
>There is an old problem in VFP for using checkbox in a grid - The checkbox cannot be centered. In a sample (solution) come with VFP 9, the checkbox is leftsided. I can put the checkbox in a container to center it. But for dynamically added container, the click and key stroke on the related cells do not work well, need additional coding to deal with it which is troublesome.
>
>Is there any new enhancement in dealing with this problem in VFP 9? I cannot find anything.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform