Window
(Engine-Level Function)
Description: | Opens a new window, starts a module inside, and eventually returns the module's value. |
Returns: | Module Instance |
Usage: | Steady State only. |
Function Groups: | Basic Module, Window |
Related to: | SizeWindow | MoveWindow | VStatus | WindowClose | WindowOptions |
Format: | Window(Left, Top, ViewWidth, ViewHeight, VirtualWidth, VirtualHeight, Module, Style, Title, Color, Enable [, HelpFileName, HelpContext, enableDynamicPositioning]) |
Parameters: |
Left | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Required. Any numeric expression that gives the left coordinate of the new window. If the new window is a child window, Left is the user coordinate within the window of the calling module. If the new window is not a child window, Left is the number of pixels from the left of the screen. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Top | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Required. Any numeric expression that gives the top coordinate of the new window. If the new window is a child window, Top is the user coordinate within the window of the calling module. If the new window is not a child window, Top is the number of pixels from the top of the screen. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ViewWidth | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Required. Any numeric expression that gives the window width in pixels. The minimum width allowable is based on the operating system in use and the style options of the window (see the Comments section for more details). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ViewHeight | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Required. Any numeric expression that gives the window height in pixels. This value must be greater than or equal to 0. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
VirtualWidth | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Required. Any numeric expression that gives the width inside the new window in user coordinates (which may be pixels). If VirtualWidth is larger than the client area specified, a horizontal scroll bar appears. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
VirtualHeight | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Required. Any numeric expression that gives the height inside the new window in user coordinates (which may be pixels). If VirtualHeight is larger than the client area specified, a vertical scroll bar appears. If VirtualWidth and VirtualHeight are both set to 0 (zero) the effective virtual size of the window becomes the size of the monitor the window is within, varying dynamically. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Module | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Required. Any expression that uses a module call. The module will start, and all graphics in the module will draw in the new window. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Style | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Required. Any numeric expression that gives the style of the window when it opens. This parameter has no effect after the window has opened. Style is formed by adding together bit values from the table below. This parameter can be overridden by the variable PageWinOpt within a page's source code. (See: Bitwise Parameters & Operations)
Notes on the style settings:
|
Title |
Required. Any text expression that gives the window title. |
Color |
Required. Any numeric expression that gives the background color of the window's client area when the window opens. If set to -1, then the resulting window will be transparent, as will anything drawn in black (RGB 0, 0, 0) upon it. Not supported by the Anywhere client or on child windows (bit 9 is set). This parameter has no effect after the window has opened. Any of the following may be used:
|
Enable |
Required. Any logical expression. If true, the window opens and Module starts. If false, the window is closed and Module is stopped. |
HelpFileName |
Optional file name of the help file to use if the user presses F1 while this window is the active window. If absent or invalid when the user presses F1, the parent window will be checked for a file name. This continues recursively until the top of the window tree is reached. If no help file name is found, the default help file is used. The default help file can be set through the Setup.ini variable WEBHelp, or by using the EnableHelp statement. |
HelpContext |
Optional help context. If absent or invalid, but the HelpFileName is valid, then the "finder" dialog for help is displayed when the user presses F1. If valid and numeric, the help file is searched for a matching topic number and help is displayed for that topic. If valid and textual, the help file is searched for an exact match on the text string among the topic index of the help file. If there is more than one text match, the index is positioned at the first partial string match. If valid but a topic match is not found (neither textual nor numeric), the same action as an Invalid HelpContext is taken. If the HelpFileName parameter is Invalid, this parameter is ignored. |
enableDynamicPositioning |
An optional parameter that, when set to TRUE, will cause the window position to be updated if the window is a child window inside a GUITransform that moves, or if the LEFT or TOP parameters change. Set to FALSE by default. |
RibbonName |
Optional text string, identifying the ribbon. See comments. |
RibbonState |
Optional. A retained variable name, holding the persisted state of the ribbon. The persisted state is an XML snippet generated internally by the Microsoft ribbon API and is opaque to VTScada script code. The retained variable is typically set in the destructor for the module instance the Window statement runs. |
Comments: |
This function returns the value returned by Module. A window can be turned into a drag and drop target by adding the callback modules, OLEDrag and OLEDrop. Further details can be found in the chapter, Create Windows & Use Graphics Functions. If a ribbon is to be associated with this window, then the ribbon must be instantiated at the same time that the window is created, using the two optional parameters, RibbonName and RibbonState. Ribbons are compiled into resources, using Microsoft Visual Studio. The resources can then be linked directly into VTS.EXE (Trihedral use only) or into an external DLL. This allows multiple ribbons to be provided in separate DLLs. You can have more than one ribbon in VTS.EXE or a DLL. RibbonName is of the form "dllname|ribbonname", being the name of the DLL, a vertical pipe symbol and the name of the ribbon resource within the DLL. If the ribbon is compiled into VTS, the dllname and the pipe separator character are omitted. If adding a ribbon to a window, and if there is a chance that the window will be maximized, you should use the window's virtual width and virtual height as follows: Window(0, 0, 1024, 768, VStatus(Self(), 26), VStatus(Self(), 27) + VSTatus(Self(), 23), ... The virtual height in particular is important as otherwise there will be a gap at the bottom of the window (normally, eight pixels) that is the size of the frame height. |
Example:
Window( 0, 0 { Upper left corner }, 800, 600 { View area }, 800, 600 { Virtual area }, Graphics() { Start user graphics }, {65432109876543210} 0b00010000000110011, "Sample Window", 0, 1);
This statement will open a window, and run the module Graphics() in it.
Windows, Pages, and Graphics - A collection of best practices and related information.