| 1 |
<html><head><meta name="robots" content="index,follow"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 2 |
<title>demoWaitForInput</title> |
| 3 |
<style> |
| 4 |
td { padding-left: 5pt; padding-right: 5pt; } |
| 5 |
th { padding-left: 5pt; padding-right: 5pt; } |
| 6 |
code { white-space: pre-wrap; } |
| 7 |
dd { white-space: pre-wrap; } |
| 8 |
</style> |
| 9 |
</head><body bgcolor="#FFFFFF"> |
| 10 |
|
| 11 |
<table border=0 cellpadding=0 cellspacing=0><tr><td bgcolor="#CCCC00"><table border=4 cellpadding=9><tr><td align=middle bgcolor="#000000"><font face="Monaco,Courier" size=6 color="#999900"><b> |
| 12 |
demoWaitForInput |
| 13 |
</b></font></table></table> |
| 14 |
<p>A function that can be used in <a href="Scripting.html">Scripting</a>.</p> |
| 15 |
<h2>Syntax and semantics</h2> |
| 16 |
<dl> |
| 17 |
<dt><b><code><font size=+1>demoWaitForInput</font></code></b> ( ) |
| 18 |
<dd>wait for a user event (click or key press) in the Demo window.</dd> |
| 19 |
</dl> |
| 20 |
<h2>Behaviour</h2> |
| 21 |
<p>This function blocks until the user clicks in the Demo window or types a key into the Demo window.</p> |
| 22 |
<h2>Return value</h2> |
| 23 |
<p>Once the function finally returns, it returns the value 1 (true). This makes it possible to use this function in a <code><font size=+1>while</font></code> loop:</p> |
| 24 |
<code> while <b><a href="_demoWaitForInput_.html">demoWaitForInput</a></b> ()<br></code> |
| 25 |
<code> if <a href="_demoClicked_.html">demoClicked</a> ())<br></code> |
| 26 |
<code> # handle the mouse click<br></code> |
| 27 |
<code> elsif <a href="_demoKeyPressed_.html">demoKeyPressed</a> ())<br></code> |
| 28 |
<code> # handle the key press<br></code> |
| 29 |
<code> endif<br></code> |
| 30 |
<code> endwhile<br></code> |
| 31 |
<h3>Links to this page</h3> |
| 32 |
<ul> |
| 33 |
<li><a href="_demoShow_.html"><code><font size=+1>demoShow</font></code></a> |
| 34 |
<li><a href="Demo_window.html">Demo window</a> |
| 35 |
<li><a href="Demo_window_2__Getting_user_input.html">Demo window 2. Getting user input</a> |
| 36 |
<li><a href="Demo_window_3__Getting_click_locations.html">Demo window 3. Getting click locations</a> |
| 37 |
<li><a href="Demo_window_5__Asynchronous_play.html">Demo window 5. Asynchronous play</a> |
| 38 |
<li><a href="Demo_window_6__Animation.html">Demo window 6. Animation</a> |
| 39 |
<li><a href="Functions.html">Functions</a> |
| 40 |
</ul> |
| 41 |
<hr> |
| 42 |
<address> |
| 43 |
<p>© Paul Boersma 2023</p> |
| 44 |
</address> |
| 45 |
</body> |
| 46 |
</html> |