Konu: Clicking on "white space" within a commandgroup
Hello:
The text
"In Visual FoxPro 3, the .Value of a Command Group corresponds to the most recently pressed button. A developer could code the Click logic for all contained buttons in the Command Group's .Click method, perhaps using a DO CASE. If the Command Group.Value were initialized to 0 at design time, then reset to 0 after processing the Click, the logic could be coded so as to trap .Value = 0 as a click on "white space" within the group. If the .Value is not explicitly reset to 0 after a button has been pressed, any clicks on "white space" thereafter will trigger a .Click() event with the .Value still corresponding to whatever button was most recently pressed."
(http://fox.wikis.com/wc.dll?Wiki~CommandGroup)
describes my situation:
"any clicks on "white space" thereafter will trigger a .Click() event with the .Value still corresponding to whatever button was most recently pressed."
My code is
DEFINE CLASS clDataCmdGrp AS Hanscommandgroup OF "D:\Databases\Class libraries\Hans VFP Common Classes\HansBaseClasses.VCX"
ButtonCount = 4 && ********** ADD NUMBER OF MENU BUTTONS HERE! ***********
PROCEDURE Click && ************ ADD CLICK COMMAND FOR EACH CASE HERE *************
DO CASE
CASE This.Value = 1 && Delete
MESSAGEBOX('Add command here – 1')
CASE This.Value = 2 && Save
MESSAGEBOX('Add command here – 2')
CASE This.Value = 3 && Quit
MESSAGEBOX('Add command here – 3')
CASE This.Value = 4 && Edit
MESSAGEBOX('Add command here – 4')
ENDCASE
ENDPROC
ENDDEFINE
(Messageboxes are temporary.)
I am not sure where to reset the commandgroup's value to 0 (if that is what to do) or, as is said in the book "Hacker's Guide ...", not use Commandgroups (almost) at all.
Regards,
Hans L