************************************************** *-- Class: opgLogical *-- BaseClass: optiongroup *-- Option group that can be bound to a logical field - set the control's cControlSource property and NOT the ControlSource * Define Class opgcharacter As optiongroup ButtonCount = 2 Name = "opglogical" Option1.Caption = "Yes" Option1.Height = 17 Option1.Left = 5 Option1.Top = 5 Option1.Width = 61 Option1.Name = "optYes" Option2.Caption = "No" Option2.Height = 17 Option2.Left = 5 Option2.Top = 24 Option2.Width = 61 Option2.Name = "optNo" BackStyle = 0 Value = 0 Height = 46 Width = 71 *-- To be used instead of controlSource for binding this control ccontrolsource = "" *-- Called from valid to update real controlsource Procedure updatecontrolsource Local lcField, lcAlias, lcControlsource, llValue *** From the value which is numeric If Not Empty( This.ccontrolsource ) llValue = IIF( This.Value = 1, .T., .F. ) lcControlsource = This.ccontrolsource If Upper( Left( lcControlsource, 4 ) ) == 'THIS' &lcControlsource = llValue Else lcField = Justext( lcControlsource ) lcAlias = Juststem( lcControlsource ) Replace ( lcField ) With llValue In ( lcAlias ) Endif Endif Endproc *-- Called from refresh to update the real value Procedure updatevalue *** Read the value of the controlsource and use it to set the correct value for the control Local llValue, lnValue If Not Empty( This.ccontrolsource ) llValue = Evaluate( This.ccontrolsource ) lnValue = IIF( llValue, 1, 2 ) This.Value = lnValue Endif Endproc Procedure Valid This.updatecontrolsource Endproc Procedure Refresh This.updatevalue() DoDefault() Endproc Enddefine **************************************************