⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 131.html

📁 Tcl 语言的入门级图书
💻 HTML
字号:
<HTML><TITLE>Geometry Management: The <TT>pack</TT> and <TT>grid</TT> Action Families</TITLE><BODY BGCOLOR="#FFF0E0" VLINK="#0FBD0F" TEXT="#101000" LINK="#0F0FDD">
<A NAME="top"><H1>The <TT>pack</TT> and <TT>grid</TT> Action Families</H1></A>


<P>  The <TT><NAME=#Cpack>pack</A></TT> and <TT><NAME=#Cgrid>grid</A></TT> action families are quite
similar in the actions they offer.  In the following table, <CITE>manager</CITE>
can be either <TT>pack</TT> or <TT>grid</TT>.  Also, <CITE>WIDGET_NAMES</CITE>
represents a sequence of one or more arguments and not a list.

<P><CENTER><TABLE BORDER><TR><TD><DL>

<P> <DT><STRONG><PRE><CITE>manager</CITE> configure <CITE>WIDGET_NAMES ?OPTIONS?</CITE></PRE></STRONG><DD>
This action <CITE>initiates or reconfigures</CITE> geometry management for a
particular master and slave.  In normal usage the action name <TT>configure</TT>
is omitted and this command looks like

<PRE>
<CITE>manager WIDGET_NAMES ?OPTIONS?</CITE>
</PRE>

<P> In other words, executing <TT>pack</TT> or <TT>grid</TT> without a specified action
will cause the <TT>configure</TT> action to be chosen.

<P> For how to use this action with <TT>pack</TT>, see below in 
<A HREF="13.2.html" tppabs="http://www.mapfree.com/sbf/tcl/book/select/Html/13.2.html">Slicing</A>,

<A HREF="13.3.html" tppabs="http://www.mapfree.com/sbf/tcl/book/select/Html/13.3.html">Slicing for Size Changes</A>, and 
<A HREF="13.6.html" tppabs="http://www.mapfree.com/sbf/tcl/book/select/Html/13.6.html">The Cavity</A>.

<P> For how to use this action with <TT>grid</TT>, see below in 
<A HREF="13.5.html" tppabs="http://www.mapfree.com/sbf/tcl/book/select/Html/13.5.html">An Array of Cells</A>.

<P> For options that <TT>pack</TT> and <TT>grid</TT> have in common see below in

<A HREF="13.4.html" tppabs="http://www.mapfree.com/sbf/tcl/book/select/Html/13.4.html">Padding</A>.  For options that are not in common but have a similar
purpose, see 
<A HREF="13.7.html" tppabs="http://www.mapfree.com/sbf/tcl/book/select/Html/13.7.html">Placing Widgets more Carefully</A>.

<P> <DT><STRONG><PRE><CITE>manager</CITE> forget <CITE>WIDGET_NAMES</CITE></PRE></STRONG><DD> Terminates <CITE>manager</CITE>'s
geometry management of all the widgets whose names are listed.  If a widget
exists but is not under geometry management by <CITE>manager</CITE>, that is OK &#150; nothing happens.  Note that this command does not destroy widgets but
that destroying a widget also takes it out of geometry management.

<P> <DT><STRONG><PRE><CITE>manager</CITE> info <CITE>WIDGET_NAME</CITE></PRE></STRONG><DD> Returns information about how the
geometry manager is managing the named widget.  Use this when it is known
that <CITE>WIDGET_NAME</CITE> is a widget that is under geometry management by 
<CITE>manager</CITE>.  Behavior in other circumstances varies a bit between <TT>pack</TT> and
<TT>grid</TT>.

<P> <DT><STRONG><PRE><CITE>manager</CITE> propagate <CITE>WIDGET_NAME BOOLEAN</CITE></PRE></STRONG><DD> Normally, a master's
size is adjusted to what is needed by its slaves.  If you want a master to
ignore the needs of its slave, execute this action with false.
<P>  A use for <TT>pack propagate</TT> is given in 
<A HREF="13.8.html" tppabs="http://www.mapfree.com/sbf/tcl/book/select/Html/13.8.html"><CITE>Tricks for Using Pack</CITE></A>.

<P> <DT><STRONG><PRE><CITE>manager</CITE> slaves <CITE>WIDGET_NAME</CITE></PRE></STRONG><DD> Returns a list of the designated
widget's slaves.  Of course, this list may be empty.  Use for known
widgets.  If the widget is not a master of any slaves under <CITE>manager</CITE>,
the empty list will be returned.
<P>  The elements of this list are under geometry management by <CITE>manager</CITE>.
The named widget may not be.

</DL></TD></TR></TABLE></CENTER></P>

<P>  <P><A NAME="13.1a">
<STRONG>Exercise 13.1a</STRONG> </A><DL><DD>
  Finish implementing this procedure,

<PRE>
proc forgetGeometry Master { <CITE>...</CITE> }
</PRE>

so that all widgets that are (direct or indirect) slaves of <TT>Master</TT> are
removed from geometry management.  Geometry management here includes widgets
managed by <TT>pack</TT> or <TT>grid</TT>.

<P>  This is a paper and pencil exercise as it will be kind of hard to test
<TT>forgetGeometry</TT> until you know how to configure geometry management under
both <TT>pack</TT> and <TT>grid</TT>.  
<P>
<A HREF="13.9.html#Sol13.1a" tppabs="http://www.mapfree.com/sbf/tcl/book/select/Html/13.9.html#Sol13.1a">Solution</A></DL>


<!-- Linkbar -->
<P><CENTER><FONT SIZE=2><NOBR>
<STRONG>From</STRONG>
<A HREF="javascript:if(confirm('http://www.mapfree.com/sbf/tcl/book/home.html  \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?'))window.location='http://www.mapfree.com/sbf/tcl/book/home.html'" tppabs="http://www.mapfree.com/sbf/tcl/book/home.html">Tcl/Tk For Programmers</A><WBR>
<STRONG>Next</STRONG>
<A HREF="13.2.html" tppabs="http://www.mapfree.com/sbf/tcl/book/select/Html/13.2.html">section</A><WBR>
<STRONG>All</STRONG>
<A HREF="13.html" tppabs="http://www.mapfree.com/sbf/tcl/book/select/Html/13.html">sections</A><WBR>
<STRONG>Author</STRONG>
<A HREF="javascript:if(confirm('http://www.mapfree.com/mp/jaz/home.html  \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?'))window.location='http://www.mapfree.com/mp/jaz/home.html'" tppabs="http://www.mapfree.com/mp/jaz/home.html">J. A. Zimmer</A><WBR>
<STRONG>Copyright</STRONG>
<A HREF="copyright.html" tppabs="http://www.mapfree.com/sbf/tcl/book/select/Html/copyright.html">Notice</A><WBR>
<P>
<I>Jun 17, 1998</I>
 </NOBR></FONT></CENTER></BODY></HTML>


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -