Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ControlSource is writeonly in Commandgroup.
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00895072
Message ID:
00895452
Vues:
23

I still think an optiongroup is better suited to this.


I can use a optiongroup,
but i do not want see the press down/up optionbutton status,
and into a optiongroup is not possible have:
optionGroup.Value = 3
with
optionGroup.Buttons[3].Value = .F.



What is the type of the controlsource?
Is it numeric or an integer? It should work if it is. I just tried it.


yes, integer:

Use this code:
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN

DEFINE CLASS form1 AS form


	Height = 453
	Width = 375
	DoCreate = .T.
	Caption = "Form1"
	AllowOutput = .F.
	Name = "Form1"


	ADD OBJECT command2 AS commandbutton WITH ;
		AutoSize = .T., ;
		Top = 19, ;
		Left = 26, ;
		Height = 27, ;
		Width = 95, ;
		Caption = "Refresh Cycle", ;
		Name = "Command2"


	ADD OBJECT command1 AS commandbutton WITH ;
		AutoSize = .T., ;
		Top = 56, ;
		Left = 7, ;
		Height = 27, ;
		Width = 126, ;
		Caption = "Focus on CmGroup", ;
		Name = "Command1"


	ADD OBJECT commandgroup1 AS commandgroup WITH ;
		AutoSize = .T., ;
		ButtonCount = 10, ;
		ControlSource = "myCfg.defaultButton", ;
		Height = 298, ;
		Left = 138, ;
		Top = 7, ;
		Width = 101, ;
		Name = "Commandgroup1"

	ADD OBJECT optiongroup1 AS optiongroup WITH ;
		ButtonCount = 10, ;
		Value = 1, ;
		ControlSource = "myCfg.defaultButton", ;
		Height = 223, ;
		Left = 253, ;
		Top = 12, ;
		Width = 94, ;
		Name = "Optiongroup1"
	
	PROCEDURE optiongroup1.Init
		FOR k=1 TO M.this.ButtonCount
			this.Buttons[m.k].Caption = 'Option '+TRANSFORM(m.k)
			this.Buttons[m.k].Autosize = .T.	&& ANOTHER BUG INTO optiongroup1
		NEXT

	PROCEDURE Load
		CREATE CURSOR myCfg (defaultButton i)
		INSERT INTO myCfg VALUES (2)
		clear
	ENDPROC


	PROCEDURE command2.GotFocus
		? 'refresh cycle have focus'
	ENDPROC


	PROCEDURE command2.Click
		? 'Commandgroup value:',thisform.Commandgroup1.Value
		? thisform.Commandgroup1.Value
		replace IN myCfg defaultButton WITH 1+defaultButton%thisform.Commandgroup1.ButtonCount
		? 'defaultButton is changed to',myCfg.defaultButton
		? 'refresh'
		thisform.Refresh
		* Commandgroup value is not refreshed
		? 'Commandgroup value:',thisform.Commandgroup1.Value
		* NOW I DO A TAB CYCLE INTO THROUGH I CONTROLLI, E RITORNO SU This control
		* you can see that Commandgroup value is refreshed
		KEYBOARD REPLICATE('{TAB}',13)
	ENDPROC


	PROCEDURE command1.Click
		* you go into the commandgroup, but the value is ignored
		? 'i go into commandgroup, but Value is ignored'
		KEYBOARD '{TAB}'
	ENDPROC


ENDDEFINE
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform