<HTML
><HEAD
><TITLE
>Event-driven programming</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.44"><LINK
REL="HOME"
TITLE="Gnome Developers' Information"
HREF="book1.html"><LINK
REL="UP"
TITLE="Basic X concepts"
HREF="x-concepts-docs.html"><LINK
REL="PREVIOUS"
TITLE="Graphics contexts"
HREF="graphics-contexts.html"><LINK
REL="NEXT"
TITLE="LibGnorba Documentation"
HREF="libgnorba-docs.html"></HEAD
><BODY
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Gnome Developers' Information</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="graphics-contexts.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 10. Basic X concepts</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="libgnorba-docs.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="EVENT-DRIVEN-PROGRAMMING"
>Event-driven programming</A
></H1
><P
>	Programmers coming from a text console world may find GUI
	programming a bit strange at first.  In "traditional"
	programming, the program guides the user through several screens
	of prompts and options, and the program is always in control of
	what is going to happen next.
      </P
><P
>	In GUI-land, you mostly give up the control flow of your
	programs and let the system drive them for you.  It is the user
	who is in control now &#8212; every time the program is run, the
	user may choose a different way to work his way through the user
	interface.  Menu options may be invoked at any time, and windows
	may be opened and closed at will.
      </P
><P
>	GUI programming generally operates on an
	<I
CLASS="EMPHASIS"
>event-driven</I
> model.  This means that
	applications get events from the system or the user and must
	react to them.  This is different from the "traditional" model
	where the program tells the user what to do next at every step.
      </P
><P
>	Event-driven programs typically sit around in a loop waiting for
	events to come.  When an event is received, the program figures
	out what to do with it and proceeds accordingly.  An event could
	be "the user pressed a mouse button", or "a window moved", or
	even "you must terminate yourself".
      </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="graphics-contexts.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="book1.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="libgnorba-docs.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Graphics contexts</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="x-concepts-docs.html"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>LibGnorba Documentation</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>