Up

_OBJsetCBfromOld

Change the current callback by a new one.
Same thing for the user parameter.

Prototype :

fun [u0 u1 u1 u2 I] I

Return : I 0. It returns nil if error.

Error :

See also :

Example :

typeof win = ObjWin;;

fun cb_destroy2 (o, u)=
	_fooId u*2;;	// Console : 22
	
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; // or _CBwinDestroy win @cb_destroy 7;
	// ...
	_fooId _OBJsetCBfromOld win @cb_destroy @cb_destroy2 11 0;
	// ...
	0;;

Note :

This functions sets only the first occurence found

For be safer, the old and the new callback must have the same prototype. Else, the VM will crash. In the future, we may authorize another prototype. In this case, this will have no effect on the previous Scol written source code.

Thus, the old and new user parameters must have the same type. In the future, this behavior could be modified by us. If any, it will be no effect for existing source code.

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.

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