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

Scrolling and Buttons

Status
Not open for further replies.

mgeurts

Programmer
Apr 30, 2002
13
US
I've noticed this question has already been asked, but here it goes again: I have a long list of buttons, and I would like to show only five of them, and make the other ones scrollable. However, whenever I try to set a height on how tall the frame is, it never works. It just makes the frame larger to show all of the buttons. How could I get around this little difficulty? Thanks in advance for any input.

Mark
 
The most basic way is to put the buttons on a scrollable canvas. There are some scrollable frames in Iwidgets but just using basic Tcl/Tk you can't scroll a frame. Bob Rashkin
rrashkin@csc.com
 
Can I use "$canvas = $main->Canvas(-scrollregion=>"?
How do I input the four coordinates?

Mark
 
I don't recognize your syntax. To set up the canvas, do something like:
scrollbar $w.hscroll -orient horiz -command "$c xview"
scrollbar $w.vscroll -command "$c yview"
canvas $c -relief sunken -borderwidth 2 -scrollregion {-11c -11c 50c 20c} -xscrollcommand "$w.hscroll set" -yscrollcommand "$w.vscroll set"
pack $w.grid -expand yes -fill both -padx 1 -pady 1

Then you can put buttons on like:
button $c.button -text "Press Me" -command "whatever"
$c create window 21c 18c -window $c.button -anchor nw
Bob Rashkin
rrashkin@csc.com
 
Ah, you're using PerlTk, not Tcl/Tk. Although there might be a few people on this forum who use both and could answer your question, I suspect you're more likely to find PerlTk users in the Perl forum. - Ken Jones, President
Avia Training and Consulting
866-TCL-HELP (866-825-4357) US Toll free
415-643-8692 Voice
415-643-8697 Fax
 
Sorry, I forgot to mention that. Although, I think Bong answered my question. Thanks again guys for your input.

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top