Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What is always active, regardless anything
Message
From
21/03/2001 18:58:04
Charlie Schreiner
Myers and Stauffer Consulting
Topeka, Kansas, United States
 
 
To
21/03/2001 17:08:04
Chuck Tripi
University of Wisconsin - Milwaukee
Milwaukee, Wisconsin, United States
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00487280
Message ID:
00487458
Views:
9
Hi Chuck,
Do what Linda suggested. I wouldn't use CommandGroups--it's easier with individual buttons. Command4 should know when it should be visible or be disabled.
PROCEDURE Refresh
LOCAL ARRAY aID[1]
aID = NULL
SELECT ID FROM Auth WHERE ID = ThisForm.ID INTO ARRAY aID
This.Enabled = NOT ISNULL(aID[1])
RETURN
This select doesn't change the work area or move the pointer--your method does. This button works (assume access to Auth) no matter where you locate the button. All you do is Refresh the form when a change in status occurs.
If you have a lot of buttons that use this logic, you need to create a form method, or an object that knows how to do the same thing. If performance is an issue, you can do the check once at the beginning of the Form's Refresh and set a property.
PROCEDURE Form.Refresh
LOCAL ARRAY aID[1]
aID = NULL
SELECT ID FROM Auth WHERE ID = ThisForm.ID INTO ARRAY aID
This.RecordsExist = NOT ISNULL(aID[1])
RETURN

PROCEDURE Button.Refresh
This.Enabled = ThisForm.RecordsExist
RETURN
>
SELECT auth
>COUNT FOR id = m.id TO ct
>SELECT person
>IF ct > 0
>	ThisForm.Commandgroup1.Command4.ENABLED = .F.
>ELSE
>	ThisForm.Commandgroup1.Command4.ENABLED = .T.
>ENDIF
>
>This is what I have in the listbox's Refresh (Command4 is the 'Delete' button). It works just about right, but now when I click the 'Edit' button, it enables the 'Delete' button (which is not good), but when I click the 'Add' button, it does not enable the Delete button (which is good). I tried GotFocus, it's useless (I don't know what it is, but am using LostFocus for something else). I will have to look at it somemore, but thanks for pointing it out to help me start.
>
>Chuck
>
>>I put such code in the refresh method of the buttons. Any event that should affect the enabled property of any object refreshes the form, or the objects that are affected.
Charlie
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform