wb_create_control

int wb_create_control (int parent, int ctlclass [, mixed caption [, int xpos [, int ypos [, int width [, int height [, int id [, int style [, int param [, int ntab]]]]]]]]])

Creates a window control, menu, toolbar, status bar or accelerator.

This function may set the text and/or the tooltip (small hint window) of the control when it is created. To create a tooltip, text must be an array with two elements. The first one is the new caption (or NULL if one is not required) and the second one is the new tooltip (or NULL if one is not required). Most classes support tooltips. See the table in wb_set_text() to check which classes do support them.

Returns the handle of the newly created control or NULL or zero if an error occurs.

Parameters

parent is a handle to the WinBinder object that is the parent window.
ctlclass is the class of the control or object to be created. Click here for a list of the available control classes.
caption is either a string with the caption of the control, an array of captions, or an array of arrays with caption and/or tooltip information, depending on the control class.
xpos, ypos, width and height describe the position and dimensions of the control when required.
id is an integer that identifies the control. It must be unique if the control is to be processed by a callback function.
style contains the style flags.
param is an optional integer value that depends on the control class. See wb_set_value() for supported values.
ntab is the index of the tab page that the control is to be inserted on, if any.

Return value

This function returns an integer that is a handle to the WinBinder object created, or NULL if the function fails.

Control class information

See the table in the wb_set_text() page.

Example

// Create some controls

wb_create_control($mainwin, Frame, "Group A", 10, 6, 85, 89);
wb_create_control($mainwin, RadioButton, array("Option 1", "This is Option 1"), 20, 24, 70, 14, 101, WBC_GROUP, 0);
$ctrl = wb_create_control($mainwin, PushButton, 'My Button 1', 20, 50, 120, 22, 101);

$toolbar = wb_create_control($mainwin, ToolBar, array(
    null,
    array(ID_NEW,                   NULL, "New (Ctrl+N)",           0),
    array(ID_OPEN,                  NULL, "Open (Ctrl+O)",          1),
    array(ID_SAVE,                  NULL, "Save (Ctrl+S)",          2),
    null,
    array(ID_WEBSITE,               NULL, "Web site",                       11),
), 0, 0, 16, 15, 0, 0, PATH_RES . "toolbar.bmp");

See also

wb_create_window
wb_set_text
wb_set_value
Control classes
Control functions
TabControl class