## IupGLCanvasBox (since 3.11)

Creates an OpenGL canvas container. It inherits from IupGLCanvas.

This is an additional control that depends on the OpenGL library. It is included in the IupGLControls library.

To use the controls available in the IupGLControls library inside your OpenGL canvas you must replace the IupGLCanvas by the IupGLCanvasBox element.

It can have any number of children. Controls from the IupGLControls library can be used as children along with the void containers such as IupHbox, IupVbox, and so on, including IupFill. Native elements can also be placed on top although they will not be clipped by IupGLFrame and other IupGlControls containers.

The elements that are a direct child of the box can be positioned using the VERTICALALIGN and/or HORIZONTALALIGN attributes, or using a position in pixels relative to the top-left corner of the box by setting the attribute POSITION.

Each direct children will be sized to its natural size by default, except if EXPANDHORIZONTAL or EXPANDVERTICAL are set.

The box can be created with no elements and be dynamic filled using IupAppend or IupInsert.

### Creation

    Ihandle* IupGLCanvasBox(Ihandle *child, ...); [in C]
    Ihandle* IupGLCanvasBoxV(Ihandle* child, va_list arglist); [in C]
    Ihandle* IupGLCanvasBoxv(Ihandle **children); [in C]
    iup.glcanvasbox{child, ...: ihandle} -> (elem: ihandle) [in Lua]
    glcanvasbox(child, ...) [in LED]

child, ... : List of the identifiers that will be placed in the box. NULL must be used to define the end of the list in C. It can be empty, but in C must have at least the NULL terminator..

Returns: the identifier of the created element, or NULL if an error occurs.

### Attributes

The IupGLCanvasBox element handle all attributes defined for an OpenGL canvas and a conventional canvas, see IupGLCanvas and IupCanvas.

MARGIN (non inheritable): Defines a margin in pixels. Its value has the format "widthxheight", where width and height are integer values corresponding to the horizontal and vertical margins, respectively. Default: "0x0" (no margin).

REDRAW (non inheritable, write-only): force a full redraw of all elements and the main canvas.

CLIENTSIZE, CLIENTOFFSET: also accepted.

### Attributes (at Children)

HORIZONTALALIGN (non inheritable) (at children only): Horizontally aligns the element inside the box. Possible values: "ALEFT", "ACENTER", "ARIGHT" or "FLOAT". Default: "FLOAT". When FLOAT is used its horizontal position is obtained from the POSITION attribute.

VERTICALALIGN (non inheritable) (at children only): Vertically aligns the element inside the box. Possible values: "ATOP", "ACENTER", "ABOTTOM" or "FLOAT". Default: "FLOAT". When FLOAT is used its vertical position is obtained from the POSITION attribute.

EXPANDHORIZONTAL (non inheritable) (at children only): Expand the horizontal size of the element to the box width. Works only if EXPAND=Yes or HORIZONTAL. Can be Yes or No. Default: No. (since 3.13)

EXPANDVERTICAL (non inheritable) (at children only): Expand the vertical size of the element to the box height. Works only if EXPAND=Yes or VERTICAL. Can be Yes or No. Default: No. (since 3.13)

### Callbacks

The IupGLCanvasBox element understands all callbacks defined for the IupGLCanvas.

But since it has to forward the mouse and action callbacks to the IupGLControls elements when it is mapped the callbacks ACTION, BUTTON_CB, MOTION_CB, WHEEL_CB, and LEAVEWINDOW_CB are replaced by internal callbacks. The application callbacks will still be called and they can be retrieved by using the prefix "APP_" on the callback name. If for some reason the application set one of these callbacks after being mapped, the box internal callback can be retrieved by using the prefix "GLBOX_" on the callback name.

Keyboard focus is NOT processed for IupGLCanvasBox children.

The IupGLCanvas SWAPBUFFERS_CB callback is used internally to enable a correct display for the box children. This means that when the application calls IupGLSwapBuffers, then children will be drawn before actually swapping the double buffer.

### Examples

Browse for Example Files

### See Also

IupGLCanvas, IupCanvas