home *** CD-ROM | disk | FTP | other *** search
-
- <HTML>
- <HEAD>
- <TITLE>Tk::Scale - Create and manipulate Scale widgets</TITLE>
- <LINK REL="stylesheet" HREF="../../../Active.css" TYPE="text/css">
- <LINK REV="made" HREF="mailto:">
- </HEAD>
-
- <BODY>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> Tk::Scale - Create and manipulate Scale widgets</P></STRONG>
- </TD></TR>
- </TABLE>
-
- <A NAME="__index__"></A>
- <!-- INDEX BEGIN -->
-
- <UL>
-
- <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
-
- <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
- <LI><A HREF="#standard options">STANDARD OPTIONS</A></LI>
- <LI><A HREF="#widgetspecific options">WIDGET-SPECIFIC OPTIONS</A></LI>
- <LI><A HREF="#description">DESCRIPTION</A></LI>
- <LI><A HREF="#widget methods">WIDGET METHODS</A></LI>
- <LI><A HREF="#bindings">BINDINGS</A></LI>
- <LI><A HREF="#keywords">KEYWORDS</A></LI>
- </UL>
- <!-- INDEX END -->
-
- <HR>
- <P>
- <H1><A NAME="name">NAME</A></H1>
- <P>Tk::Scale - Create and manipulate Scale widgets</P>
- <P>
- <HR>
- <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
- <UL>
- <LI>Linux</LI>
- <LI>Solaris</LI>
- <LI>Windows</LI>
- </UL>
- <HR>
- <H1><A NAME="synopsis">SYNOPSIS</A></H1>
- <P><EM>$scale</EM> = <EM>$parent</EM>-><STRONG>Scale</STRONG>(?<EM>options</EM>?);</P>
- <P>
- <HR>
- <H1><A NAME="standard options">STANDARD OPTIONS</A></H1>
- <P><TABLE CELLSPACING=0 CELLPADDING=0><TR><TD><STRONG>-activebackground</STRONG><TD><STRONG>-font</STRONG><TD><STRONG>-highlightthickness</STRONG><TD><STRONG>-repeatinterval</STRONG>
- <TR><TD><STRONG>-background</STRONG><TD><STRONG>-foreground</STRONG><TD><STRONG>-orient</STRONG><TD><STRONG>-takefocus</STRONG>
- <TR><TD><STRONG>-borderwidth</STRONG><TD><STRONG>-highlightbackground</STRONG><TD><STRONG>-relief</STRONG><TD><STRONG>-troughcolor</STRONG>
- <TR><TD><STRONG>-cursor</STRONG><TD><STRONG>-highlightcolor</STRONG><TD><STRONG>-repeatdelay</STRONG></TABLE></P>
- <P>See <A HREF="../../../site/lib/Tk/options.html">the Tk::options manpage</A> for details of the standard options.</P>
- <P>
- <HR>
- <H1><A NAME="widgetspecific options">WIDGET-SPECIFIC OPTIONS</A></H1>
- <DL>
- <DT><STRONG><A NAME="item_Name%3A_bigIncrement">Name: <STRONG>bigIncrement</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_BigIncrement">Class: <STRONG>BigIncrement</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dbigincrement">Switch: <STRONG>-bigincrement</STRONG></A></STRONG><BR>
- <DD>
- Some interactions with the scale cause its value to change by
- ``large'' increments; this option specifies the size of the
- large increments. If specified as 0, the large increments default
- to 1/10 the range of the scale.
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_command">Name: <STRONG>command</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_Command">Class: <STRONG>Command</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dcommand">Switch: <STRONG>-command</STRONG></A></STRONG><BR>
- <DD>
- Specifies the prefix of a <A HREF="../../../site/lib/Tk/callbacks.html">perl/Tk callback</A> to invoke whenever the scale's
- value is changed via a method.
- The actual command consists
- of this option followed by a space and a real number indicating the
- new value of the scale.
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_digits">Name: <STRONG>digits</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_Digits">Class: <STRONG>Digits</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Ddigits">Switch: <STRONG>-digits</STRONG></A></STRONG><BR>
- <DD>
- An integer specifying how many significant digits should be retained
- when converting the value of the scale to a string.
- If the number is less than or equal to zero, then the scale picks
- the smallest value that guarantees that every possible slider
- position prints as a different string.
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_from">Name: <STRONG>from</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_From">Class: <STRONG>From</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dfrom">Switch: <STRONG>-from</STRONG></A></STRONG><BR>
- <DD>
- A real value corresponding to the left or top end of the scale.
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_label">Name: <STRONG>label</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_Label">Class: <STRONG>Label</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dlabel">Switch: <STRONG>-label</STRONG></A></STRONG><BR>
- <DD>
- A string to display as a label for the scale. For
- vertical scales the label is displayed just to the right of the
- top end of the scale. For horizontal scales the label is displayed
- just above the left end of the scale. If the option is specified
- as an empty string, no label is displayed.
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_length">Name: <STRONG>length</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_Length">Class: <STRONG>Length</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dlength">Switch: <STRONG>-length</STRONG></A></STRONG><BR>
- <DD>
- Specifies the desired long dimension of the scale in screen units
- (i.e. any of the forms acceptable to <STRONG>Tk_GetPixels</STRONG>).
- For vertical scales this is the scale's height; for horizontal scales
- it is the scale's width.
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_resolution">Name: <STRONG>resolution</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_Resolution">Class: <STRONG>Resolution</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dresolution">Switch: <STRONG>-resolution</STRONG></A></STRONG><BR>
- <DD>
- A real value specifying the resolution for the scale.
- If this value is greater than zero then the scale's value will always be
- rounded to an even multiple of this value, as will tick marks and
- the endpoints of the scale. If the value is less than zero then no
- rounding occurs. Defaults to 1 (i.e., the value will be integral).
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_showValue">Name: <STRONG>showValue</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_ShowValue">Class: <STRONG>ShowValue</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dshowvalue">Switch: <STRONG>-showvalue</STRONG></A></STRONG><BR>
- <DD>
- Specifies a boolean value indicating whether or not the current
- value of the scale is to be displayed.
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_sliderLength">Name: <STRONG>sliderLength</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_SliderLength">Class: <STRONG>SliderLength</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dsliderlength">Switch: <STRONG>-sliderlength</STRONG></A></STRONG><BR>
- <DD>
- Specfies the size of the slider, measured in screen units along the slider's
- long dimension. The value may be specified in any of the forms acceptable
- to <STRONG>Tk_GetPixels</STRONG>.
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_sliderRelief">Name: <STRONG>sliderRelief</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_SliderRelief">Class: <STRONG>SliderRelief</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dsliderrelief">Switch: <STRONG>-sliderrelief</STRONG></A></STRONG><BR>
- <DD>
- Specifies the relief to use when drawing the slider, such as <STRONG>raised</STRONG>
- or <STRONG>sunken</STRONG>.
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_state">Name: <STRONG>state</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_State">Class: <STRONG>State</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dstate">Switch: <STRONG>-state</STRONG></A></STRONG><BR>
- <DD>
- Specifies one of three states for the scale: <STRONG>normal</STRONG>,
- <STRONG>active</STRONG>, or <STRONG>disabled</STRONG>.
- If the scale is disabled then the value may not be changed and the scale
- won't activate.
- If the scale is active, the slider is displayed using the color
- specified by the <STRONG>activeBackground</STRONG> option.
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_tickInterval">Name: <STRONG>tickInterval</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_TickInterval">Class: <STRONG>TickInterval</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dtickinterval">Switch: <STRONG>-tickinterval</STRONG></A></STRONG><BR>
- <DD>
- Must be a real value.
- Determines the spacing between numerical
- tick marks displayed below or to the left of the slider.
- If 0, no tick marks will be displayed.
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_to">Name: <STRONG>to</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_To">Class: <STRONG>To</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dto">Switch: <STRONG>-to</STRONG></A></STRONG><BR>
- <DD>
- Specifies a real value corresponding
- to the right or bottom end of the scale.
- This value may be either less than or greater than the <STRONG>from</STRONG> option.
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_variable">Name: <STRONG>variable</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_Variable">Class: <STRONG>Variable</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dvariable">Switch: <STRONG>-variable</STRONG></A></STRONG><BR>
- <DD>
- Specifies the name of a global variable to link to the scale. Whenever the
- value of the variable changes, the scale will update to reflect this
- value.
- Whenever the scale is manipulated interactively, the variable
- will be modified to reflect the scale's new value.
- <P></P>
- <DT><STRONG><A NAME="item_Name%3A_width">Name: <STRONG>width</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Class%3A_Width">Class: <STRONG>Width</STRONG></A></STRONG><BR>
- <DD>
- <DT><STRONG><A NAME="item_Switch%3A_%2Dwidth">Switch: <STRONG>-width</STRONG></A></STRONG><BR>
- <DD>
- Specifies the desired narrow dimension of the trough in screen units
- (i.e. any of the forms acceptable to <STRONG>Tk_GetPixels</STRONG>).
- For vertical scales this is the trough's width; for horizontal scales
- this is the trough's height.
- <P></P></DL>
- <P>
- <HR>
- <H1><A NAME="description">DESCRIPTION</A></H1>
- <P>The <STRONG>Scale</STRONG> method creates a new window (given by the
- $widget argument) and makes it into a scale widget.
- Additional
- options, described above, may be specified on the command line
- or in the option database
- to configure aspects of the scale such as its colors, orientation,
- and relief. The <STRONG>scale</STRONG> command returns its
- $widget argument. At the time this command is invoked,
- there must not exist a window named $widget, but
- $widget's parent must exist.</P>
- <P>A scale is a widget that displays a rectangular <EM>trough</EM> and a
- small <EM>slider</EM>. The trough corresponds to a range
- of real values (determined by the <STRONG>from</STRONG>, <STRONG>to</STRONG>, and
- <STRONG>resolution</STRONG> options),
- and the position of the slider selects a particular real value.
- The slider's position (and hence the scale's value) may be adjusted
- with the mouse or keyboard as described in
- the <A HREF="#bindings">BINDINGS</A> section below. Whenever the scale's value is changed, a Tcl
- command is invoked (using the <STRONG>command</STRONG> option) to notify
- other interested widgets of the change.
- In addition, the value
- of the scale can be linked to a Tcl variable (using the <STRONG>variable</STRONG>
- option), so that changes in either are reflected in the other.</P>
- <P>Three annotations may be displayed in a scale widget: a label
- appearing at the top right of the widget (top left for horizontal
- scales), a number displayed just to the left of the slider
- (just above the slider for horizontal scales), and a collection
- of numerical tick marks just to the left of the current value
- (just below the trough for horizontal scales). Each of these three
- annotations may be enabled or disabled using the
- configuration options.</P>
- <P>
- <HR>
- <H1><A NAME="widget methods">WIDGET METHODS</A></H1>
- <P>The <STRONG>Scale</STRONG> method creates a widget object.
- This object supports the <STRONG>configure</STRONG> and <STRONG>cget</STRONG> methods
- described in <A HREF="../../../site/lib/Tk/options.html">the Tk::options manpage</A> which can be used to enquire and
- modify the options described above.
- The widget also inherits all the methods provided by the generic
- <A HREF="../../../site/lib/Tk/Widget.html">Tk::Widget</A> class.</P>
- <P>The following additional methods are available for scale widgets:</P>
- <DL>
- <DT><STRONG><A NAME="item_coords"><EM>$scale</EM>-><STRONG>coords</STRONG>(?<EM>value</EM>?)</A></STRONG><BR>
- <DD>
- Returns a list whose elements are the x and y coordinates of
- the point along the centerline of the trough that corresponds
- to <EM>value</EM>.
- If <EM>value</EM> is omitted then the scale's current value is used.
- <P></P>
- <DT><STRONG><A NAME="item_get"><EM>$scale</EM>-><STRONG>get</STRONG>(?<EM>x, y</EM>?)</A></STRONG><BR>
- <DD>
- If <EM>x</EM> and <EM>y</EM> are omitted, returns the current value
- of the scale. If <EM>x</EM> and <EM>y</EM> are specified, they give
- pixel coordinates within the widget; the command returns
- the scale value corresponding to the given pixel.
- Only one of <EM>x</EM> or <EM>y</EM> is used: for horizontal scales
- <EM>y</EM> is ignored, and for vertical scales <EM>x</EM> is ignored.
- <P></P>
- <DT><STRONG><A NAME="item_identify"><EM>$scale</EM>-><STRONG>identify</STRONG>(<EM>x, y</EM>)</A></STRONG><BR>
- <DD>
- Returns a string indicating what part of the scale lies under
- the coordinates given by <EM>x</EM> and <EM>y</EM>.
- A return value of <STRONG>slider</STRONG> means that the point is over
- the slider; <STRONG>trough1</STRONG> means that the point is over the
- portion of the slider above or to the left of the slider;
- and <STRONG>trough2</STRONG> means that the point is over the portion
- of the slider below or to the right of the slider.
- If the point isn't over one of these elements, an empty string
- is returned.
- <P></P>
- <DT><STRONG><A NAME="item_set"><EM>$scale</EM>-><STRONG>set</STRONG>(<EM>value</EM>)</A></STRONG><BR>
- <DD>
- This command is invoked to change the current value of the scale,
- and hence the position at which the slider is displayed. <EM>Value</EM>
- gives the new value for the scale.
- The command has no effect if the scale is disabled.
- <P></P></DL>
- <P>
- <HR>
- <H1><A NAME="bindings">BINDINGS</A></H1>
- <P>Tk automatically creates class bindings for scales that give them
- the following default behavior.
- Where the behavior is different for vertical and horizontal scales,
- the horizontal behavior is described in parentheses.</P>
- <DL>
- <DT><STRONG><A NAME="item_%5B1%5D">[1]</A></STRONG><BR>
- <DD>
- If button 1 is pressed in the trough, the scale's value will
- be incremented or decremented by the value of the <STRONG>resolution</STRONG>
- option so that the slider moves in the direction of the cursor.
- If the button is held down, the action auto-repeats.
- <P></P>
- <DT><STRONG><A NAME="item_%5B2%5D">[2]</A></STRONG><BR>
- <DD>
- If button 1 is pressed over the slider, the slider can be dragged
- with the mouse.
- <P></P>
- <DT><STRONG><A NAME="item_%5B3%5D">[3]</A></STRONG><BR>
- <DD>
- If button 1 is pressed in the trough with the Control key down,
- the slider moves all the way to the end of its range, in the
- direction towards the mouse cursor.
- <P></P>
- <DT><STRONG><A NAME="item_%5B4%5D">[4]</A></STRONG><BR>
- <DD>
- If button 2 is pressed, the scale's value is set to the mouse
- position. If the mouse is dragged with button 2 down, the scale's
- value changes with the drag.
- <P></P>
- <DT><STRONG><A NAME="item_%5B5%5D">[5]</A></STRONG><BR>
- <DD>
- The Up and Left keys move the slider up (left) by the value
- of the <STRONG>resolution</STRONG> option.
- <P></P>
- <DT><STRONG><A NAME="item_%5B6%5D">[6]</A></STRONG><BR>
- <DD>
- The Down and Right keys move the slider down (right) by the value
- of the <STRONG>resolution</STRONG> option.
- <P></P>
- <DT><STRONG><A NAME="item_%5B7%5D">[7]</A></STRONG><BR>
- <DD>
- Control-Up and Control-Left move the slider up (left) by the
- value of the <STRONG>bigIncrement</STRONG> option.
- <P></P>
- <DT><STRONG><A NAME="item_%5B8%5D">[8]</A></STRONG><BR>
- <DD>
- Control-Down and Control-Right move the slider down (right) by the
- value of the <STRONG>bigIncrement</STRONG> option.
- <P></P>
- <DT><STRONG><A NAME="item_%5B9%5D">[9]</A></STRONG><BR>
- <DD>
- Home moves the slider to the top (left) end of its range.
- <P></P>
- <DT><STRONG><A NAME="item_%5B10%5D">[10]</A></STRONG><BR>
- <DD>
- End moves the slider to the bottom (right) end of its range.
- <P>If the scale is disabled using the <STRONG>state</STRONG> option then
- none of the above bindings have any effect.</P>
- <P>The behavior of scales can be changed by defining new bindings for
- individual widgets or by redefining the class bindings.</P>
- <P></P></DL>
- <P>
- <HR>
- <H1><A NAME="keywords">KEYWORDS</A></H1>
- <P>scale, slider, trough, widget</P>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> Tk::Scale - Create and manipulate Scale widgets</P></STRONG>
- </TD></TR>
- </TABLE>
-
- </BODY>
-
- </HTML>
-