[Scilab-users] Recognition of cursor key as input

Jens j.s.strom at hslmg.de
Wed Aug 13 13:05:06 CEST 2014


Hello,
My event_handler experiments with the Scilab help example in "Event 
handler functions" (see below) led to nothing.  I can see the "event" at 
the bottom of the graphic window but I cannot arrest it in a variable. I 
tried this:

function  my_eventhandler(win,x,y,ibut)
   if  ibut==-1000  then  return,end
   [x,y]=xchange  <xchange.html>(x,y,'i2f')
   xinfo  <xinfo.html>(msprintf  <msprintf.html>('Event code %d at mouse position is (%f,%f)',ibut,x,y))
endfunction

plot2d  <plot2d.html>()
fig  =  gcf  <gcf.html>()  ;
fig.event_handler  =  'my_eventhandler'  ;
fig.event_handler_enable  =  "on"  ;
//now:
//   -  move the mouse over the graphic window
//   -  press and release keys shifted or not with Ctrl pressed or not
//   -  press button, wait a little release
//   -  press and release button
//   -  double-click button

fig.event_handler_enable  =  "off"  ;  //suppress the event handler

	<scilab://scilab.execexample/> 	<scilab://scilab.editexample/>


I fear I must retire to

m=evstr(x_dialog(...)

Jens
----------------------------------------------------------------------------

Am 13.08.2014 11:12, schrieb mottelet [via Scilab / Xcos - Mailing Lists 
Archives]:
>
> Hello,
>
> IMHO, the only way to trap a keypress and get the ascii (?) code is to 
> use the event_handler callback of a figure :
>
> function handler(x,y,ibut)
> //
> endfunction
>
> f=gcf();
> f.event_handler='handler';
> f.event_handle_enable='on';
>
> On my computer, I have the following mapping
>
> left arrow pressed : ibut=37 (released=-37)
> up arrow : 38
> right arrow 39
> down arrow 40
>
> The problem is that you need to have a figure opened, and that this 
> figure must have the focus.
>
> S.
>
> Jens <[hidden email] </user/SendEmail.jtp?type=node&node=4031030&i=0>> 
> a écrit :
>
>> Hi Samuel,
>> ASCII representation of up, down etc. would help me if I knew a Scilab
>> command which puts the ascii value into a variable. input() is definitely
>> unable to do so.
>>
>> Jens
>>
>>
>>
>>
>> --
>> View this message in context: 
>> http://mailinglists.scilab.org/Scilab-users-Recognition-of-cursor-key-as-input-tp4031013p4031026.html
>> Sent from the Scilab users - Mailing Lists Archives mailing list 
>> archive at Nabble.com.
>> _______________________________________________
>> users mailing list
>> [hidden email] </user/SendEmail.jtp?type=node&node=4031030&i=1>.<a 
>> href="orghttp://lists.scilab.org/mailman/listinfo/users" 
>> target="_blank">orghttp://lists.scilab.org/mailman/listinfo/users
>>
>
>
>
> _______________________________________________
> users mailing list
> [hidden email] </user/SendEmail.jtp?type=node&node=4031030&i=2>
> http://lists.scilab.org/mailman/listinfo/users
>
>
> ------------------------------------------------------------------------
> If you reply to this email, your message will be added to the 
> discussion below:
> http://mailinglists.scilab.org/Scilab-users-Recognition-of-cursor-key-as-input-tp4031013p4031030.html 
>
> To unsubscribe from [Scilab-users] Recognition of cursor key as input, 
> click here 
> <http://mailinglists.scilab.org/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4031013&code=ai5zLnN0cm9tQGhzbG1nLmRlfDQwMzEwMTN8LTIyMzcxNjc3Ng==>.
> NAML 
> <http://mailinglists.scilab.org/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> 
>





--
View this message in context: http://mailinglists.scilab.org/Scilab-users-Recognition-of-cursor-key-as-input-tp4031013p4031031.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20140813/cc9558d5/attachment.htm>


More information about the users mailing list