Basic Windows

ImageWindow

Purpose:

Display an image file in a movable window.

Category:

Windows

Syntax:

ImageWindow "title" "left" "top" "file name"

title

The text that will appear in the window’s title bar.

left, top

The window’s left, top corner relative to the upper left corner of the publication’s work area. Enter “-1” for both to center the window on the screen.

file name

The name of the image file to display.

Example:

ImageWindow "Map" "-1" "-1" "c:\samples\downtown.bmp"


TextWindow

Purpose:

Display a plain text (ASCII/ANSI) or formatted Rich Text (RTF) file in a floating window.

Category:

Windows

Syntax:

TextWindow "title" "left" "top" "width" "height" "file name" "options"

title

The text that will appear in the window’s title bar.

left, top

The window’s left, top corner relative to the upper left corner of the publication’s work area. Enter “-1” for both to center the window on the screen.

width, height

The desired width and height for the window. Enter “-1” for both to detect the file’s optimal width and height.

file name

The name of the text file to display.

options

Use “Wordwrap” to automatically format the text to fit within the window’s margins.

Example:

TextWindow "Help" "-1" "-1" "350" "400" "c:\documents\help.txt" "Wordwrap"


CloseWindow

Purpose:

Close a window previously opened with ImageWindow or TextWindow.

Category:

Windows

Syntax:

CloseWindow "file name"

file name

The file name of the window to close, or leave blank to close all open windows.

Example:

CloseWindow "C:\Samples\Chart1.bmp"



Custom Windows

CustomWindow

Purpose:

Display an object or group of objects in a window. This Action can be used to create custom dialog boxes, tool windows, etc.

Category:

Windows

Syntax:

CustomWindow "title" "left" "top" "object name" "options"

title

The text that will appear in the window’s title bar (if it has one).

left, top

The coordinates for the window’s left, top corner relative to the upper left of the publication window. Enter “-1” for both to center the window on the screen.

Object name

The name of an existing object, Container or group that will comprise the contents of the window.

options

One of the following:


NoBorder

The window will be displayed without a title bar or border.

DialogBox

The window has a title bar and dialog box style border.

ToolWindow

The window has a small tool palette style title bar and border. You can use this option to create special windows (like navigation bars, etc.) that float above your publication!

Sizeable

The window has a title bar and a border. The window can be resized.

FixedPos

The window is attached to the publication at a fixed position. The window will retain its relative position even when the publication window is moved. The window will not contain a title bar or border.


Additionally, you may combine one of the choices above with one or both of the following:


Exclusive

Other parts of the publication are suspended until the window is closed. This allows you to build modal dialog boxes that require that the reader input information or select options before continuing.

NoCloseBtn

Hide the window's close button.


CAUTION: If you use both the Exclusive and NoCloseBtn options, you must provide your own method for closing the window. Otherwise, the reader will not be able to close the window and return to your publication. You can programmatically close a custom window by creating a button that executes the CloseCustomWindow Action. Your close button should be added to the Container or group that makes up the contents of the window.

Example:

Custom windows can be constructed from a single object, a group of objects or a Container. Just place the object(s) you want to use outside the visible portion of a page or on a page that you do not intend to display. (Actually, it doesn't really matter where you place these objects, but while they are displayed inside the custom window, they disappear from the page since they can't be in both places at the same time.) The objects also do not need to be on the page that's visible when the CustomWindow Action is executed. To use more than one object, you can combine them using the Arrange menu's Group command, but the preferred method is to simply place the object’s you wish to use on a Container.


The interior of the custom window will match the size of the object, Container or group you select. When using a Container, the Fill Color you select for the Container will become the background of the custom window. You can add a Picture object to the Container if you want a really fancy background.


A Container with several attached objects ready for use with VisualNEO for Windows's CustomWindow Action.


Once you have arranged the objects for your window, pass the Container's name to the CustomWindow Action. The following example uses the “Exclusive” option to display "Container1" in a dialog box:


CustomWindow "My Dialog Box" "-1" "-1" "Container1"  "DialogBox+Exclusive"


The same Container displayed in a CustomWindow with a dialog box style border.


The reader can close the dialog box by clicking on the window's close button, or you can provide a Push Button that executes the CloseCustomWindow Action. For example, the OK and Cancel buttons above do this:


CloseCustomWindow "Container1"


You can also use CustomWindow to display a single object (like a Media Player or Web Browser) instead of a group or Container:


CustomWindow "Video" "-1" "-1" "MediaPlayer1" "ToolWindow"


Plug-in developers may find the global [Object.WinHandle] variable useful.

Special

Options:

You can define special subroutines that will be executed when a specific custom window is opened or closed. To do this, simply create two subroutines - one called ObjectName_OnOpen and one called ObjectName_OnClose. Replace ObjectName with the name of object used when opening the window. For example, the subroutines for our Container1 sample above might look like this:


:Container1_OnOpen
  AlertBox "Hello" "The window is opening."
Return
:Container1_OnClose
  AlertBox "Hello" "The window is closing."
Return


See App Properties > Actions for more information on creating subroutines.


If you’re creating a sizeable custom window, you can restrict the window’s size by setting the following variables at some point before the window is created:


[ObjectName_MinWidth]
[ObjectName_MinHeight]
[ObjectName_MaxWidth]
[ObjectName_MaxHeight]


Replace ObjectName with the name of the object used when opening the window.

You can obtain the current position of an open custom window by passing the name of the object used to open the window to the GetObjectInfo Action. For example:


GetObjectInfo "Container1" "Left" "[WinX]"
GetObjectInfo "Container1" "Top" "[WinY]"


This will return the upper left and top coordinates relative to the publication's upper left corner.


CloseCustomWindow

Purpose:

Close a window previously opened with the CustomWindow Action.

Category:

Windows

Syntax:

CloseCustomWindow "object  name"

object name

The name of the object passed to CustomWindow when the window was opened.

Example:

CloseCustomWindow "Container1"