contents   index   previous   next



SElib.makeWindow()

syntax:

SElib.makeWindow(parent, class, windowFunction,

                 text, style, col, row,

                 width, height,

                 createParam, utilityVar)

where:

parent - window handle of the parent window of this window, which would mean that this window is a subwindow. Pass null if this window is being created on the desktop, without a specific window being its parent. If null, the desktop is the parent.

 

class - a string or an object. If this parameter is a string, it must be one of the pre-existing Windows classes:

 

button

combobox

edit

listbox

scrollbar

static

 

If this parameter is an object or structure it may have the following properties:

 

.style         Windows class style

.icon          icon bitmap for minimized window

.cursor        appearance when over this window

.background    window background color

 

Properties that are not assigned values receive default values. In general, the class defines the behavior of a window.

 

windowFunction - an identifier, the function that is called whenever Windows sends a message to this window. Use null if no function is to be called to intercept windows messages. In the case of null, default functions for Windows are called. If specified, the windowFunction should return a number or nothing. Use the actual identifier of the function and not a string with its name. For example, use MyWinFunction instead of "MyWinFunction". The windowFunction is described in greater detail in the description section.

 

text - the window title or caption that appears in the title bar. Use null or "" if the window has no title.

 

style - the style of the window. Windows has many predefined styles that may be joined into one style by using the bitwise or operator, "|". Windows styles are defined with "WS_" at the beginning. For example, WS_MAXIMIZEBOX | WS_THICKFRAME would define a window that has a thick frame and a maximize box. The "WS_" windows styles are standard definitions used in Windows programming and may be found in winobj.jsh or window.jsh.

 

col - the left most column of the window, expressed in pixels.

 

row - the top most row of the window, expressed in pixels. Together, col and row define the top left corner of the window. Use CW_USEDEFAULT for col and row to let Windows set the position.

 

width - the total width of the window, expressed in pixels.

 

height - the total height of the window, expressed in pixels. By using col, row, width, and height, a window can be place precisely on a screen.

 

createParam - normally set to null. If used, it may be a number or object that is passed with the Windows WM_CREATE message when creating a window.

 

utilityVar - any variable that a scripter chooses. This variable is passed to the windowFunction when it receives a Windows message. The windowFunction may alter the utilityVar. An object or structure may be used, in which case many values may be passed and altered as properties of the object. One practice is to use an object to keep up with the properties of a window, sometimes including its subwindows. This object is a good vehicle for passing information.

 

return:

number - the handle of the window created on success, else null.

 

description:

For Win32 and Win16

 

This method is the basic function for creating windows that will be opened and managed by ScriptEase. This function provides the basis for normal windows operations when windows created by it are opened. This function registers the created window with ScriptEase, so that when the .doWindows() method is executed, this window will be properly managed.

 

If the class of the Window is unknown, it is registered as a new class.

 

The windowFunction, a parameter of SElib.makeWindow(), is a function that is specified to intercept and handle all Windows messages that are posted to this window, the window just created by SElib.makeWindow(). The windowFunction will intercept all messages sent its associated window which slows execution of a script. Use SElib.messageFilter() to limit the messages that are actually intercepted by the windowFunction. If the windowFunction has a return value, it must be a number, which seems limiting. But remember, that you may use utilityVar as a variable for receiving information and for passing information.

 

The definition of a windowFunction must follow the following format:

 

function MyWinFunction(hWnd, Message, Param1,

                       Param2 [, utilityVar])

{

// Body of the window function

}

 

hWnd - a number, Window handle for the window that receives these Windows messages. It is the handle of the window created by SElib.makeWindow() that specified this function to receive messages.

 

Message - a number, a message ID. Windows defines message IDs and posts them to windows.

 

Param1 - a parameter that may accompany a message.

 

Param2 - a second parameter that may accompany a message.

 

utilityVar - an optional variable that is specified in the SElib.makeWindow() call that created this window. This variable is often an object/structure with several pieces of information which may be altered. If it is, the changes are available to other functions that may use the variable while SElib.doWindows() is active and is showing and managing the windows under its control.

 

see:

SElib.doWindows()

 

example:

var InfoStruct;

InfoStruct.width = 400;

InfoStruct.height = 300;

 

var hWnd  = SElib.makeWindow

            (

               0, null, MyWinFunction,

               "My Window", WS_MAXIMIZEBOX,

               CW_USEDEFAULT, CW_USEDEFAULT,

               InfoStruct.width, InfoStruct.height,

               null, InfoStruct

            );

 

function MyWinFunction(hWnd, Msg, Param1,

                       Param2, UtilVar)

{

   // Body of function to process messages.

   // Notice that UtilVar receives InfoStruct

}

 


SElib.messageFilter()