| Version 1.9 Build 1481
|
|
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
 |
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 |
 |
X color |
change background color |
|
bind |
 |
<X> <G> |
associate Xevent <X> with Glish event <G> |
|
borderwidth |
 |
dimension |
change border width |
|
end |
 |
integer |
change ending value |
|
font |
 |
X font |
set text font |
|
foreground |
 |
X color |
change foreground color |
|
hlbackground |
 |
X color |
highlight color without focus |
|
hlcolor |
 |
X color |
highlight color with focus |
|
hlthickness |
 |
dimension |
hightlight border thickness |
|
length |
 |
integer |
change length of scale |
|
orient |
 |
'horizontal' 'vertical |
change orientation |
|
relief |
 |
'flat' 'ridge' 'raised' 'sunken' 'groove' |
change border relief |
|
resolution |
 |
float |
change resolution of scale |
|
showvalue |
 |
boolean |
show/hide scale value |
|
start |
 |
integer |
change starting value |
|
text |
 |
string |
set scale label |
|
value |
 |
integer |
value changed by user |
|
width |
 |
integer |
change width/height of scale |
|
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