/usr/share/mozart/doc/wp/node23.html is in mozart-doc 1.4.0-8ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>5.4 Menus, Menuitems, and Menubuttons</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="node22.html#section.widgets-2.return"><< Prev</A></TD><TD><A href="node19.html">- Up -</A></TD><TD><A href="node24.html#section.widgets-2.events">Next >></A></TD></TR></TABLE><DIV id="section.widgets-2.menu"><H2><A name="section.widgets-2.menu">5.4 Menus, Menuitems, and Menubuttons</A></H2><P> Menu widgets serve as containers for menu entries. A menu entry can be one of the following: </P><TABLE align="center" bgcolor="#f0f0e0"><TR valign="top"><TD><P><CODE>separator</CODE></P></TD><TD><P>displays a horizontal line</P></TD></TR><TR valign="top"><TD><P><CODE>command</CODE></P></TD><TD><P>similar to button widgets</P></TD></TR><TR valign="top"><TD><P><CODE>radiobutton</CODE></P></TD><TD><P>similar to radiobutton widgets</P></TD></TR><TR valign="top"><TD><P><CODE>checkbutton</CODE></P></TD><TD><P>similar to checkbutton widgets</P></TD></TR><TR valign="top"><TD><P><CODE>cascade</CODE></P></TD><TD><P>displays sub menus</P></TD></TR></TABLE><P> Menu entries are not widgets. In particular, menu entries are not managed by a geometry manager. Instead as soon as a menu entry is created it is displayed in its parent menu. To configure a menu entry after it has been created, one needs to use the <CODE>entryconfigure</CODE> command rather than the <CODE>configure</CODE> command. </P><DIV class="apropos"><P class="margin">tear off entry</P><P> The program shown in <A href="node23.html#figure.widgets-2.menu">Figure 5.4</A> creates two menu widgets <CODE>M1</CODE> and <CODE>M2</CODE>. The first cascade entry of the menu widget <CODE>M1</CODE> is configured such that it displays the menu <CODE>M2</CODE> when the menu is traversed. The option <CODE>tearoff</CODE> determines that the first default so-called ``tear off'' entry is not created. Selecting a tear off entry displays the menu in a window on its own. </P><DIV id="figure.widgets-2.menu"><HR><P><A name="figure.widgets-2.menu"></A></P><P> </P><DIV align="center"><IMG alt="" src="menu.gif"></DIV><P> <A name="label220"></A> <A name="label222"></A> <A name="label224"></A> <A name="label226"></A> </P><DL class="anonymous"><DD class="code"><CODE>Cs =[<SPAN class="string">'Wheat'</SPAN> <SPAN class="string">'Firebrick'</SPAN> <SPAN class="string">'Navy'</SPAN> <SPAN class="string">'Darkorange'</SPAN>]<BR>M1 ={New Tk<SPAN class="keyword">.</SPAN>menu tkInit(parent:W tearoff:<SPAN class="keyword">false</SPAN>)}<BR>M2 ={New Tk<SPAN class="keyword">.</SPAN>menu tkInit(parent:M1 tearoff:<SPAN class="keyword">false</SPAN>)}<BR>E1 ={New Tk<SPAN class="keyword">.</SPAN>menuentry<SPAN class="keyword">.</SPAN>cascade<BR> tkInit(parent:M1 label:<SPAN class="string">'Background Color'</SPAN> menu:M2)}<BR>E2 ={New Tk<SPAN class="keyword">.</SPAN>menuentry<SPAN class="keyword">.</SPAN>separator tkInit(parent:M1)}<BR>E3 ={New Tk<SPAN class="keyword">.</SPAN>menuentry<SPAN class="keyword">.</SPAN>command<BR> tkInit(parent:M1 label:<SPAN class="string">'Quit'</SPAN> action: W<SPAN class="keyword">#</SPAN>tkClose)}<BR>V ={New Tk<SPAN class="keyword">.</SPAN>variable tkInit(Cs<SPAN class="keyword">.</SPAN>1)}<BR>CEs={Map Cs <SPAN class="keyword">fun</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> C}<BR> {New Tk<SPAN class="keyword">.</SPAN>menuentry<SPAN class="keyword">.</SPAN>radiobutton<BR> tkInit(parent:M2 label:C var:V val:C<BR> action: W<SPAN class="keyword">#</SPAN>tk(configure bg:C))}<BR> <SPAN class="keyword">end</SPAN>}</CODE></DD></DL><P> </P><P class="caption"><STRONG>Figure 5.4:</STRONG> A menu with entries, including a cascaded sub menu.</P><HR></DIV><P> </P></DIV><DIV class="apropos"><P class="margin">posting menus</P><P> Usually menus are not visible. Only when needed a menu appears on the screen, we say that it is <A name="label227"></A><EM>posted</EM>. After the user has traversed the menu and has selected an entry, the menu is made invisible again: it is <A name="label228"></A><EM>unposted</EM>. Posting the menu <CODE>M1</CODE> at the upper left edge of the screen can be done by </P><DL class="anonymous"><DD class="code"><CODE>{M1 tk(post 0 0)}</CODE></DD></DL><P> </P></DIV><DIV class="apropos"><P class="margin">menubuttons</P><P> From menus one can compose menu bars and popup menus. A menu bar consists of several menubutton widgets. A menubutton widget can display text, bitmaps, or images. To a menubutton a menu can be attached such that pressing the button makes the menu widget appear on the screen. We do not discuss menu bars here in detail, since the <CODE>TkTools</CODE> module provides an abstraction that supports the creation of menu bars (see <A href="node44.html#section.tools.menubars">Section 8.3</A>). </P></DIV><DIV class="apropos"><P class="margin">popup menus</P><P> The command <CODE>tk_popup</CODE> can be used to display popup menus. It takes as arguments the menu widget and the coordinates where the widget should appear on the screen. Ideally, we want the menu widget to appear after pressing the mouse button when the mouse pointer is over some widget. The <A href="node24.html#section.widgets-2.events">next section</A> introduces events which allows to mattach actions to abitrary widgets. </P></DIV><P> Reference information can be found in <A href="../tcltk/TkCmd/menu.htm"><KBD>menu</KBD></A> and <A href="../tcltk/TkCmd/menubutton.htm"><KBD>menubutton</KBD></A>. </P></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node22.html#section.widgets-2.return"><< Prev</A></TD><TD><A href="node19.html">- Up -</A></TD><TD><A href="node24.html#section.widgets-2.events">Next >></A></TD></TR></TABLE><HR><ADDRESS><A href="http://www.ps.uni-sb.de/~schulte/">Christian Schulte</A><BR><SPAN class="version">Version 1.4.0 (20110908185330)</SPAN></ADDRESS></BODY></HTML>
|