/usr/share/mozart/doc/wp/node28.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.9 Listboxes and Scrollbars</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="node27.html#section.widgets-2.scale"><< Prev</A></TD><TD><A href="node19.html">- Up -</A></TD><TD><A href="node29.html#section.widgets-2.wm">Next >></A></TD></TR></TABLE><DIV id="section.widgets-2.listbox"><H2><A name="section.widgets-2.listbox">5.9 Listboxes and Scrollbars</A></H2><DIV class="apropos"><P class="margin">scanning</P><P> A listbox displays a list of strings and allows the user to select one or more of them. If the listbox contains more lines than it can display at once, the user can select the strings to be displayed by <A name="label247"></A><EM>scanning</EM> the listbox. The listbox can be scanned by pressing the second mouse button and moving the mouse pointer up or down while the button is still being pressed. </P></DIV><P> A more convenient way than scanning is to use <A name="label248"></A><EM>scrollbar</EM> widgets. A scrollbar widgets allows the user to determine the portion of strings displayed by moving a slider. Scrollbars are independent of a particular widget type: they can be also attached to other widgets including entries. </P><P> <A href="node28.html#figure.widgets-2.listbox">Figure 5.10</A> shows a program that allows to select a color from a list of colors. The list of colors is provided by some external file inserted at the beginning of the program. The listbox object is initialized and creates an event binding for pressing the left mouse button as follows. First the currently selected index <CODE>I</CODE> is retrieved (the strings in the list box are indexed). Then the string <CODE>C</CODE> at this index is retrieved and used as background color of the listbox widget. </P><DIV id="figure.widgets-2.listbox"><HR><P><A name="figure.widgets-2.listbox"></A></P><P> </P><DIV align="center"><IMG alt="" src="listbox.gif"></DIV><P> <A name="label250"></A> <A name="label252"></A> <A name="label254"></A> <A name="label256"></A> </P><DL class="anonymous"><DD class="code"><CODE>L={New Tk<SPAN class="keyword">.</SPAN>listbox tkInit(parent:W height:6)}<BR>{L tkBind(event: <SPAN class="string">'<1>'</SPAN> <BR> action: <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN>}<BR> I={L tkReturn(curselection $)}<BR> C={L tkReturn(get(I) $)}<BR> <SPAN class="keyword">in</SPAN> <BR> {L tk(configure bg:C)}<BR> <SPAN class="keyword">end</SPAN>)}<BR>S={New Tk<SPAN class="keyword">.</SPAN>scrollbar tkInit(parent:W)}<BR>{ForAll </CODE><SPAN class="chunktitle"><SPAN class="chunkborder"><</SPAN><A href="node46.html#label345">Color names</A><SPAN class="chunkborder">></SPAN></SPAN><CODE> <BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> C}<BR> {L tk(insert <SPAN class="string">'end'</SPAN> C)}<BR> <SPAN class="keyword">end</SPAN>}<BR>{Tk<SPAN class="keyword">.</SPAN>addYScrollbar L S}<BR>{Tk<SPAN class="keyword">.</SPAN>send pack(L S fill:y side:left)}</CODE></DD></DL><P> </P><P class="caption"><STRONG>Figure 5.10:</STRONG> A listbox together with a vertical scrollbar.</P><HR></DIV><P> </P><DIV class="apropos"><P class="margin">attaching scrollbars</P><P> To attach a scrollbar to a widget we use the predefined procedure <CODE>Tk<SPAN class="keyword">.</SPAN>addYScrollbar</CODE>. It creates event bindings for the scrollbar such that moving the scrollbar's slider affects the visible strings of the listbox. Also it creates event bindings for the listbox such that scanning the listbox is reflected by the scrollbar. </P></DIV><P> More information on listboxes can be found in <A href="../tcltk/TkCmd/listbox.htm"><KBD>listbox</KBD></A> and more information on scrollbars in <A href="../tcltk/TkCmd/scrollbar.htm"><KBD>scrollbar</KBD></A>. </P></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node27.html#section.widgets-2.scale"><< Prev</A></TD><TD><A href="node19.html">- Up -</A></TD><TD><A href="node29.html#section.widgets-2.wm">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>
|