Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CodeMine Question
Message
From
09/08/2001 18:39:22
 
 
To
08/08/2001 13:09:57
Gary Taylor
East St. Information Systems
Essex Junction, Vermont, United States
General information
Forum:
Visual FoxPro
Category:
CodeMine
Miscellaneous
Thread ID:
00541380
Message ID:
00542066
Views:
23
Gary:

>Using CodeMine version 6.1.19, I'm trying (and apparently failing) to disable the Toolbar Delete button in certain circumstances.

You can disable the delete button (or any other state) in the Form.IsEnabled method. The state manager passes the name of the delete method (ie. Delete <s>) to the Form.IsEnabled method. If IsEnabled returns .T., the delete method is allowed and therefore any object hooked to this state will be enabled. If it returns .F., then the object will be disabled.

So, sublcass the IsEnabled method and place the code that determines the "certain circumstances" in which you want the delete button enabled/disabled. Your custom code simply returns .T. or .F. to toggle the state.

Don't forget to issue a dodefault() so that the enabled state is processed for all methods other than the delete method. So ...

Form.IsEnabled
LPARAMETER cMethod, cWorkarea

IF m.cMethod == 'Delete' && Remember the parameter is passed in Proper case.
If ... (I want the delete button enabled.)
Return .T.
Else
* I don't want the delete button enabled.
Return .F.
Endif

* Default processing
RETURN DODEFAULT(m.cMethod, m.cWorkarea)

Hope this helps.
-=Gary
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform