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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scrollable checkbutton frame

Status
Not open for further replies.

Adri84

IS-IT--Management
Apr 26, 2010
1
CH
Hello,
I am trying to create a scrollable checkbutton frame.
So far, I managed to have something working but the scrollbar only partially follows the list of buttons. What I do is this:

#main frame frAgents
frame .frAgents
#3 frames in fragents: frLeft, frCentral, frRight
grid [frame .frAgents.frLeft -borderwidth 2 -relief groove] \
-in .frAgents -row 1 -column 1 -sticky n,s -pady 10
grid [frame .frAgents.frCentral -borderwidth 2 -relief groove] \
-in .frAgents -row 1 -column 2 -sticky n,s -pady 10
grid [frame .frAgents.frRight -borderwidth 2 -relief groove] \
-in .frAgents -row 1 -column 3 -sticky n,s -pady 10

grid rowconfigure .frAgents.frLeft 2 -weight 2

grid [label .frAgents.frLeft.lR -text "Agents"] \
-in .frAgents.frLeft -row 1 -column 1 -sticky e,w

grid rowconfigure .frAgents.frRight 2 -weight 1

grid [label .frAgents.frRight.lUsers -text "Users"] \
-in .frAgents.frRight -row 1 -column 1 -sticky n,e,w -columnspan 2


# Canvas in frRight called lbUsers
grid [canvas .frAgents.frRight.lbUsers -borderwidth 2 -width 200 -relief groove\
-yscrollcommand {.frAgents.frRight.sb set} \
-xscrollcommand {.frAgents.frRight.sbx set}] \
-in .frAgents.frRightUsers -row 2 -column 1 -sticky n,s,e,w

# frame .frAgents.frRight.lbUsers.button
frame .frAgents.frRight.lbUsers.buttons

# window .frAgents.frRight.lbUsers.button inside .frAgents.frRight.lbUsers

.frAgents.frRight.lbUsers create window 10 10 -anchor nw -window .frAgents.frRight.lbUsers.buttons

#creates the buttons with all the users
foreach user $users {
checkbutton .frAgents.frRight.lbUsers.buttons.c$user -text $user -variable users_var($user) -anchor w
pack .frAgents.frRight.lbUsers.buttons.c$user -anchor w -padx 2 -pady 1
}

# create the scrollbars in .frAgents.frRightUsers
grid [scrollbar .frAgents.frRight.sb -orient vertical \
-command {.frAgents.frRight.lbUsers yview}] \
-in .frAgents.frRightUsers -row 2 -column 2 -sticky n,s
grid [scrollbar .frAgents.frRight.sbx -orient horizontal \
-command {.frAgents.frRight.lbUsers xview}] \
-in .frAgents.frRightUsers -row 3 -column 1 -sticky w,e

pack .frAgents -fill both -padx 2 -pady 2 -expand true

Any ideas of what is wrong?
Thanks
Adriana
 
Not really but it's so convoluted. Why don't you use BWidgets' ScrollableFrame?

_________________
Bob Rashkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top