Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Edit Mode no more?
Message
From
29/10/1999 13:06:30
 
 
To
28/10/1999 15:33:08
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00283324
Message ID:
00283921
Views:
10
Hi John.

>But how do you solve the "irrelevent enabled controls" problem? For example, is your Undo and/or Cancel button always enabled?

I do this with a timer associated with the toolbar containing the buttons. The timer fires every couple of seconds and refreshes the toolbar. The Refresh method of each button class does whatever is necessary to enable or disable the button. For example, the Refresh method of my Cancel Changes button class looks like this (simplified slightly):
local llOK, ;
    llOK2
if type('_screen.ActiveForm.Name') = 'C'
    llOK  = pemstatus(_screen.ActiveForm, 'Cancel', 5)
    llOK2 = pemstatus(_screen.ActiveForm, 'IsRecordChanged', 5)
    This.Enabled = llOK and llOK2 and ;
        _screen.ActiveForm.IsRecordChanged()
else
    This.Enabled = .F.
endif type('_screen.ActiveForm.Name') = 'C'
(The two PEMSTATUS tests are on separate lines on purpose as a workaround for a VFP bug that holds an object reference when more than one PEMSTATUS call is used in the same statement).

This ensures the cancel button is only enabled if a form is open, if it has Cancel and IsRecordChanged methods (my base class for data entry forms has these methods), and the IsRecordChanged method of the form returns .T. That method uses GETFLDSTATE() (and some other convoluted code) to determine if something has changed.

Doug
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform