IupTree Callbacks

SELECTION_CB: Action generated when an element is selected or deselected. This action occurs when the user clicks with the mouse or uses the keyboard with the appropriate combination of keys.

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

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

MULTISELECTION_CB: Action generated when multiple nodes are selected during the same operation (when mouse is clicked and Shift is pressed, or when a navigation key is released and shift is pressed). If not defined the SELECTION_CB will be called for all selected nodes everytime a new node is selected. The block of nodes is always completely included, independent if some node were already marked.

int function(Ihandle *ih, int* ids, int n) [in C]
elem:multiselection_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] 
elem: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]
elem: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] 
elem: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. 

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 a 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] 
elem: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.
isshift: Boolean flag indicatinf the shift key state.
iscontrol: Boolean flag indicatinf 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 drop node is a leaf, then it is inserted as the next brother of the leaf.

NODEREMOVED_CB: Action generated when a node is going to be removed. It is only a notification, the action can not be aborted. (since 3.0)

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

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

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

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

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


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, 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 root node when receive the focus. The KILLFOCUS_CB callback is called only when the focus is at the root 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.