📄 ch21_02.htm
字号:
<a name="INDEX-2756" />Returns information about the widget.</p></dd><dt><b><tt class="literal">placeSlaves</tt></b></dt><dd><a name="INDEX-2757" /><a name="INDEX-2758" /><a name="INDEX-2759" /><a name="INDEX-2760" /><a name="INDEX-2761" /><a name="INDEX-2762" />Returns a list of widgets managed bythe specified parent widget.</p></dd></dl></div><a name="perlnut2-CHP-21-SECT-2.4" /><div class="sect2"><h3 class="sect2">21.2.4. The form Geometry Manager</h3><p><a name="INDEX-2763" />The <tt class="literal">form</tt> geometrymanager arranges the geometry of children in the parent windowaccording to attachment rules. In addition, <tt class="literal">form</tt>can be used as a replacement for the existing Tk<tt class="literal">pack</tt> and <tt class="literal">place</tt> geometrymanagers. For example, to position a widget <tt class="literal">$top_w</tt>on top of <tt class="literal">$bot_w</tt>, you'd do this:</p><blockquote><pre class="code">$bot_w->form(-top=>[$topw_w, 0]);</pre></blockquote><p>Options to <tt class="literal">form</tt> are:</p><dl><dt><b><tt class="literal">-b =></tt> <em class="replaceable">attachment</em></b></dt><dd><a name="INDEX-2764" />Abbreviation for the<tt class="literal">-bottom</tt> option.</p></dd><dt><b><tt class="literal">-bottom =></tt> <em class="replaceable">attachment</em></b></dt><dd><a name="INDEX-2765" />Specifies an attachment for the bottomedge of the slave window.</p></dd><dt><b><tt class="literal">-bottomspring =></tt> <em class="replaceable">attachment</em></b></dt><dd><a name="INDEX-2766" />Specifies the weight of the spring atthe bottom edge of the slave window.</p></dd><dt><b><tt class="literal">-bp =></tt> <em class="replaceable">value</em></b></dt><dd><a name="INDEX-2767" />Abbrevation for the<tt class="literal">-padbottom</tt> option.</p></dd><dt><b><tt class="literal">-bs =></tt> <em class="replaceable">weight</em></b></dt><dd><a name="INDEX-2768" />Abbrevation for the<tt class="literal">-bottomspring</tt> option.</p></dd><dt><b><tt class="literal">-fill =></tt> <em class="replaceable">style</em></b></dt><dd><a name="INDEX-2769" />Specifies the fillings when springsare used for this widget. The value must be <tt class="literal">x</tt>,<tt class="literal">y</tt>, <tt class="literal">both</tt>, or<tt class="literal">none</tt>.</p></dd><dt><b><tt class="literal">-in =></tt> <tt class="literal">$master</tt></b></dt><dd><a name="INDEX-2770" />Places the slave window into thespecified <tt class="literal">$master</tt> window. If the slave wasoriginally in <tt class="literal">$another_master</tt>, all attachmentvalues with respect to <tt class="literal">$original_master</tt> arediscarded. The attachment values will need to be specified again. Ifyou use <tt class="literal">-in</tt>, it must be used first in the optionslist.</p></dd><dt><b><tt class="literal">-l =></tt> <em class="replaceable">attachment</em></b></dt><dd><a name="INDEX-2771" />Abbreviation for the<tt class="literal">-left</tt> option.</p></dd><dt><b><tt class="literal">-left =></tt> <em class="replaceable">attachment</em></b></dt><dd><a name="INDEX-2772" />Specifies an attachment for the leftedge of slave window, <tt class="literal">$slave</tt>.</p></dd><dt><b><tt class="literal">-leftspring =></tt> <em class="replaceable">weight</em></b></dt><dd><a name="INDEX-2773" />Specifies the weight of the spring atthe edge of the slave window, <tt class="literal">$slave</tt>.</p></dd><dt><b><tt class="literal">-lp =></tt> <em class="replaceable">value</em></b></dt><dd><a name="INDEX-2774" />Abbreviation for the<tt class="literal">-padleft</tt> option.</p></dd><dt><b><tt class="literal">-ls =></tt> <em class="replaceable">weight</em></b></dt><dd><a name="INDEX-2775" />Abbreviation for the<tt class="literal">-leftspring</tt> option.</p></dd><dt><b><tt class="literal">-padbottom =></tt> <em class="replaceable">value</em></b></dt><dd><a name="INDEX-2776" />Specifies the amount of externalpadding to leave on the bottom side of the slave.</p></dd><dt><b><tt class="literal">-padleft =></tt> <em class="replaceable">value</em></b></dt><dd><a name="INDEX-2777" />Specifies the amount of externalpadding to leave on the left side of the slave.</p></dd><dt><b><tt class="literal">-padright =></tt> <em class="replaceable">value</em></b></dt><dd><a name="INDEX-2778" />Specifies the amount of externalpadding to leave on the right side of the slave.</p></dd><dt><b><tt class="literal">-padtop =></tt> <em class="replaceable">value</em></b></dt><dd><a name="INDEX-2779" />Specifies the amount of externalpadding to leave on the top side of the slave.</p></dd><dt><b><tt class="literal">-padx =></tt> <em class="replaceable">value</em></b></dt><dd><a name="INDEX-2780" />Specifies the amount of externalpadding to leave on both the left and right sides of the slave.</p></dd><dt><b><tt class="literal">-pady =></tt> <em class="replaceable">value</em></b></dt><dd><a name="INDEX-2781" />Specifies the amount of externalpadding to leave on both the top and bottom sides of the slave.</p></dd><dt><b><tt class="literal">-r =></tt> <em class="replaceable">attachment</em></b></dt><dd><a name="INDEX-2782" />Abbreviation for the<tt class="literal">-right</tt> option.</p></dd><dt><b><tt class="literal">-right =></tt> <em class="replaceable">attachment</em></b></dt><dd><a name="INDEX-2783" />Specifies an attachment for the rightedge of the slave window.</p></dd><dt><b><tt class="literal">-rightspring =></tt> <em class="replaceable">weight</em></b></dt><dd><a name="INDEX-2784" />Specifies the weight of the spring atthe right edge of the slave window.</p></dd><dt><b><tt class="literal">-rp =></tt> <em class="replaceable">value</em></b></dt><dd><a name="INDEX-2785" />Abbreviation for the<tt class="literal">-padright</tt> option.</p></dd><dt><b><tt class="literal">-rs =></tt> <em class="replaceable">weight</em></b></dt><dd><a name="INDEX-2786" />Abbreviation for the<tt class="literal">-rightspring</tt> option.</p></dd><dt><b><tt class="literal">-t =></tt> <em class="replaceable">attachment</em></b></dt><dd><a name="INDEX-2787" />Abbreviation for the<tt class="literal">-top</tt> option.</p></dd><dt><b><tt class="literal">-top =></tt> <em class="replaceable">attachment</em></b></dt><dd><a name="INDEX-2788" />Specifies an attachment for the top edgeof the slave window.</p></dd><dt><b><tt class="literal">-topspring =></tt> <em class="replaceable">weight</em></b></dt><dd><a name="INDEX-2789" />Specifies the weight of thespring at the top edge of the slave window.</p></dd><dt><b><tt class="literal">-tp =></tt> <em class="replaceable">value</em></b></dt><dd><a name="INDEX-2790" />Abbreviation for the<tt class="literal">-padtop</tt> option.</p></dd><dt><b><tt class="literal">-ts =></tt> <em class="replaceable">weight</em></b></dt><dd><a name="INDEX-2791" />Abbreviation for the<tt class="literal">-topspring</tt> option.</p></dd></dl><p>The following methods are associated with widgets managed by<tt class="literal">form</tt>:</p><dl><dt><b><tt class="literal">formCheck</tt></b></dt><dd><a name="INDEX-2792" />Checks whether this is a circulardependancy between the master's slaves. It returnstrue if the dependancy exists and false otherwise.</p></dd><dt><b><tt class="literal">formForget</tt></b></dt><dd><a name="INDEX-2793" />Removes the slave from its master andunmaps its window. The slave will no longer be managed by<tt class="literal">form</tt>. All attachment values with respect to<tt class="literal">$master</tt> are discarded.</p></dd><dt><b><tt class="literal">formGrid($size_x, $size_y)</tt></b></dt><dd><a name="INDEX-2794" />Returns the number of grids to<tt class="literal">$master</tt> as integers in the form<tt class="literal">$size_x</tt>, <tt class="literal">$size_y</tt>. You maychange the number of grids on the master window by passing<tt class="literal">$size_x</tt> and <tt class="literal">$size_y</tt> to<tt class="literal">formGrid</tt>.</p></dd><dt><b><tt class="literal">formInfo(-option)</tt></b></dt><dd><a name="INDEX-2795" />Queries the attachment options of aslave window. <tt class="literal">-option</tt> can be any of the optionsaccepted by <tt class="literal">form</tt>. With no options,<tt class="literal">formInfo</tt> returns the current configuration values.</p></dd><dt><b><tt class="literal">formSlaves</tt></b></dt><dd><a name="INDEX-2796" />Returns a list of all the slaves forthe master window.</p></dd></dl></div><hr width="684" align="left" /><div class="navbar"><table width="684" border="0"><tr><td align="left" valign="top" width="228"><a href="ch21_01.htm"><img src="../gifs/txtpreva.gif" alt="Previous" border="0" /></a></td><td align="center" valign="top" width="228"><a href="index.htm"><img src="../gifs/txthome.gif" alt="Home" border="0" /></a></td><td align="right" valign="top" width="228"><a href="ch21_03.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr><tr><td align="left" valign="top" width="228">21. Perl/Tk</td><td align="center" valign="top" width="228"><a href="index/index.htm"><img src="../gifs/index.gif" alt="Book Index" border="0" /></a></td><td align="right" valign="top" width="228">21.3. Common Widget Configuration Options</td></tr></table></div><hr width="684" align="left" /><img src="../gifs/navbar.gif" usemap="#library-map" border="0" alt="Library Navigation Links" /><p><p><font size="-1"><a href="copyrght.htm">Copyright © 2002</a> O'Reilly & Associates. All rights reserved.</font></p><map name="library-map"><area shape="rect" coords="1,0,85,94" href="../index.htm"><area shape="rect" coords="86,1,178,103" href="../lwp/index.htm"><area shape="rect" coords="180,0,265,103" href="../lperl/index.htm"><area shape="rect" coords="267,0,353,105" href="../perlnut/index.htm"><area shape="rect" coords="354,1,446,115" href="../prog/index.htm"><area shape="rect" coords="448,0,526,132" href="../tk/index.htm"><area shape="rect" coords="528,1,615,119" href="../cookbook/index.htm"><area shape="rect" coords="617,0,690,135" href="../pxml/index.htm"></map></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -