<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Le 07/09/2019 à 13:32, Samuel Gougeon a
écrit :<br>
</div>
<blockquote type="cite"
cite="mid:8e3816d7-442a-bf1d-6e3f-1345cc38081e@free.fr">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<p>Hello,</p>
<p>While i was<a moz-do-not-send="true"
href="http://bugzilla.scilab.org/16008"> updating the
uimenu_properties page</a>, noticeably to document
.callback_type,<br>
i noticed that one of the Figures submenu has a .callback_type
set to -2 (see below).<br>
I have found nothing in the uicontrol doc about the meaning of
this value.<br>
<br>
Would you know what it is, to interpret .callback?<br>
<br>
Thanks<br>
Samuel<br>
</p>
<p><font size="-1" face="Arial" color="#999999"><font
color="#000000">--> get(0).showhiddenhandles = "on";<br>
--> gcf().children(4).children(1)<br>
</font> ans =<br>
<br>
Handle of type "uimenu" with properties:<br>
========================================<br>
Parent: uimenu<br>
Children: []<br>
Enable = "on"<br>
Foregroundcolor = [0,0,0]<br>
Label = "&Rotation 2D/3D"<br>
Handle_Visible = "off"<br>
Visible = "on"<br>
<font color="#000000">Callback =
"set(get_figure_handle([SCILAB_FIGURE_ID]),
''info_message'', ''Right click and drag to rotate.'')"<br>
Callback_Type = </font></font><font face="Arial"
color="#999999"><font color="#000000"><font color="#cc0000"><b>-</b></font></font></font><font
size="-1" face="Arial" color="#999999"><font color="#000000"><font
color="#cc0000">2</font><br>
</font>Checked = "off"<br>
Icon = "transform-rotate"<br>
Userdata = []<br>
Tag = ""</font><br>
</p>
</blockquote>
<p>Le 16/09/2019 à 19:39, <a class="moz-txt-link-abbreviated" href="mailto:tom.kreisel@*.de">tom.kreisel@*.de</a> a écrit :<br>
> Hi Samuel,<br>
><br>
> I was also struggling with callback_type so I can maybe give
some hints from a programmers perspective.<br>
> Since I am new to Scilab I played around with the master
build and the xcos debug gui, which was not working until I added
the callback_type property 10 to the source code.<br>
> I found in the code:<br>
> /**<br>
> * Abstract class to manage all callbacks.<br>
> *<br>
> * @author Bruno JOFRET<br>
> */<br>
> public class CallBack {<br>
><br>
> /**<br>
> * Unmanaged command type constant<br>
> */<br>
> public static final int UNTYPED = -1;<br>
> /**<br>
> * Scilab instruction command type constant<br>
> */<br>
> public static final int SCILAB_INSTRUCTION = 0;<br>
> public static final int
SCILAB_NOT_INTERRUPTIBLE_INSTRUCTION = 10;<br>
> /**<br>
> * C or Fortran function type constant<br>
> */<br>
> public static final int C_FORTRAN = 1;<br>
> /**<br>
> * Scilab function type constant<br>
> */<br>
> public static final int SCILAB_FUNCTION = 2;<br>
> public static final int SCILAB_NOT_INTERRUPTIBLE_FUNCTION
= 12;<br>
> /**<br>
> * Scilab function type constant (not trapped by scilab
event listeners)<br>
> */<br>
> public static final int
SCILAB_OUT_OF_XCLICK_AND_XGETMOUSE = -2;<br>
> /**<br>
> * Java function type constant<br>
> */<br>
> public static final int JAVA = 3;<br>
> /**<br>
> * Java function type constant (not trapped by scilab
event listeners)<br>
> */<br>
> public static final int JAVA_OUT_OF_XCLICK_AND_XGETMOUSE
= -3;<br>
><br>
> /**<br>
> * Scilab instruction without GCBO setting (used in case
of pause/resume/abort)<br>
> */<br>
> public static final int SCILAB_INSTRUCTION_WITHOUT_GCBO =
4;<br>
><br>
> [...]<br>
><br>
> so -2 means SCILAB_OUT_OF_XCLICK_AND_XGETMOUSE:<br>
><br>
> If this type is used, the actionPerformed method of the
ScilabCallbackClass is overriden to just call the callback:<br>
> /**<br>
> * Callback Factory to easily create a callback<br>
> * just like in scilab.<br>
> * WARNING : this callback will be ignored by xclick
& xgetmouse<br>
> * @param command : the command to execute.<br>
> * @return a usable Scilab callback<br>
> */<br>
> public static ScilabCallBack
createOutOfXclickAndXgetmouse(String command) {<br>
> return (new ScilabCallBack(command) {<br>
><br>
> private static final long serialVersionUID =
-7286803341046313407L;<br>
><br>
> public void callBack() {<br>
> Thread launchMe = new Thread() {<br>
> public void run() {<br>
>
InterpreterManagement.putCommandInScilabQueue(getCommand());<br>
> }<br>
> };<br>
> launchMe.start();<br>
> }<br>
><br>
> /**<br>
> * To match the standard Java Action management.<br>
> * @see
java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)<br>
> * @param e The event that launch the callback.<br>
> */<br>
> public void actionPerformed(ActionEvent e) {<br>
> callBack();<br>
> }<br>
> });<br>
> }<br>
><br>
> The usual implementation uses a GlobalEventWatcher, I guess
this implements the xclick and xgetmouse features.<br>
><br>
> /**<br>
> * To match the standard Java Action management.<br>
> * @see
java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)<br>
> * @param e The event that launch the callback.<br>
> */<br>
> public void actionPerformed(ActionEvent e) {<br>
> if (!GlobalEventWatcher.isCatchingCallback()) {<br>
> callBack();<br>
> } else {<br>
> if (this.callback.getCommand() != null) {<br>
>
GlobalEventFilter.filterCallback(this.callback.getCommand());<br>
> }<br>
> }<br>
> }<br>
><br>
> so if you use -2 as type, xclick and xgetmouse listener will
not be informed of your mouseclick.<br>
><br>
> there are also other integers not mentioned in the docu.<br>
><br>
> Would have liked to post this into the list, but currently
the server rejects my email address...<br>
><br>
> Hope this might be useful..<br>
><br>
> KR Thomas<br>
<br>
</p>
</body>
</html>