Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > bd5c3d824c3db63ffd9226c15941e6ad > files > 2342

mozart-1.4.0-1mdv2010.0.i586.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>3.4 The Widget Hierarchy</TITLE><LINK href="ozdoc.css" rel="stylesheet" type="text/css"></HEAD><BODY><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node9.html#section.widgets-1.frame">&lt;&lt; Prev</A></TD><TD><A href="node6.html">- Up -</A></TD><TD><A href="node11.html#section.widgets-1.label">Next &gt;&gt;</A></TD></TR></TABLE><DIV id="section.widgets-1.hierarchy"><H2><A name="section.widgets-1.hierarchy">3.4 The Widget Hierarchy</A></H2><DIV class="apropos"><P class="margin">masters and slaves</P><P> Widgets are arranged in a hierarchy. Each widget has a single <A name="label96"></A><EM>parent</EM>. The only exceptions can be toplevel widget objects, which do not have to have a parent. The parent of a widget is given by the option <CODE>parent</CODE> in the <CODE>tkInit</CODE> message. Usually parent widgets are containers. To the parent of a widget we also refer to as its <A name="label97"></A><EM>master</EM>. To the widget itself we refer to as <A name="label98"></A><EM>slave</EM> of its master. </P></DIV><P> For example, in the previous example shown in <A href="node9.html#figure.widgets-1.relief-frames">Figure&nbsp;3.2</A> the five frame widgets are slaves of the single toplevel widget. </P><P> The purpose of the hierarchy is threefold: </P><OL type="1"><LI><P>The geometry for widgets is computed according to the hierarchy. This is discussed in <A href="node14.html#chapter.geometry">Chapter&nbsp;4</A>. </P></LI><LI><P>Creation and initialization has to follow the hierarchy. To initialize a widget object it is necessary that its parent widget object is already created and initialized. Otherwise initialization of a slave blocks until its master is initialized. </P></LI><LI><P>Closing a parent widget object also closes all its slaves. The slaves are closed by applying them to the <CODE>tkClose</CODE> message. A widget object gets closed and its widget gets destroyed only after all of its slaves have been closed. </P></LI></OL><P> </P><P> After a widget object has been closed, using it in tickles sent directly to the graphics engine, e.&nbsp;g. by <CODE>Tk<SPAN class="keyword">.</SPAN>send</CODE> or <CODE>Tk<SPAN class="keyword">.</SPAN>batch</CODE>, issues a runtime error. </P></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node9.html#section.widgets-1.frame">&lt;&lt; Prev</A></TD><TD><A href="node6.html">- Up -</A></TD><TD><A href="node11.html#section.widgets-1.label">Next &gt;&gt;</A></TD></TR></TABLE><HR><ADDRESS><A href="http://www.ps.uni-sb.de/~schulte/">Christian&nbsp;Schulte</A><BR><SPAN class="version">Version 1.4.0 (20090610)</SPAN></ADDRESS></BODY></HTML>