IupDetachBox (since 3.10)

Creates a detachable void container.

Dragging and dropping this element, it creates a new dialog composed by its child or elements arranged in it (for example, a child like IupVbox or IupHbox). During the drag, the ESC key can be pressed to cancel the action.

It does not have a native representation, but it contains also a IupCanvas to implement the bar handler.

Creation

Ihandle* IupDetachBox(Ihandle* child); [in C]
iup.detachbox{child: ihandle} -> (ih: ihandle) [in Lua]
detachbox(child) [in LED]

child: Identifier of an interface element that will receive the box. It can be NULL (nil in Lua), or empty in LED.

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

Attributes

BARSIZE (non inheritable): controls the size of the bar handler. To completely hide the bar set BARSIZE to 0 (since 3.16). Default: 10.

COLOR: Changes the color of the bar grip affordance. The value should be given in "R G B" color style. Default: "160 160 160". When SHOWGRIP = NO, this attribute sets the background color of the bar handler.

EXPAND (non inheritable): The default value is "YES".

ORIENTATION (creation only) (non inheritable): Indicates the orientation of the bar handler. The direction of the resize is perpendicular to the orientation. Possible values are "VERTICAL" or "HORIZONTAL". Default: "VERTICAL".

OLDPARENT_HANDLE (read only): returns the previous parent of the detached element. Only valid after the element was detached.

OLDBROTHER_HANDLE (read only): returns the previous reference child of the detached element. Only valid after the element was detached. See IupReparent for a reference child definition.

DETACH (write-only): detach the box by creating a new dialog and placing the detachbox as the child of the new dialog. The DETACHED_CB callback is called, use it to configure the new dialog. The handler is hidden, the USERSIZE of the detachbox is set to the CURRENTSIZE of the child, and the PARENTDIALOG of the new dialog is set to old dialog. To re-parent the child we need to map the dialog before doing it, so to force a dialog resize its size is reset before its is shown, to control the dialog size use the child size. The new dialog is show at the current cursor position, and the USERSIZE of the detachbox is reset.

RESTORE (write-only): restore the box to its previous place (parent and brother) and destroys the new dialog. Value can be NULL or can be the name of a new parent when the control will be appended. Use IupSetHandle or IupSetAttributeHandle to associate an Ihandle* to a name (since 3.16). The handler is shown (if restored to inside a zbox, the application must update the zbox child visibility manually).

RESTOREWHENCLOSED: automatically restore the box to its original position when the new dialog is closed. Can be Yes or No. Default: No. (since 3.21)

SHOWGRIP (non inheritable): Shows the bar grip affordance. Default: YES. When set to NO, the BARSIZE is set to 5 (if greater than 5). To completely hide the bar set BARSIZE to 0 (since 3.16).

WID (read-only): returns -1 if mapped.


FONT, SIZE, RASTERSIZE, CLIENTSIZE, CLIENTOFFSET, POSITION, MINSIZE, MAXSIZE, THEME: also accepted.

Callbacks

DETACHED_CB: Callback called when the box is detached.

int function(Ihandle *ih, Ihandle *new_parent, int x, int y); [in C]
ih:detached_cb(new_parent: ihandle, x, y: number) -> (ret: number) [in Lua]

ih: identifier of the element that activated the event.
new_parent: identifier of the future parent of the box. At this point only the PARENTDIALOG attribute was set.
x, y: dropped position.

Returns: IUP_IGNORE will be processed, in order to cancel the detach action.

RESTORED_CB: Callback called when the box is restored if RESTOREWHENCLOSED=Yes. (since 3.21)

int function(Ihandle *ih, Ihandle *old_parent, int x, int y); [in C]
ih:restored_cb(old_parent: ihandle, x, y: number) -> (ret: number) [in Lua]

ih: identifier of the element that activated the event.
old_parent: identifier of the original parent of the box.
x, y: always 0,0.

Returns: IUP_IGNORE will be processed, in order to cancel the detach action.

Notes

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

Examples

Browse for Example Files


IupDetachBox (ORIENTATION = VERTICAL)

New dialog created after the detach action