This topic explains you how you can show and hide TOC items at runtime. For instance, you want to display some TOC items only if the publication works in Registered mode.
In the TOC editor, you have a property named “Visibility HEScript Function“:
This property can point to a Boolean HEScript function that defines whether the TOC entry is visible or not.
The syntax should be:
When the publication loads the TOC, if a TOC item is associated to a Boolean function, the latter is executed. If its result is True, the TOC item is displayed; otherwise, if the result is False, the TOC item is hidden.
To refresh the TOC, you can use the RefreshTOC HEScript built-in macro.
This sample hides TOC items if the publication works in Trial mode, and shows them if it is in Registered mode.
1) Go to the Script Manager, edit the “UserMain” script and copy/paste the following code:
function HideItIfTrial: Boolean; begin // Returns False to hide the TOC item if HEPubRegistered is set to 1 (Registered) Result := GetGlobalVar("HEPubRegistered", "0") = "1"; end;
2) Close the script editor, go to the Table of Contents page and choose the TOC item you want:
Enter the reference to the script function:
UserMain.HideItIfTrial or select it with the “…” button. Press Enter to save changes.
3) Make sure you have enabled the option to make a Trial publication and compile it.
Copyright G.D.G. Software 2019. All rights reserved