Fellow monks,

A while back I wrote an image map program in Perl for a project in a Perl class I took. Well I went to use it on a large graphic the other day and discovered a minor flaw, so needless to say I'm in the process of fixing it now. :)

My problem is with the scrollbars. They are showing up as advertised, but they're filling the entire canvas space and I can't figure out exactly how to set it to a percentage of the canvas width.

My frame is set to 800 x 600, and the canvas is based on the size of the GIF file that it's reading. If it's larger than 300 pixels either way, the value is set to 300 pixels.

The code I'm working with is this:

my $tcanvas=$top->Scrolled("Canvas", -scrollbars => 'ow', -scrollbars => 's', -bg=>'white', -height=>$height, -width=>$width, -border=>0, -cursor=>'crosshair', )->place( -x=>325, -y=>30, ); my $canvas = $tcanvas->Subwidget("canvas");

My graphic is about 200 x 700 and when I try it with the program, I get the bottom scroll bar, but not the side bar, which is what I would expect as I've set it that way. But the bottom scrollbar fills the entire area on the bottom. Using the arrow bits on either side does move the graphic along fine.

Is there something that I haven't set in my scrollbar? I looked in the Perl/Tk book but that wasn't much help unless I overlooked something obvious.

Thanks in advance!

There is no emoticon for what I'm feeling now.


In reply to TK Scrollbars not working correctly by Popcorn Dave

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.