Information générale
Catégorie:
Codage, syntaxe et commandes
Oops, I misspoke (mistyped)... I meant the Click event in by Refresh button
Code follows:
PUBLIC oform1
oform1=CREATEOBJECT("form1")
oform1.Show()
RETURN
**************************************************
*-- Form: form1 (c:\limpact\releases\nextrele\rex3.scx)
*-- ParentClass: form
*-- BaseClass: form
*
DEFINE CLASS form1 AS form
DoCreate = .T.
Caption = "Form1"
Name = "Form1"
ADD OBJECT commandgroup1 AS commandgroup WITH ;
AutoSize = .T., ;
ButtonCount = 4, ;
BackStyle = 0, ;
BorderStyle = 0, ;
Value = 1, ;
Height = 39, ;
Left = 29, ;
Top = 153, ;
Width = 316, ;
Name = "Commandgroup1", ;
Command1.Top = 5, ;
Command1.Left = 5, ;
Command1.Height = 29, ;
Command1.Width = 75, ;
Command1.Caption = "Button 1", ;
Command1.Name = "Command1", ;
Command2.Top = 5, ;
Command2.Left = 82, ;
Command2.Height = 29, ;
Command2.Width = 75, ;
Command2.Caption = "Button 2", ;
Command2.Name = "Command2", ;
Command3.Top = 5, ;
Command3.Left = 159, ;
Command3.Height = 29, ;
Command3.Width = 75, ;
Command3.Caption = "Button 3", ;
Command3.Name = "Command3", ;
Command4.Top = 5, ;
Command4.Left = 236, ;
Command4.Height = 29, ;
Command4.Width = 75, ;
Command4.Caption = "Button 4", ;
Command4.Name = "Command4"
ADD OBJECT command1 AS commandbutton WITH ;
Top = 48, ;
Left = 140, ;
Height = 29, ;
Width = 94, ;
Caption = "Refresh", ;
Name = "Command1"
PROCEDURE commandgroup1.Refresh
*-*for nButtonNumber = 1 to this.ButtonCount
*-* this.Buttons[nButtonNumber].Refresh()
*-*endfor
ENDPROC
PROCEDURE commandgroup1.Command1.Refresh
this.caption = iif(this.Caption = "Button 1","Btn1","Button 1")
ENDPROC
PROCEDURE commandgroup1.Command2.Refresh
this.caption = iif(this.Caption = "Button 2","Btn2","Button 2")
ENDPROC
PROCEDURE commandgroup1.Command3.Refresh
this.caption = iif(this.Caption = "Button 3","Btn3","Button 3")
ENDPROC
PROCEDURE commandgroup1.Command4.Refresh
this.caption = iif(this.Caption = "Button 4","Btn4","Button 4")
ENDPROC
PROCEDURE command1.Click
thisform.commandgroup1.Refresh()
ENDPROC
ENDDEFINE
*
*-- EndDefine: form1
**************************************************
Thanks
Rex
>David,
>
>In the click event of my form I have:
>
>thisform.CommandGroup1.Refresh()
>
>The only code executed when I click the button is the CommandGroup refresh method, none of the button refresh code is run.
>
>A thisform.refresh works as expected, but the form I am using has too many controls that do not need to be refreshed.
>
>Thanks
>Rex
>
>>Rex,
>>
>>It must be something you are doing. This form works fine in VFP3 build 0711 for me. Each form click the caption of the first button changes:
>>
>>**************************************************
>>*-- Form: cform (e:\vfp3app\misc\cmgtest.scx)
>>*-- ParentClass: cform (e:\vfp3app\ccontrol.vcx)
>>*-- BaseClass: form
>>*
>>DEFINE CLASS cform AS cform
>>
>>
>> DoCreate = .T.
>> Name = "cform"
>>
>>
>> ADD OBJECT commandgroup1 AS commandgroup WITH ;
>> ButtonCount = 2, ;
>> Value = 1, ;
>> Height = 70, ;
>> Left = 24, ;
>> Top = 24, ;
>> Width = 104, ;
>> Name = "Commandgroup1", ;
>> Command1.Top = 5, ;
>> Command1.Left = 5, ;
>> Command1.Height = 29, ;
>> Command1.Width = 94, ;
>> Command1.Caption = "1", ;
>> Command1.Name = "Command1", ;
>> Command2.Top = 36, ;
>> Command2.Left = 5, ;
>> Command2.Height = 29, ;
>> Command2.Width = 94, ;
>> Command2.Caption = "Command2", ;
>> Command2.Name = "Command2"
>>
>>
>> PROCEDURE Refresh
>> ? program()
>> ENDPROC
>>
>>
>> PROCEDURE Click
>> this.Refresh()
>> ENDPROC
>>
>>
>> PROCEDURE commandgroup1.Refresh
>> ? program()
>> ENDPROC
>>
>>
>> PROCEDURE commandgroup1.Command1.Refresh
>> ? program()
>> this.Caption = alltrim( str( val( this.Caption ) + 1 ) )
>> ENDPROC
>>
>>
>> PROCEDURE commandgroup1.Command2.Refresh
>> ? program()
>> ENDPROC
>>
>>
>>ENDDEFINE
>>*
>>*-- EndDefine: cform
>>**************************************************
>>
>>>Sorry, I'm using VFP3. I just added a command group to a form, changed the captions of the buttons in the refresh event and added another button with a commandgroup refresh in the click event. Run the form, click the refresh button, and only the refresh of the commandgroup is run, no button refresh.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement