| Application Settings - Working with Pop-up Windows |
Applies to IE Browser publications. HTML Executable lets you open several windows called pop-up windows (or popup) in the same IE browser publication; thus your users can see additional information without navigating away from the current page in the main window. Popup windows are windows without toolbar or status bar. They can feature a custom menu bar however.
How should pop-up windows display?In HTML Executable, you can define several properties for pop-up windows: go to Application Settings => Pop-Ups.
By default, pop-up windows are created as children of the main window. Consequently, you cannot return to the main window when closing the pop-up window. If you want to create independent pop-up windows, then enable this option. Note: if this option is used, independent pop-up windows may be hidden by the main window.
Pop-up windows may have their own menu bar with specific commands like Print, Close or custom ones. Enable this option and click Edit Menu Bar Items to manage the menu's entries. You can call some script commands from the default Global and Macros scripts that contain commands useful for popup menus: Global.HEExitPublication: exits the publication. For instance, if you want to add a "Print" menu to your pop-up windows, click Add, enter "Print" and click OK. Then choose "Execute this script function", select "Global.HEPopupPrintPreview" and that's all. You should get the same result as shown on this screenshot:
Note: all pop-up windows will share the same menu bar. How to open a popup windowThere are several ways to open a new popup window from your HTML pages:
Examples:
The popup's name will be pop1 and this popup will show the compiled webpage named popup1.htm
You can also use external links like http://www.htmlexe.com: our website
Syntax: window.open(page,"popup2","width=500, height=200"); window.open will only take account of the "width" and "height" parameters if available. If you want to set the position too, use window.external.ShowPopup instead. Note that you should always give a name to the popup window you create with window.open.
Syntax for window.external.ShowPopup: function window.external.ShowPopup(Name, URL, Width, Height, Top, Left, Param); Name: name of your popup window.
Note: to create a screen-centered popup, set both Left and Top to -1. All parameters are required.
procedure ShowPopup(const Name, URL: String; Width, Height, Top, Left: Integer; IsModal, RedirectLinksToMain: Boolean); Name: name of your popup window. Example: you could associate the following procedure (ShowFirstPopup) with a custom menu command or a toolbar button.
procedure ShowFirstPopup;
begin
ShowPopup("mypopup", "popup1.htm", 400, 300, 50, 25, false, false);
end;
Note: ShowPopupEx exists too. Additionally you could add the following HEScript commands to your UserMain script: { NewWindow: opens a new popup window. URL : url to the page to display WindowName: name of the popup (for targets and other functions). width: width of the popup height: height of the popup top: y screen position of the popup left: x screen position of the popup redirect: if "1", then all links are redirected to the main window. } procedure NewWindow(Url, WindowName, Width, Height, Top, Left, Redirect: String); In that case, you can now display any popup you want without having to create a specific HEScript function for each popup. <a href="hescript://UserMain.newwindow|popup1.html|pop1|200|100|50|80|0">Open a new window</a> How to close a popup window
End users may be prompted by Internet Explorer if they want to close the window.
Contrary to the previous one, this function does not ask end users whether they want to close the popup window. Example: Open the popup / Close the popup This function also exists in HEScript: procedure ClosePopup(const Name: String);
procedure CloseAllPopups; How to modify a popup size/position, set the focus...You can set up properties for popup windows using the SetUIProp function (available as HEScript or window.external JavaScript extension). JavaScript Syntax:
window.external.SetUIProp('popup_[name]', 'property name', 'property value');
Available property names are Left (x position), Top (y position), Width, Height, Caption (window title). Example: we want to move an existing popup to another location. We can use this JavaScript code: function setpopupxpos() { Demo:
|
This is the online documentation of HTML Executable.
About HTML Executable
HTML Executable is a versatile HTML compiler and ebook compiler: it lets you create secure ebooks and desktop applications with your websites, HTML or PDF documents.
You can easily create attractive ebooks, full-featured HTML applications (RIA) and software, digital publications from your websites, PDF files and HTML documents for online or offline distribution.