Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Use Optiongroup with logical data?
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
MS SQL Server
Miscellaneous
Thread ID:
01187180
Message ID:
01187212
Views:
15
FWIW, it does work if you put code in the form's Refresh() to set the OptionButton values based on the field value,
IF myfield = .t.
	thisform.optiongroup3.option1.Value = 1
	thisform.optiongroup3.option2.Value = 0
ELSE
	thisform.optiongroup3.option2.Value = 1
	thisform.optiongroup3.option1.Value = 0
ENDIF
and more code in the OptionGroup.InteractiveChange method to modify the field if the Optionbuttons have changed.
DO CASE
CASE this.option1.Value = 1 AND myfield= .f.  && Yes button
	replace myfield WITH .t.
CASE this.option2.Value = 1 AND myfield = .t.  && No button
	replace myfield WITH .f.
OTHERWISE
	* field doesn't need changing
ENDCASE
			
thisform.Refresh()
But without bound data, the control is just a flag. It seems like there ought to be a better way--and there probably is: it's called a checkbox, but the client wants OptionButtons (and they're going to pay for them!)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform