IupTree Callbacks

SELECTION_CB: Action generated when a node is selected or deselected. This action occurs when the user clicks with the mouse or uses the keyboard with the appropriate combination of keys. It may be called more than once for the same node with the same status.

int function(Ihandle *ih, int id, int status) [in C]
ih:selection_cb(id, status: number) -> (ret: number) [in Lua]

ih: identifier of the element that activated the event.
id: Node identifier.
status: 1=node selected, 0=node unselected.

MULTISELECTION_CB: Action generated after a continuous range of nodes is selected in one single operation. If not defined the SELECTION_CB with status=1 will be called for all nodes in the range. The range is always completely included, independent if some nodes were already marked. That single operation also guaranties that all other nodes outside the range are already not selected. Called only if MARKMODE=MULTIPLE.

int function(Ihandle *ih, int* ids, int n) [in C]
ih:multiselection_cb(ids: table, n: number) -> (ret: number) [in Lua]

ih: identifier of the element that activated the event.
ids: Array of node identifiers. This array is kept for backward compatibility, the range is simply defined by ids[0] to ids[n-1], where ids[i+1]=ids[i]+1.
n: Number of nodes in the array.

MULTIUNSELECTION_CB: Action generated before multiple nodes are unselected in one single operation. If not defined the SELECTION_CB with status=0 will be called for all nodes in the range. The range is not necessarily continuous. Called only if MARKMODE=MULTIPLE. (Since 3.1)

int function(Ihandle *ih, int* ids, int n) [in C]
ih:multiunselection_cb(ids: table, n: number) -> (ret: number) [in Lua]

ih: identifier of the element that activated the event.
ids: Array of node identifiers.
n: Number of nodes in the array.


BRANCHOPEN_CB: Action generated when a branch is expanded. This action occurs when the user clicks the "+" sign on the left of the branch, or when double clicks the branch, or hits Enter on a collapsed branch.

int function(Ihandle *ih, int id) [in C] 
ih:branchopen_cb(id: number) -> (ret: number) [in Lua]

ih: identifier of the element that activated the event.
id: node identifier.

Returns: IUP_IGNORE for the branch not to be opened, or IUP_DEFAULT for the branch to be opened.

BRANCHCLOSE_CB: Action generated when a branch is collapsed. This action occurs when the user clicks the "-" sign on the left of the branch, or when double clicks the branch, or hits Enter on an expanded branch.

int function(Ihandle *ih, int id); [in C]
ih:branchclose_cb(id: number) -> (ret: number) [in Lua]

ih: identifier of the element that activated the event.
id: node identifier.

Returns: IUP_IGNORE for the branch not to be closed, or IUP_DEFAULT for the branch to be closed.

EXECUTELEAF_CB: Action generated when a leaf is to be executed. This action occurs when the user double clicks a leaf, or hits Enter on a leaf.

int function(Ihandle *ih, int id); [in C] 
ih:executeleaf_cb(id: number) -> (ret: number) [in Lua]

ih: identifier of the element that activated the event.
id: node identifier. 


SHOWRENAME_CB: Action generated when a node is about to be renamed. It occurs when the user clicks twice the node or press F2. Called only if SHOWRENAME=YES.

int function(Ihandle *ih, int id); [in C]
elem:showrename_cb(id: number: string) -> (ret: number) [in Lua]

ih: identifier of the element that activated the event.
id: node identifier. 

Returns: if IUP_IGNORE is returned, the rename is canceled (in GTK the rename continuous but the edit box is read-only).

RENAME_CB: Action generated after a node was renamed in place. It occurs when the user press Enter after editing the name, or when the text box looses it focus. Called only if SHOWRENAME=YES.

int function(Ihandle *ih, int id, char *title); [in C]
elem:rename_cb(id: number, title: string) -> (ret: number) [in Lua]

ih: identifier of the element that activated the event.
id: node identifier.
title: new node title.

Returns: The new title is accepted only if the callback returns IUP_DEFAULT. If the callback does not exists the new title is always accepted. If the user pressed Enter and the callback returns IUP_IGNORE the editing continues. If the text box looses its focus the editing stops always.


DRAGDROP_CB: Action generated when an internal drag & drop is executed. Only active if SHOWDRAGDROP=YES.

int function(Ihandle *ih, int drag_id, int drop_id, int isshift, int iscontrol); [in C] 
ih:dragdrop_cb(drag_id, drop_id, isshift, iscontrol: number) -> (ret: number) [in Lua]

ih: identifier of the element that activated the event.
drag_id: Identifier of the clicked node where the drag start.
drop_id: Identifier of the clicked node where the drop were executed. -1 indicates a drop in a blank area.
isshift: flag indicating the shift key state.
iscontrol: flag indicating the control key state.

Returns: if returns IUP_CONTINUE, or if the callback is not defined and SHOWDRAGDROP=YES, then the node is moved to the new position. If Ctrl is pressed then the node is copied instead of moved. If the drop node is a branch and it is expanded, then the drag node is inserted as the first child of the node. If the branch is not expanded or the node is a leaf, then the drag node is inserted as the next brother of the drop node.

NODEREMOVED_CB: Action generated when a node is going to be removed. It is only a notification, the action can not be aborted. No node dependent attribute can be consulted during the callback. Not called when the tree is unmapped. It is useful to remove memory allocated for the userdata. (since 3.0)

int function(Ihandle *ih, void* userdata); [in C] 
ih:noderemoved_cb(userid: userdata/table) -> (ret: number) [in Lua]

ih: identifier of the element that activated the event.
userdata/userid: USERDATA attribute in C, or userid object in Lua.

RIGHTCLICK_CB: Action generated when the right mouse button is pressed over a node.

int function(Ihandle *ih, int id); [in C] 
ih:rightclick_cb(id: number) -> (ret: number) [in Lua]

ih: identifier of the element that activated the event.
id: node identifier.


TOGGLEVALUE_CB: Action generated when the toggle's state was changed. The callback also receives the new toggle's state. (since 3.6)

int function(Ihandle *ih, int id, int state); [in C]
elem:togglevalue_cb(id, state: number: string) -> (ret: number) [in Lua]

ih: identifier of the element that activated the event.
id: node identifier.
state: 1 if the toggle's state was shifted to ON; 0 if it was shifted to OFF. If SHOW3STATE=YES, −1 if it was shifted to NOTDEF.


BUTTON_CB: Action generated when any mouse button is pressed or released inside the element. Use IupConvertXYToPos to convert (x,y) coordinates in the node identifier. (since 3.0)

MOTION_CB: Action generated when the mouse is moved over the element. Use IupConvertXYToPos to convert (x,y) coordinates in item the node identifier. (since 3.0)

DROPFILES_CB [Windows and GTK Only]: Action generated when one or more files are dropped in the element. (since 3.0)


MAP_CB, UNMAP_CB, DESTROY_CB, GETFOCUS_CB, KILLFOCUS_CB, ENTERWINDOW_CB, LEAVEWINDOW_CB, K_ANY, HELP_CB: All common callbacks are supported.

In Motif the tree always resets the focus to the first node when receive the focus. The KILLFOCUS_CB callback is called only when the focus is at the first node. Also in Motif some LEAVEWINDOW_CB events are delayed to when the user enter again, firing a leave and enter events at enter time.

Drag & Drop callbacks are supported, but SHOWDRAGDROP must be set to NO.