[Scilab-users] user terminate program (exit while loop)
Samuel Gougeon
sgougeon at free.fr
Wed Jun 25 23:01:05 CEST 2014
Hello,
Le 25/06/2014 22:08, Fahrni Pascal (fahn) a écrit :
>
> Dear scilab users,
>
> I'm using a scilab script to monitor a serial port, read from it and
> do some calculations based on that data. The program is wrapped by a
> while loop and contains an xpause statement. What is the best way to
> allow the user to terminate the program by user input?
>
This is an untested proposal: create a virtual figure and use its event
handler sensitive to on-the-flight keyboard events:
* create a figure
* set its .visible property to "off"
* set properly its .event_handler and its event_handler_enable properties
* in the event handler function: catch the code of the event; if it's a
keyboard event (or a specific one that you require from the user), issue
an abort instruction;
HTH
Samuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20140625/7d6ab04e/attachment.htm>
More information about the users
mailing list