Defining a window

A window declaration has the following syntax:

+|–window window_id at x, y {
     clauses
}

A window defined as +window is created when the program starts. A window defined as –window is not. The create command is used at run time to create such a window.

The objects (buttons, textboxes, tables, etc) which are to appear in this window are defined as clauses, which have further property clauses of their own. So a more specific structure is:

+|–window window_id at x, y {
     window clauses

     +|–button|listbox|table|textbox|text|graphic|ole object_id at x, y {
          clauses
     }

     button|checkbox|radio| textbox group group_id {
          group clauses
          +|–button| textbox object_id at x, y {clauses}
          … other objects in this group
     }

     menu menu_id {
          menu clauses
          menuitem** item_id {clauses}
          other menu items for this menu
     }

     +|–database database_id {
          clauses
     }

     …other object definitions
}

The window_id is the identifying name by which the window is subsequently referenced. It must be unique as an unqualified identifier within the program, and the usual identifier naming rules apply.

An object declared with a + (e.g. +listbox) is created when the parent window is created. An object declared with a (e.g. –textbox) is not.

The style flag WS_INVISIBLE determines whether a window or window control, once created, is visible or not. The show command makes the window or control visible, creating it automatically if necessary.

Window and window object definitions are usually created and maintained by means of the Sculptor program designer. They can be kept in a separate include file.


Window position

The x and y co-ordinates in a window’s definition specify its initial position. They are integer values, defining the position of the top left hand corner (origin) of the window, relative to the origin of the window’s parent. Position may be measured on a pixel grid or a character grid.

The default parent of all windows is the desktop, whose origin is the top left corner of the screen (position 0,0). A different parent can be assigned by means of the parent = clause. The x and y in a control’s definition specify the control’s position relative to the origin of its parent window.

The position of a window may be changed at run time, either by the either by the move command or by use of the xcreate and ycreate run time clauses.

The xposn and yposn run time clauses return an window’s current position.


RELATED TOPICS

Windows

Defining a window object