main logo
Subject: Re: Form-specific menus
Author: Bob Archer
Posted: 2001/09/07 18:05:54
 
View Entire Thread
New Search


<i><font color="#663300">
For example, lets say you have some forms that have a report tied to them. You could have a property in your form class, lHasReport. You can set it to true for those forms that have a report. You can also have a method in the form PrintReport() which will print the report, perhaps a report name is stored in another form property.

Then, in the toolbar's print button, in the refresh you could put code like...

IF PEMSTATUS(_Screen.ActiveForm,'lHasReport',5) and _Screen.ActiveForm.lHasReport
This.Enabled = .t.
else
This.Enabled = .f.
endif

Thank you for that Bob. It helped a lot. One other question though.
If the Print Button is DISABLED by default - say when no form is active, how do you make it disabled again when all forms are closed. The default behaviour via SetEnabled() appears to make it ENABLED.
For example, open a form where lHasReport is FALSE, the button is also disabled however close the form and the button becomes ENABLED.
There is a property in cToolBarButton - lEnabled which I suspect may help but I can find nowhere where this property is actually referenced.
There needs to be some method that resets the button to its default behaviour but how do you activate it.
Because toolbars never get focus then the refresh() and activate() methods don't fire when forms are closed.
</font></i>

</font></i>

Are you using a toolbar attached to the form, or are you using an application level toolbar? If application level, you may need to add a timer to the toolbar to refresh the toolbar every 5 seconds or so.

Tamar had an article about this, lets see, in the November 1997 issue of FxPro Advisor.

BOb



 
©2001 Bob Archer
<-- Prior Message New Search Next Message -->