>.RemoveObject( "Text1" ) >cNewControlName = "." + ALLTRIM( GRID_DATA.OPT_CONTR1 ) >.AddObject( ALLTRIM( GRID_DATA.OPT_CONTR1 ), ALLTRIM( GRID_DATA.OPT_CONTR2 ) ) >.sparse = .F. >>The value in OPT_CONTR2 is "CHECKBOX_CONTROL"
>DEFINE CLASS CHECKBOX_CONTROL AS CHECKBOX > > OPT_CONTR1 = "" > OPT_CONTR2 = "" > OPT_CONTR3 = "" > OPT_CONTR4 = "" > OPT_CONTR5 = 0.00 > OPT_CONTR6 = "" > OPT_CONTR7 = .F. > OPT_CONTR8 = .F. > ROW_HEIGHT = 0.00 > >ENDDEFINE >>The above shows all rows in the grid as a checkbox. However, regardless of the value (STATUS="A" or STATUS="I"), the check box has a caption equal in OPT_CONTR1. If the value in OPT_CONTR1 is "STATUS", all rows show the checkbox with the caption STATUS.
oForm = CREATEOBJECT([form1]) oForm.Show(1) ************************************************** *-- Form: form1 (d:\all_zapl\additional_programs\upgrade\aaa.scx) *-- ParentClass: form *-- BaseClass: form *-- Time Stamp: 05/25/23 11:00:01 AM * DEFINE CLASS form1 AS form Top = 0 Left = 0 DoCreate = .T. Caption = "Form1" *-- XML Metadata for customizable properties _memberdata = [<VFPData><memberdata name="setcaption" display="SetCaption"/></VFPData>] Name = "Form1" ADD OBJECT grid1 AS grid WITH ; ColumnCount = 2, ; Anchor = 15, ; Height = 200, ; Left = 19, ; Top = 28, ; Width = 320, ; Name = "Grid1", ; Column1.Sparse = .F., ; Column1.Name = "Column1", ; Column2.Name = "Column2" PROCEDURE setcaption thisform.Grid1.ColUMN1.Check1.Caption = ALLTRIM(Test.Fld2) RETURN thisform.Grid1.ColUMN1.BackColor ENDPROC PROCEDURE Init WITH thisform.Grid1.Column1 AS Column .AddObject("Check1","CheckBox") .RemoveObject("Text1") .Check1.Visible = .t. .CurrentControl = "Check1" ENDWITH thisform.Grid1.ColuMN1.DynamicBackColor = "thisform.SetCaption()" ENDPROC PROCEDURE Load CREATE CURSOR Test (Fld1 L, Fld2 C(20)) FOR lnFor = 1 TO 20 INSERT INTO Test VALUES (lnFor%2==0,"Caption - "+TRANSFORM(lnFor)) NEXT GO TOP ENDPROC ENDDEFINE * *-- EndDefine: form1 **************************************************