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

📄 ch21_18.htm

📁 by Randal L. Schwartz and Tom Phoenix ISBN 0-596-00132-0 Third Edition, published July 2001. (See
💻 HTM
字号:
<html><head><title>The Toplevel Widget (Perl in a Nutshell, 2nd Edition)</title><link rel="stylesheet" type="text/css" href="../style/style1.css" /><meta name="DC.Creator" content="Stephen Spainhour" /><meta name="DC.Format" content="text/xml" scheme="MIME" /><meta name="DC.Language" content="en-US" /><meta name="DC.Publisher" content="O'Reilly &amp; Associates, Inc." /><meta name="DC.Source" scheme="ISBN" content="0596002416L" /><meta name="DC.Subject.Keyword" content="stuff" /><meta name="DC.Title" content="Perl in a Nutshell, 2nd Edition" /><meta name="DC.Type" content="Text.Monograph" /></head><body bgcolor="#ffffff"><img src="gifs/smbanner.gif" usemap="#banner-map" border="0" alt="Book Home" /><map name="banner-map"><area shape="rect" coords="1,-2,616,66" href="index.htm" alt="Java and XSLT" /><area shape="rect" coords="629,-11,726,25" href="jobjects/fsearch.htm" alt="Search this book" /></map><div class="navbar"><table width="684" border="0"><tr><td align="left" valign="top" width="228"><a href="ch21_17.htm"><img src="../gifs/txtpreva.gif" alt="Previous" border="0" /></a></td><td align="center" valign="top" width="228" /><td align="right" valign="top" width="228"><a href="part10.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr></table></div><h2 class="sect1">21.18. The Toplevel Widget</h2><p><a name="INDEX-3131" /><a name="INDEX-3132" /><a name="INDEX-3133" />Create a toplevel widget, displayedindependently from the main window with the same decoration as thewindow system, using the <tt class="literal">Toplevel</tt> method.</p><p>The standard configuration options that apply to<tt class="literal">Toplevel</tt> are: <tt class="literal">-background</tt>,<tt class="literal">-bg</tt>,  <tt class="literal">-borderwidth</tt>,<tt class="literal">-bw</tt>, <tt class="literal">-cursor</tt>,<tt class="literal">-height</tt>, <tt class="literal">-highlightbackground</tt>,<tt class="literal">-highlightcolor</tt>, <tt class="literal">-highlightthickness</tt>, <tt class="literal">-relief</tt>,<tt class="literal">-takefocus</tt>, and <tt class="literal">-width</tt>.</p><p>Other options are:</p><dl><dt><b><tt class="literal">-class =&gt;</tt> <em class="replaceable">name</em></b></dt><dd><a name="INDEX-3134" />Theclass associated with the Toplevel widget.</p></dd><dt><b><tt class="literal">-colormap =&gt;</tt> <tt class="literal">\$</tt><em class="replaceable">window</em></b></dt><dd><a name="INDEX-3135" />Specifies another window to share thecolormap with. You can point to another window or use the value<tt class="literal">new</tt> to specify a new colormap. Default is<tt class="literal">undef</tt>.</p></dd><dt><b><tt class="literal">-screen =&gt;</tt> <em class="replaceable">screen</em></b></dt><dd><a name="INDEX-3136" />The screen to place the toplevelwidget on.</p></dd><dt><b><tt class="literal">-visual =&gt;</tt> <em class="replaceable">type n</em></b></dt><dd><a name="INDEX-3137" />Forthe X Window System, changes the depth of colors.</p></dd></dl><a name="perlnut2-CHP-21-SECT-18.1" /><div class="sect2"><h3 class="sect2">21.18.1. Toplevel Methods</h3><p>In addition to <tt class="literal">cget</tt> and<tt class="literal">configure</tt>, the following methods are supported bythe Toplevel widget. Note that since the MainWindow is a Toplevelwidget, each of these methods applies to the MainWindow as well.</p><dl><dt><b><tt class="literal">aspect</tt></b></dt><dd><a name="INDEX-3138" />Returns the constraints to the aspect ofthe window. The four-item list returned corresponds to the minimumwidth, the minimum height, the maximum width, and the maximum height.</p></dd><dt><b><tt class="literal">client</tt></b></dt><dd><a name="INDEX-3139" />Assigns a name to the toplevel window.</p></dd><dt><b><tt class="literal">colormapwindows</tt></b></dt><dd><a name="INDEX-3140" />For the X Window System, passes alist of windows to the window manager that have private colormaps.Controls the WM_COLORMAP_WINDOWS property.</p></dd><dt><b><tt class="literal">command</tt></b></dt><dd><a name="INDEX-3141" />For the X Window System, returns thecommand used to start the application.</p></dd><dt><b><tt class="literal">deiconify</tt></b></dt><dd><a name="INDEX-3142" />Displays an iconified window.</p></dd><dt><b><tt class="literal">focusmodel</tt></b></dt><dd><a name="INDEX-3143" />Gives up the keyboard focus to anotherwindow.</p></dd><dt><b><tt class="literal">frame</tt></b></dt><dd><a name="INDEX-3144" />Returns the ID of the parent widget as ahexadecimal string.</p></dd><dt><b><tt class="literal">geometry</tt></b></dt><dd><a name="INDEX-3145" />For the X Window System, gets thegeometry of the Toplevel widget.</p></dd><dt><b><tt class="literal">grid</tt></b></dt><dd><a name="INDEX-3146" />Changes the size of theToplevel's grid.</p></dd><dt><b><tt class="literal">group</tt></b></dt><dd><a name="INDEX-3147" />Makes the widget the group leader of aset of related windows.</p></dd><dt><b><tt class="literal">iconbitmap</tt></b></dt><dd><a name="INDEX-3148" />Identifies a bitmap to use as an iconwhen the window is iconified.</p></dd><dt><b><tt class="literal">iconify</tt></b></dt><dd><a name="INDEX-3149" />Iconifies the window.</p></dd><dt><b><tt class="literal">iconmask</tt></b></dt><dd><a name="INDEX-3150" />Specifies a mask for the icon bitmap.</p></dd><dt><b><tt class="literal">iconname</tt></b></dt><dd><a name="INDEX-3151" />Assigns text to be associated with theicon.</p></dd><dt><b><tt class="literal">iconposition</tt></b></dt><dd><a name="INDEX-3152" />Specifies a position for the icon on thedesktop.</p></dd><dt><b><tt class="literal">iconwindow</tt></b></dt><dd><a name="INDEX-3153" />Specifies a widget to use in place of anicon when iconified.</p></dd><dt><b><tt class="literal">maxsize</tt></b></dt><dd><a name="INDEX-3154" />Specifies the largest size for thewindow.</p></dd><dt><b><tt class="literal">minsize</tt></b></dt><dd><a name="INDEX-3155" />Specifies the smallest size for thewindow.</p></dd><dt><b><tt class="literal">overrideredirect</tt></b></dt><dd><a name="INDEX-3156" />Removes window decorations fromthe window.</p></dd><dt><b><tt class="literal">positionfrom</tt></b></dt><dd><a name="INDEX-3157" />Returns either<tt class="literal">program</tt> or <tt class="literal">user</tt> to tell youwhether the user or window manager requested its current position.</p></dd><dt><b><tt class="literal">protocol</tt></b></dt><dd><a name="INDEX-3158" />Given one of the window managersWM_DELETE_WINDOW, WM_SAVE_YOURSELF, or WM_TAKE_FOCUS, allows you todefine a callback to execute when an associated event is detected.</p></dd><dt><b><tt class="literal">resizable</tt></b></dt><dd><a name="INDEX-3159" />Takes Boolean values representingwhether the window can be resized in width and height, respectively.</p></dd><dt><b><tt class="literal">sizefrom</tt></b></dt><dd><a name="INDEX-3160" />Returns either<tt class="literal">program</tt> or <tt class="literal">user</tt> to tell youwhether the user or window manager requested its current size.</p></dd><dt><b><tt class="literal">state</tt></b></dt><dd><a name="INDEX-3161" />Returns <tt class="literal">normal</tt>,<tt class="literal">iconic</tt>, or <tt class="literal">withdrawn</tt>,indicating the current state of the window.</p></dd><dt><b><tt class="literal">title</tt></b></dt><dd><a name="INDEX-3162" />Changes the title at the top of thewindow.</p></dd><dt><b><tt class="literal">transient</tt></b></dt><dd><a name="INDEX-3163" />Indicates to the window manager that thewindow is transient.</p></dd><dt><b><tt class="literal">withdraw</tt></b></dt><dd><a name="INDEX-3164" />Makes the window nonvisible.<a name="INDEX-3165" /><a name="INDEX-3166" /></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_17.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="part10.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr><tr><td align="left" valign="top" width="228">21.17. The Frame Widget</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">X. Win32</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 &copy; 2002</a> O'Reilly &amp; 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 + -