main logo
Subject: Re: Form-specific menus
Author: graeme thomson
Posted: 2001/09/01 05:01:37
 
View Entire Thread
New Search



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>


 
©2001 graeme thomson
<-- Prior Message New Search Next Message -->