Up |
Change the current callback used to any event by a new one.
Same thing for the user parameter.
Thus, all the events (for one object) which set a same callback will be changed.
fun [u0 u1 u1 u2 I] I
Return : I 0. It returns nil if error.
Error :
typeof win = ObjWin;;
fun cb_common2 (o, u)=
_fooId u*2;;
fun cb_common (o, u)=
_fooId u;;
fun main ()=
_showconsole;
// ...
set win = _CRwindow _channel nil 200 250 400 500 WN_NORMAL "A";
_fooId _OBJsetCB win 7 @cb_common 7 0; // or _CBwinDestroy win @cb_destroy 7;
_CBwinKillFocus win @cb_common 5;
// ...
// KillFocus and Destroy events are changed, the user parameter is unchanged (flag is set to 1)
_fooId _OBJsetCBfromOldAll win @cb_common @cb_common2 11 1;
// ...
0;;
This functions sets all occurences 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). _OBJsetCBfromOldAll is another way to set multiple CB or what he/she wants !