Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

another scale label

Status
Not open for further replies.

sl1200mk2

Technical User
Jun 7, 2005
39
FR
hi bong
hi others

i'm still using your proc for displaying many scale (a little bit modified).
i've just remove a part for the < 10 number (now, the only choice is x*10)
here's the proc

proc MakeSub {} {
#a frame for the scales
destroy $Dlightsub::local
pack [frame $Dlightsub::local -borderwidth 6 -bg black] -side top
set numRows [expr {$Dlightsub::nbr/10}]

pack [frame $Dlightsub::local.r] -side bottom

for {set r 0} {$r<$numRows} {incr r} {
pack [frame $Dlightsub::local.$r] -side top
for {set i 0} {$i<10} {incr i} {
pack [scale $Dlightsub::local.$r.$i -variable "sub $r$i" -from 100 -to 0 -length 150 -command [list scale_command "sub $r$i"]] -side left
bind $Dlightsub::local.$r.$i <ButtonPress-1><Motion> letsgo
}
}
}

now i would like to display a label for each scale with the "sub $r$i" as text.
i've tried with -label from scale command, but text is displayed at the top right corner. this take many space.... too much space.

i would like to insert the "sub $r$i" label just at the top of the corresponding scale.
can you help me to do that

many thanks
nico
 
The best I can suggest is to pack in another frame, say, fs1. Then, in that frame, pack in a label: pack [label <path>.fs1.l1 -text "sub $r$i"] -side top. Then, underneath the label, pack in your scale.

_________________
Bob Rashkin
rrashkin@csc.com
 
hi bong
once again you were right, i've made

for {set r 0} {$r<$numRows} {incr r} {
pack [frame $Dlightsub::local.$r] -side top
pack [frame $Dlightsub::local.f$r] -fill x -in $Dlightsub::local.$r
for {set i 0} {$i<10} {incr i} {
pack [scale $Dlightsub::local.$r.$i -variable "sub $r$i" -bd 5 -from 100 -to 0 -length 150 -command [list scale_command "sub $r$i"]] -side left
pack [label $Dlightsub::local.f$r.$i -text " $r$i"] -side left -fill x -expand 1
bind $Dlightsub::local.$r.$i <ButtonPress-1><Motion> letsgo
}
}

and the result is quite good
thanks
 
another thing:
how hard would it be to add a scrolled frame to this proc?

++
nico
 
Not hard but outside the basic Tk widgets. Look at the help file for BWidgets; specifically the scrollableFrame.

_________________
Bob Rashkin
rrashkin@csc.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top