This file is indexed.

/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">&lt;&lt; Prev</A></TD><TD><A href="node19.html">- Up -</A></TD><TD><A href="node24.html#section.widgets-2.events">Next &gt;&gt;</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&nbsp;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&nbsp;=[<SPAN class="string">'Wheat'</SPAN>&nbsp;<SPAN class="string">'Firebrick'</SPAN>&nbsp;<SPAN class="string">'Navy'</SPAN>&nbsp;<SPAN class="string">'Darkorange'</SPAN>]<BR>M1&nbsp;={New&nbsp;Tk<SPAN class="keyword">.</SPAN>menu&nbsp;tkInit(parent:W&nbsp;&nbsp;tearoff:<SPAN class="keyword">false</SPAN>)}<BR>M2&nbsp;={New&nbsp;Tk<SPAN class="keyword">.</SPAN>menu&nbsp;tkInit(parent:M1&nbsp;tearoff:<SPAN class="keyword">false</SPAN>)}<BR>E1&nbsp;={New&nbsp;Tk<SPAN class="keyword">.</SPAN>menuentry<SPAN class="keyword">.</SPAN>cascade<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tkInit(parent:M1&nbsp;label:<SPAN class="string">'Background&nbsp;Color'</SPAN>&nbsp;menu:M2)}<BR>E2&nbsp;={New&nbsp;Tk<SPAN class="keyword">.</SPAN>menuentry<SPAN class="keyword">.</SPAN>separator&nbsp;tkInit(parent:M1)}<BR>E3&nbsp;={New&nbsp;Tk<SPAN class="keyword">.</SPAN>menuentry<SPAN class="keyword">.</SPAN>command<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tkInit(parent:M1&nbsp;label:<SPAN class="string">'Quit'</SPAN>&nbsp;action:&nbsp;W<SPAN class="keyword">#</SPAN>tkClose)}<BR>V&nbsp;&nbsp;={New&nbsp;Tk<SPAN class="keyword">.</SPAN>variable&nbsp;tkInit(Cs<SPAN class="keyword">.</SPAN>1)}<BR>CEs={Map&nbsp;Cs&nbsp;<SPAN class="keyword">fun</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">$</SPAN>&nbsp;C}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{New&nbsp;Tk<SPAN class="keyword">.</SPAN>menuentry<SPAN class="keyword">.</SPAN>radiobutton<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tkInit(parent:M2&nbsp;label:C&nbsp;var:V&nbsp;val:C<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;action:&nbsp;W<SPAN class="keyword">#</SPAN>tk(configure&nbsp;bg:C))}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>}</CODE></DD></DL><P> </P><P class="caption"><STRONG>Figure&nbsp;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&nbsp;tk(post&nbsp;0&nbsp;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&nbsp;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">&lt;&lt; Prev</A></TD><TD><A href="node19.html">- Up -</A></TD><TD><A href="node24.html#section.widgets-2.events">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 (20110908185330)</SPAN></ADDRESS></BODY></HTML>