Enabling / disabling child menu items in runtime (SOLVED)

Status
Not open for further replies.

orionmetrics

New member
Not sure if anyone has mentioned this before, did do a search first and couldn’t find anything.

File menu items can be created via the Visual controls on the compiler before the compiled application program runs, but is is possible to ‘grey out’ / disable / enable child menu items during runtime via hescript ? eg if I create a top menu called say convert, and under convert it had the child items ‘to_xls’, ‘to_pdf’, ‘show chart’, I would only want the child items to show once say the input data file was read in, as it would make no sense to have them enabled before the data was available to convert. Is this possible ? Tried to read the hescript section and couldn’t find anything, but I may have been searching using the wrong keywords. Any help would be useful ?

Thanks for showing that an html view source menu can be added earlier.
 
Last edited:
To change the properties of a menu in ExeOutput for PHP (like Caption, Visible, Enabled), use the http://www.exeoutput.com/help/scriptreference.htm HEScript function.
You need to know the name of your menu, as shown on this screenshot:

8e197a5fd20b80c0.png


Then you can call SetMenuProp with:
Code:
SetMenuProp("muser_[username]", "Enabled", "FALSE");
In the case shown on the screenshot, it would be:
Code:
SetMenuProp("muser_Mypage1", "Enabled", "FALSE");
Then you can use this HEScript code (for instance in the UserMain script):
Code:
procedure DisableMyMenu;
begin
SetMenuProp("muser_Mypage1", "Enabled", "FALSE");
end;
and then this JavaScript code:
Code:
window.external.RunHEScriptCom("UserMain.DisableMyMenu");
SetMenuProp accepts Enabled, ImageIndex, Visible, Caption (if you want to change the text of the menu)…
 
Just a correction:

window.external.RunHEScriptCom(“UserMain.HideMyMenu”);

in the above example it should read window.external.RunHEScriptCom(“UserMain.DisableMyMenu”);
 
Last edited:
Status
Not open for further replies.
Back
Top