Up

_OBJsetCB

Define the callback and the user parameter for a given object and for a number event.

Change the current callback by another one.

Prototype :

fun [u0 I u1 u2 I] I

Return : I 0. It returns nil if error.

Error :

See also :

Example :

typeof win = ObjWin;;

fun cb_destroy (o, u)=
	_fooId u;;	// Console : 7
	
fun main ()=
	_showconsole;
	// ...
	set win = _CRwindow _channel nil 200 250 400 500 WN_NORMAL "A";
	// ...
	_fooId _OBJsetCB win 7 @cb_destroy 7 0;
	// ...
	0;;

Note :

At this time, the type of the new callback is NOT checked. The developer should check it otherwise the VM can crash.

The old link and the old user parameter are lost. If any, you can store them before change by calling _OBJgetCB. This change is done immediately until another call, if any.

TO DO : at this time, it is not "user friendly" to obtain the event number : the user must look for it from the object source code. We add progressively this number in the callback documentation.

Of course, the developer should directly call the reflex definition function (for example _CBwinDestroy in the example above). _OBJsetCB is another way to set multiples CB or what he/she wants !