<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../style.css">
<title>
Gambas Documentation - Event Loop
</title>
</head>
<table class="none" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr><td align="left">
<font size="-1">
<a href="../../help+en"><img class="flag" alt="Home" border="0" src="../../img/lang/en.png" align="center"></a>&nbsp;
<a href="../cat+en">Up</a>&nbsp;
<a href="eventdecl+en">Previous</a>&nbsp;
<a href="exp+en">Next</a>&nbsp;
</td></tr></table>
<div class="notab">
<h1>
Event Loop
</h1>
When a <a href="../def/gambas+en">Gambas</a> program has finished executing its <tt>Main()</tt> start function,
it enters the so-called <i>event loop</i>.
<p>
The program will loop then while:
<ul>
<li>There is a <a href="../comp/gb/process+en">Process</a> that runs.
<li>There is a <a href="../comp/gb/timer+en">Timer</a> that is enabled.
<li>There is a <a href="../comp/gb/file+en">File</a> that is watched.
<li>There is a <a href="../comp/gb.qt/window+en">Window</a> that is opened.
<p>
</ul>

During this loop, it will process any events raised by any object, and
for each event, it will call the corresponding <i>/def/eventhandler</i>.
<p>
You can call recursively the event loop by using the <a href="../lang/wait+en">WAIT</a> instruction.
This may lead to infinite recursion, but this is the only way to refresh
the user interface while doing a long processing.
<p>
<hr><b>See also</b><br>
<a href="../lang/wait+en">WAIT</a>&nbsp; <a href="../lang/quit+en">QUIT</a>&nbsp;

</div>
</body>
</html>

