Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CheckBox Column in a grid, How to work with?
Message
From
01/09/1998 15:07:20
 
 
To
01/09/1998 14:26:53
Francois Liboiron
National Bank of Canada
Montréal, Quebec, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00131966
Message ID:
00132000
Views:
17
Hi, François
This was a lot more fun to play with than my own program :-)

Here's a form I got to work. It has one grid with a check box column and a data column. If any of the rows are checked the check box is disabled for all other rows except that one. Once it's unchecked, the rows' checkboxes are enabled again.

It's not graceful, but it might get you started...Let me know if it's too unclear.
PUBLIC oform1

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





**************************************************
*-- Form:         form1 (e:\jobs\motorola\temp.scx)
*-- ParentClass:  form
*-- BaseClass:    form
*
DEFINE CLASS form1 AS form


	DoCreate = .T.
	Caption = "Form1"
	nrec = 0
	Name = "Form1"
	picked = .F.


	ADD OBJECT grid1 AS grid WITH ;
		ColumnCount = 2, ;
		Height = 200, ;
		Left = 12, ;
		Panel = 1, ;
		RecordSource = "analreq", ;
		Top = 8, ;
		Width = 320, ;
		Name = "Grid1", ;
		Column1.Bound = .F., ;
		Column1.CurrentControl = "Text1", ;
		Column1.Width = 18, ;
		Column1.Sparse = .F., ;
		Column1.DynamicCurrentControl = "[IIF( thisform.nRec = RECNO( 'analreq' ) OR thisform.nRec = 0, "Check1", "text1" )]", ;
		Column1.Name = "Column1", ;
		Column2.Name = "Column2"


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


	ADD OBJECT form1.grid1.column1.check1 AS checkbox WITH ;
		Top = 24, ;
		Left = 20, ;
		Height = 10, ;
		Width = 10, ;
		Caption = "", ;
		Value = .F., ;
		Name = "Check1"


	ADD OBJECT form1.grid1.column1.text1 AS textbox WITH ;
		BackStyle = 0, ;
		BorderStyle = 0, ;
		Height = 23, ;
		Left = 11, ;
		SpecialEffect = 1, ;
		Top = 51, ;
		Width = 100, ;
		BackColor = RGB(255,255,255), ;
		Name = "Text1"


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


	ADD OBJECT form1.grid1.column2.text1 AS textbox WITH ;
		BorderStyle = 0, ;
		Margin = 0, ;
		ForeColor = RGB(0,0,0), ;
		BackColor = RGB(255,255,255), ;
		Name = "Text1"


	ADD OBJECT text1 AS textbox WITH ;
		ControlSource = "thisform.nrec", ;
		Format = "Z", ;
		Height = 23, ;
		Left = 117, ;
		Top = 216, ;
		Width = 100, ;
		Name = "Text1"

	PROCEDURE check1.Click
		thisform.nrec = IIF( this.value, recno('analreq'), 0 )
		thisform.text1.refresh
		this.parent.parent.refresh
	ENDPROC


ENDDEFINE
*
*-- EndDefine: form1
**************************************************
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform