IupSetCallback

Associates a callback to an event.

Parameters/Return

Icallback IupSetCallback(Ihandle* ih, const char *name, Icallback func); [in C]
[There is no equivalent in Lua]

ih: identifier of the interface element.
name: name of the callback.
func: address of a C function. If NULL removes the association.

Returns: the address of the previous function associated to the action.

Notes

This function replaces the deprecated combination:

IupSetFunction(global_name, func);
IupSetAttribute(ih, name, global_name);

So it eliminates the need for a global name.

Callbacks set using IupSetCallback can not be retrieved using IupGetFunction.

In Lua, callbacks are associated by simply setting a function as the value of the callback name, for example:

button = iup.button{...

button.action = function(...    OR
function button:action(...

See Also

IupGetCallback, IupSetFunction