<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Hello,<br>
<br>
Le 25/06/2014 22:08, Fahrni Pascal (fahn) a écrit :<br>
</div>
<blockquote
cite="mid:83D0B391F6E5B6479C08794764094D743BC5D8E2@srv-mail-111.zhaw.ch"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.E-MailFormatvorlage17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal">Dear scilab users,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-AU">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?</span></p>
</div>
</blockquote>
This is an untested proposal: create a virtual figure and use its
event handler sensitive to on-the-flight keyboard events:<br>
* create a figure<br>
* set its .visible property to "off"<br>
* set properly its .event_handler and its event_handler_enable
properties<br>
* 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;<br>
<br>
HTH<br>
Samuel<br>
<br>
</body>
</html>