Creating an object with its initial values

create

Create an object with its default properties


SYNTAX

create object_id [, object_id]…

Create the object or objects specified.

If the object is a window, and it already exists, it is not re-created. It is necessary to destroy the window before creating it. Note that controls in the window are created with their default values, so it may be necessary to reset their state.

If the object is anything other than a window, and it already exists, it is first destroyed and then re-created.

The object is created with its default properties. These were originally assigned to it in the clauses of its definition, but may have been altered at run time by means of the -> construct:

object_id->property = value

If the, winclass, menu style or menu label properties are changed at run time, the window or object must be destroyed before the changes are made. The new values are used when the object is next created.

If the xcreate | ycreate properties are changed, the window or object does not need to be destroyed, but the changes do not take effect until the next time the object is created.

It is not necessary to destroy or re-create an object if any other properties are changed. If possible, Sculptor changes the property without destroying the object. Otherwise, if the object is currently in the created state, Sculptor destroys it and re-creates it with the new property value(s). Windows are an exception to this rule; Sculptor does not destroy and re-create them automatically. The programmer must do so.

Runtime changes to non-visible properties such as event functions take effect immediately. Changing the caption pen takes effect when the next caption relating to that object is displayed. There is no need to create the object in order to effect such changes.

If an object is created invisible, use the show command to display it. The show command may be used on a destroyed object, in which case it is created automatically.

When a window or object is created, the EV_CREATE event is generated for it. See Event functions.

The object_id may be any of the following:

window_id

A window. Windows declared with +window are automatically created when a program loads; those declared with -window are not, and must be created when they are needed. All objects within the window which were defined with a + (e.g. +listbox) are also created. Those declared with a - (e.g. -button) are not. Windows are created visible unless assigned the style flag WS_INVISIBLE.

Note that the create command does not destroy a window that already exists.

group_id

A textbox group or button group. All the boxes or buttons within the group are created.

box_id, button_id, listbox_id, table_id, text_id

The control is created visible unless it has been assigned the style flag WS_INVISIBLE. It may then be displayed by means of the show command. A control’s initial visibility status may be changed at run time by changing this flag. The control must first be destroyed. Then the style flag is added or removed, and the control re-created.

graphic_id

A graphic.

menu_id

A menu. The menu is re-created with its initial properties. The menu will not be visible until displayed by means of the open command. The close command is used to hide a menu.

Different object types may be freely mixed in a create command.


EXAMPLE

  1. Create a window and all objects contained in it

    create Window1
    
  2. Create all buttons in the group StyleGroup

    create Window3.StyleGroup
    
  3. Create a single textbox

    create Box54
    
  4. Change a window’s initial position and re-create it

    destroy WinAdd
    WinAdd->xcreate = 54
    WinAdd->ycreate = 30
    create WinAdd
    

RELATED TOPICS

destroy

open