Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Yes/No control
Message
From
10/02/2001 15:27:12
 
 
To
10/02/2001 15:11:04
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Miscellaneous
Thread ID:
00474738
Message ID:
00474750
Views:
31
OK, here's some code. It's self-managing, all you have to do is set the DataSource to what you would normally set the ControlSource to and leave everything else as is.
DEFINE CLASS opglogic AS optiongroup
        ButtonCount = 2
        Value = 1
        ControlSource = "This.nControlValue"
        Height = 46
        Width = 71
	ncontrolvalue = 1
	datasource = ""
	Name = "opglogic"
	Option1.Caption = "Yes"
	Option1.Value = 1
	Option1.Height = 17
	Option1.Left = 5
	Option1.Top = 5
	Option1.Width = 61
	Option1.Name = "ogbYes"
	Option2.Caption = "No"
	Option2.Height = 17
	Option2.Left = 5
	Option2.Top = 24
	Option2.Width = 61
	Option2.Name = "ogbNo"


	PROCEDURE ncontrolvalue_assign
		LPARAMETERS vNewVal
		*To do: Modify this routine for the Assign method
		IF !EMPTY(This.DataSource)
			cDataSource=This.DataSource
			REPLACE (cDataSource) WITH IIF(vNewVal=2,.F.,.T.)
		ENDIF
		THIS.nControlValue = m.vNewVal
	ENDPROC


	PROCEDURE Init
		IF !EMPTY(This.DataSource)
			cDataSource=This.DataSource
			This.Value=IIF(!&cDataSource,2,1)
		ENDIF
	ENDPROC
ENDDEFINE
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform