Window objects - defining

Window controls are defined as clauses within the +|–window declaration of their parent window. Textboxes and buttons may be grouped.

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

button|checkbox|radio group group_id {
group clauses

+|–button button_id at x, y {clauses}

other buttons in this group
}

textbox group group_id {
group clauses

+|–textbox box_id at x, y {clauses}

other textboxes in this group
}

menu menu_id {
menu clauses

menuitem item_id {clauses}

other menu items for this menu
}

+|–database database_id {
clauses
}

+ declares an object that is created when its parent window is created.

– declares an object that is not created when its parent window is created. The create command must be used to create such an object

A menu is always created with its parent window, and requires no co-ordinates as it is automatically placed at the top of the window.

An ODBC database is declared as a window object but is not a visible control and requires no co-ordinates.

Textboxes or buttons with similar features may be grouped for convenience, so that commands may be executed and properties assigned to the group as a whole rather than to each control individually. Radio and checkbox buttons are always grouped. Other control types may not be grouped.

The clauses available for each object are listed in the section on that object. Window and window object definitions are usually created and maintained by means of the Sculptor program designer.


RELATED TOPICS

Defining a window


Identifying name

The object_id is the identifying name by which the control is referenced within the program. object_id is a collective term for the individual identifiers, which are as follows:

box_id

textbox

button_id

button

database_id

ODBC database

graphic_id

graphic

item_id

menu item

listbox_id

listbox

menu_id

menu

ole_ctrl_id

OLE control

table_id

table

text_id

static text

The terms box_id, button_id, etc are the terms used in this documentation to refer to identifiers. They are not part of the Sculptor language.

An object_id must follow the normal identifier naming rules.

Grouped buttons and textboxes

The object_id must be unique within its group, but may be duplicated elsewhere. If the object_id is unique within the whole program, then the object may be referenced by this name alone. If not, the form [window_id.]group_id.object_id must be used. The window_id is only required if the group_id and object_id are duplicated in other windows in the program.

Menus and menu items

The menu_id must be unique within the window, but may be duplicated for menus in other windows within the same program. If the menu_id is unique within the whole program, then the menu may be referenced by this name alone. If not, the form window_id.menu_id must be used. The latter form is recommended in any case, as it makes the code clearer and avoids any possibility of future conflicts.

No item_id may be repeated within the main menu bar, or within any single submenu. Apart from these exceptions, item_ids need not be unique, as they each have an individual path from the main menu bar. It is perfectly good practice to include an identical subitem in two menus.

If the item_id is unique within the whole program, then the item may be referenced by this name alone. If not, enough of the full path must provided to specify the item uniquely. This may include the parent item item_id(s), the menu_id and even the window_id

Other controls and objects

The object_id must be unique as an identifier within the window, but may be duplicated in a different window. The exception to this is that the object_id may be duplicated by that of a grouped control within the same window, as the group_id forms part of a grouped control’s long name. If the object_id is unique within the whole program, the object may be referenced by this name alone. If not, the form window_id.object_id must be used.


Position of window objects

This section applies only to objects which require x and y co-ordinates in their definition.

The co-ordinates are integers defining the position of the top left of the object, relative to the top left corner of its parent window. If a window is moved the object moves with it and retains its relative position within the window. The top left corner of the window is position 0, 0.

The minimum value for x is 0. This positions the object at the far left of the window. This position is therefore unsuitable for objects which have a label displayed to the left, or which have a left border and/or shadow.

The minimum value for y is also 0. This positions the control at the top of the window, beneath the top border and window title, if any. This position is therefore unsuitable for objects which have a label displayed above, or which have a top border and/or shadow.

Position may be measured on a pixel grid or a character grid.

There are no maximum values for co-ordinates. If either value is too high, the object is wholly or partly invisible.

The position of an object may be changed at run time, 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 object’s current position.


RELATED TOPICS

Windows