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!

Question about using scrollbars with Tk in Perl

Status
Not open for further replies.

comma

Programmer
Feb 12, 2003
24
FI
Hi!

I'm developing an application with Perl/Tk. The application should be a simple form, which is dynamically generated from xml-contents and then the user can modify the fields and save the modifications to xml-file.

How can I add scrollbar to the window if the form gets so big that it doesn't fit into window. Should the scrollbar be attached to canvas? Do you have any links or examples?

Thank you!

-comma-
 
I can't help you for perl, but I can show you how to do with tcl.
Code:
  cancas.c     -xscrollcommand { .hs set }     -yscrollcommand { .vs set }
  scrollbar .hs -command { .ht xview } -orient horizontal
  scrollbar .vs -command { .ht yview }
  grid .ht -row 0 -column 0 -sticky nsew
  grid .vs -row 0 -column 1 -sticky nse
  grid .hs -row 1 -column 0 -sticky sew
  grid rowconfigure . 0 -weight 1
  grid columnconfigure . 0 -weight 1
This code will create the canvas and its scroll bars.
All can grow & shrink automagicaly.
You can also use pack.

HTH

ulis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top