/usr/share/mozart/doc/wp/node27.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.8 Scales</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="node26.html#section.widgets-2.entry"><< Prev</A></TD><TD><A href="node19.html">- Up -</A></TD><TD><A href="node28.html#section.widgets-2.listbox">Next >></A></TD></TR></TABLE><DIV id="section.widgets-2.scale"><H2><A name="section.widgets-2.scale">5.8 Scales</A></H2><P> A scale widget allows to select a number from a certain range by moving a slider. Each time the slider is moved, an action attached to the slider is invoked with a single argument giving the current number value of the slider. </P><P> In <A href="node27.html#figure.widgets-2.scales">Figure 5.9</A> an example is shown which allows to display a color determined by three sliders for the intensity of the base colors red, green, and blue. The object <CODE>F</CODE> stores the intensity for each base color in an attribute. Whenever the method <CODE>bg</CODE> is executed it changes the intensity for one of the base colors and changes the background color to the combination of all three base colors. </P><DIV id="figure.widgets-2.scales"><HR><P><A name="figure.widgets-2.scales"></A></P><P> </P><DIV align="center"><IMG alt="" src="scale.gif"></DIV><P> <A name="label244"></A> <A name="label246"></A> </P><DL class="anonymous"><DD class="code"><CODE>L ={New <SPAN class="keyword">class</SPAN> <SPAN class="type">$</SPAN> <SPAN class="keyword">from</SPAN><SPAN class="type"> Tk.listener</SPAN> <BR> <SPAN class="keyword">attr</SPAN> red:0 green:0 blue:0<BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">bg</SPAN>(C I)<BR> C <SPAN class="keyword">:=</SPAN> I {F tk(configure bg:c(<SPAN class="keyword">@</SPAN>red <SPAN class="keyword">@</SPAN>green <SPAN class="keyword">@</SPAN>blue))}<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> tkInit}<BR>F ={New Tk<SPAN class="keyword">.</SPAN>frame tkInit(parent:W height:2<SPAN class="keyword">#</SPAN>c)}<BR>Ss={Map [red green blue]<BR> <SPAN class="keyword">fun</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> C}<BR> {New Tk<SPAN class="keyword">.</SPAN>scale tkInit(parent:W orient:horizontal length:8<SPAN class="keyword">#</SPAN>c<BR> label:C <SPAN class="string">'from'</SPAN>:0 to:255<BR> action: L <SPAN class="keyword">#</SPAN> bg(C)<BR> args: [int])}<BR> <SPAN class="keyword">end</SPAN>}<BR>{Tk<SPAN class="keyword">.</SPAN>send pack(b(Ss) F fill:x)}</CODE></DD></DL><P> </P><P class="caption"><STRONG>Figure 5.9:</STRONG> Scales to configure a frame's background color.</P><HR></DIV><P> </P><P> The sliders are configured with the <CODE>label</CODE> option to display the name of the base color as their labels. The other options besides of <CODE>action</CODE> and <CODE>args</CODE> are self explanatory, more information on them can be found in <A href="../tcltk/TkCmd/scale.htm"><KBD>scale</KBD></A>. </P><P> The value for the <CODE>args</CODE> option must be a type specification similar to that used for the specification of argument types in event bindings (see <A href="node24.html#section.widgets-2.event-args">Section 5.5.2</A>. The only difference is that no event argument specification is required. Invoking the action is also similar. For instance, if the scale for the color <CODE>red</CODE> changes its value to <CODE>10</CODE>, the message <CODE>bg(red 10)</CODE> will eventually be served by the listener <CODE>L</CODE>. </P></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node26.html#section.widgets-2.entry"><< Prev</A></TD><TD><A href="node19.html">- Up -</A></TD><TD><A href="node28.html#section.widgets-2.listbox">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>
|