Enabling / disabling child menu items in runtime (SOLVED)

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.

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:

Then you can call SetMenuProp with:

SetMenuProp("muser_[username]", "Enabled", "FALSE");

In the case shown on the screenshot, it would be:

SetMenuProp("muser_Mypage1", "Enabled", "FALSE");

Then you can use this HEScript code (for instance in the UserMain script):

procedure DisableMyMenu;
begin
SetMenuProp("muser_Mypage1", "Enabled", "FALSE");
end;

and then this JavaScript code:

window.external.RunHEScriptCom("UserMain.DisableMyMenu");

SetMenuProp accepts Enabled, ImageIndex, Visible, Caption (if you want to change the text of the menu)…

Thanks for that, nice one…

Just a correction:

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

in the above example it should read window.external.RunHEScriptCom(“UserMain.DisableMyMenu”);

This has been fixed. Thanks!

This topic was automatically closed after 24 hours. New replies are no longer allowed.