Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1481
News FAQ
Search Home


next up previous contents index
Next: Message Up: Odds and Ends Previous: Label


Scale

The scale widget allows the user to pick a number out of a range. In other toolkits, this is called a slider. Here is an example of the creation of a scale:
    f := frame(side='left')
    v := scale(f,0,110,text='Volume')
    t := scale(f,0,110,text='Treble')
    b := scale(f,0,110,text='Bass')
The interface which this example creates is shown in Figure 11.8.
Figure 11.8: Scale
\begin{figure}\centerline{\psfig{figure=tkscale.eps,scale={0.7}}}\end{figure}
The value of the slider is posted with the value event. Here is an example,
    whenever v->value do
        print "Volume:",$value
This whenever prints out a message each time the volume is changed. Note however if you just want to get the last value of the slider, it is accessible as a member of the agent, in this case v.value. This is because the last value of each event name is retained in the agent. As a result, whenever statements are often not needed with scales. Table 11.10 lists the other construction parameters for scales, and Table 11.11 lists the scale events.


Table 11.10: Scale Construction Parameters
Parameter Default Values Description
parent widget parent of the scale
start 0.0 float starting integer for scale
end 100.0 float ending integer for scale
value start float initial value for the scale
length 110 integer length of scale
text '' string optional label for scale
resolution 1.0 float resolution of the scale
orient 'horizontal' 'horizontal' 'vertical orientation of scale
width '15' dimension width/height of the thumb
font '' X font text font
relief 'flat' 'flat' 'ridge' 'raised' 'sunken' 'groove' edge relief
borderwidth 2 dimension border width
foreground 'black' X color color of text
background 'lightgrey' X color background color
fill '' 'x' 'y' 'both' 'none' how to expand when resized; default: expand with orient
hlcolor '' X color highlight color with focus
hlbackground '' X color highlight color without focus
hlthickness [] dimension hightlight border thickness
showvalue T boolean display the selected value?



Table 11.11: Scale Events
Event I/O Values Description
background $ \rightarrow$ X color change background color
bind $ \rightarrow$ <X> <G> associate Xevent <X> with Glish event <G>
borderwidth $ \rightarrow$ dimension change border width
end $ \rightarrow$ integer change ending value
font $ \rightarrow$ X font set text font
foreground $ \rightarrow$ X color change foreground color
hlbackground $ \rightarrow$ X color highlight color without focus
hlcolor $ \rightarrow$ X color highlight color with focus
hlthickness $ \rightarrow$ dimension hightlight border thickness
length $ \rightarrow$ integer change length of scale
orient $ \rightarrow$ 'horizontal' 'vertical change orientation
relief $ \rightarrow$ 'flat' 'ridge' 'raised' 'sunken' 'groove' change border relief
resolution $ \rightarrow$ float change resolution of scale
showvalue $ \rightarrow$ boolean show/hide scale value
start $ \rightarrow$ integer change starting value
text $ \rightarrow$ string set scale label
value $ \leftarrow$ integer value changed by user
width $ \rightarrow$ integer change width/height of scale



next up previous contents index
Next: Message Up: Odds and Ends Previous: Label   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-07-18