oForm=Createobject("myForm")
oForm.width = 440
oForm.AddObject('myGrid1','myGrid')
oForm.myGrid1.column1.header1.Caption = "Field"
oForm.myGrid1.column1.width = 100
oForm.myGrid1.column2.header1.Caption = "Value"
oForm.myGrid1.column2.width = 300
oForm.myGrid1.column2.Sparse = .F.
oForm.myGrid1.column2.AddObject("TextField1","TextField")
oForm.myGrid1.column2.AddObject("ComboBoxField1","ComboBoxField")
*!* oForm.myGrid1.column2.AddObject("SpinnerField1","SpinnerField")
*!* oForm.myGrid1.column2.AddObject("CheckBoxField1","CheckBoxField")
oForm.Show(1)
Define Class myForm As Form
AutoCenter = .T.
Procedure Load()
Create Cursor myCursor (fName C(20), fValue C(20), fType C(3))
Insert Into myCursor (fName,fValue,fType) Values ("MODEL","FORD MUSTANG","TXT")
Insert Into myCursor (fName,fValue,fType) Values ("CYLINDERS","6","CBO")
Insert Into myCursor (fName,fValue,fType) Values ("YEAR","2008","TXT")
Insert Into myCursor (fName,fValue,fType) Values ("TURBO","T","TXT")
Go Top
Endproc
Enddefine
Define Class myGrid As Grid
Visible = .T.
ColumnCount = 2
Width = 400
Top = 20
Left = 20
RowHeight = 26
Procedure Init()
With This
.column2.DynamicCurrentControl = "dynamic()"
This.Parent.LockScreen = .F.
Endwith
Endproc
ENDDEFINE
Define Class TextField As TextBox
Visible = .T.
height = 26
Procedure Click
This.Parent.Parent.Parent.LockScreen = .T.
This.Parent.Parent.Init()
Endproc
ENDDEFINE
Define Class ComboBoxField As Combobox
Visible = .T.
Rowsourcetype = 1
Rowsource = "4,6,8"
Procedure Click
This.Parent.Parent.Parent.LockScreen = .T.
This.Parent.Parent.Init()
Endproc
ENDDEFINE
DEFINE CLASS SpinnerField as Spinner
Visible = .T.
height = 26
Procedure Click
This.Parent.Parent.Parent.LockScreen = .T.
This.Parent.Parent.Init()
ENDPROC
ENDDEFINE
DEFINE CLASS CheckBoxField as CheckBox
Visible = .T.
height = 26
Procedure Click
This.Parent.Parent.Parent.LockScreen = .T.
This.Parent.Parent.Init()
ENDPROC
ENDDEFINE
Function Dynamic
Do Case
Case myCursor.fType = "TXT"
Return "TextField1"
Case myCursor.fType = "CBO"
Return "ComboBoxField1"
*!* Case myCursor.fType = "SPN"
*!* Return "SpinnerField1"
*!* Case myCursor.fType = "CHK"
*!* Return "CheckBoxField1"
Endcase
Endfunc