wb_create_window

int wb_create_window (int parent, int wclass [, string caption [, int xpos [, int ypos [, int width [, int height [, int style [, int param]]]]]]])

or

int wb_create_window (int parent, int wclass [, string caption [, int width [, int height]]])

Creates a window of class wclass. Click here for a list of the available window classes. Windows created with this function must be destroyed with a call to wb_destroy_window(). Optional style flags may be passed through parameter style. To enable additional messages in a particular window, include the WBC_NOTIFY style in the style parameter and use param to indicate which additional notification messages you want to process.

This function may set the text and/or the tooltip (small hint window) of the window 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). All classes support tooltips.

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

Example

$mainwin = wb_create_window(NULL, AppWindow, "WinBinder", WBC_CENTER, WBC_CENTER, 640, 480, WBC_INVISIBLE | WBC_NOTIFY, WBC_DBLCLICK | WBC_GETFOCUS);

// Additional code here

/* Main window processing */
function process_main($window, $id, $ctrl=0, $param=0)
{
    global $statusbar;

    if($param == WBC_GETFOCUS) {
        wb_set_text($statusbar, "Control $id received the focus.");
        return;    // This is necessary to avoid unexpected behavior
    }
    switch($id) {
        case ID_ITEMLIST:
            if($param == WBC_DBLCLICK)
                process_main($window, ID_EDITITEM, 0);
            else
                update_controls($window);
            break;
        // Additional processing here
    }
}


Minimizing a window to the TaskBar status area

To create a window that minimizes itself as an icon in the TaskBar status area, include the WBC_TASKBAR style flag in the style parameter. All operations will be handled automatically.

Example

$mainwin = wb_create_window(NULL, 100, "Collapsible window", WBC_CENTER, WBC_CENTER, 320, 240, WBC_INVISIBLE | WBC_TASKBAR);
// Create window controls
wb_set_visible($mainwin, true);    // Make window visible

See also

wb_destroy_window
wb_create_control
wb_set_handler
Window style flags
Window functions
Window classes
Callback functions and window handlers