thisform.OptionGroup1.Value = IIF(MyField, 1, 2) WITH EVALUATE([thisform.OptionGroup1.Option]+TRANSFORM(thisform.OptionGroup1.Value)) .SetFocus() &&& Move a little square around the buttons to appropriate one. ENDWITHIn InterActiveChange Event of th OptionGroup:
REPLACE MyField WITH (this.Value == 1) IN MyTableHere one example (no error handling in it)
* Mode MS-original PUBLIC oform1 oform1=NEWOBJECT("form1") oform1.Show RETURN ************************************************** *-- Form: form1 (d:\all_zapl_4_9_0\test.scx) *-- ParentClass: form *-- BaseClass: form *-- Time Stamp: 01/19/07 11:01:11 PM * DEFINE CLASS form1 AS form Top = 0 Left = 0 Height = 200 Width = 200 DoCreate = .T. Caption = "Form1" ForeColor = RGB(255,255,255) Name = "Form1" ADD OBJECT optiongroup1 AS optiongroup WITH ; ButtonCount = 2, ; Value = 1, ; Height = 46, ; Left = 0, ; Top = 59, ; Width = 71, ; Name = "Optiongroup1", ; Option1.Caption = "Yes", ; Option1.Value = 1, ; Option1.Height = 17, ; Option1.Left = 5, ; Option1.Top = 5, ; Option1.Width = 61, ; Option1.Name = "Option1", ; Option2.Caption = "No", ; Option2.Height = 17, ; Option2.Left = 5, ; Option2.Top = 24, ; Option2.Width = 61, ; Option2.Name = "Option2" ADD OBJECT command1 AS commandbutton WITH ; Top = 58, ; Left = 100, ; Height = 27, ; Width = 84, ; Caption = "Next", ; Name = "Command1" ADD OBJECT command2 AS commandbutton WITH ; Top = 86, ; Left = 100, ; Height = 27, ; Width = 84, ; Caption = "Prev", ; Name = "Command2" PROCEDURE Init CREATE CURSOR crsTest (Fld1 L) INSERT INTO crsTest VALUES(.f.) INSERT INTO crsTest VALUES(.t.) GO TOP ThisForm.RefreshControls() ENDPROC PROCEDURE refreshcontrols thisform.Optiongroup1.Value = IIF(crsTest.Fld1,1,2) WITH EVALUATE([thisform.OptionGroup1.Option]+TRANSFORM(thisform.OptionGroup1.Value)) .SetFocus() ENDWITH ENDPROC PROCEDURE optiongroup1.InteractiveChange REPLACE Fld1 WITH (this.Value == 1) IN crsTest ENDPROC PROCEDURE command1.Click SKIP thisform.Refreshcontrols() ENDPROC PROCEDURE command2.Click SKIP -1 thisform.Refreshcontrols() ENDPROC ENDDEFINE * *-- EndDefine: form1 **************************************************