gpilling has asked for the wisdom of the Perl Monks concerning the following question:

I instantiate scrollbars in my perl/Tk script in what I have always thought was the standard way:

$maincanvas = $main->Scrolled(qw/Canvas -bg white -height 600 -width 1 +200 -borderwidth 0 -scrollbars se -scrollregion/ => ['0', '0', $scro +llwidth, $scrollheight]) ->pack(@pl), DisplayGroup();

However, the scroll bars end up being extremely wide. I am using perl version 5.18.4, and I am working in a UNIX environment.

Has anyone else encountered this issue?

Any ideas on how to reduce the width of the scrollbars?

Thanks in advance!

Geoff

Replies are listed 'Best First'.
Re: wide scrollbars
by kcott (Archbishop) on Nov 04, 2016 at 22:04 UTC

    G'day Geoff,

    Welcome to the Monastery.

    As others have noted, you haven't provided sufficient information for us to provide a concrete solution. Having said that, this part looks wrong to me:

    ... ->pack(@pl), DisplayGroup();

    Perhaps one of these two was intended:

    ... ->pack(@pl); DisplayGroup(); ... ->pack(@pl, DisplayGroup());

    [With respect to fixing the bogus link caused by use of 'pre' (instead of 'code') tags, see "Writeup Formatting Tips" and "How do I change/delete my post?".]

    — Ken

      It seems I found the source of the issue. It seems nothing was wrong with the perl code, but with the VNC session and its windows handler.

      Thank you to everyone who provided feedback!

      Geoff

Re: wide scrollbars
by tybalt89 (Monsignor) on Nov 04, 2016 at 21:11 UTC

    After guessing at values that you did not provide, it worked fine for me.

    Please provide (in a code block) the complete program of the smallest possible example that fails for you.

      Hi, and thanks for the response!

      Below is the smallest possible example that fails for me. Any ideas on what I might be doing wrong?

      Thanks in advance!

      Geoff

      #!/bin/sh #! -*- perl -*- eval 'exec /import/hstools/local/perl/perl-5.18.4/bin/perl -x $0 ${1+" +$@"}' if 0; use Tk; $scrollwidth = 6000; $scrollheight = 2200; my $main = new MainWindow; $maincanvas = $main->Scrolled(qw/Canvas -bg white -height 600 -width 1 +200 -borderwidth 0 -scrollbars se -scrollregion/ => ['0', '0', $scro +llwidth, $scrollheight]) ->pack(@pl); MainLoop;
        What do you mean by "wide exactly"? You're setting the scrollregion at $scrollwidth = 6000, that means the canvas size is 6000, screen can only show ~1200 of the canvas, but its at least 6000 wide, so the scroll bar scrolls
Re: wide scrollbars
by Lotus1 (Vicar) on Nov 04, 2016 at 20:30 UTC
     $maincanvas = $main->Scrolled(qw/Canvas -bg white -height 600 -width 1200 -borderwidth 0 -scrollbars se -scrollregion/ => '0', '0', $scrollwidth, $scrollheight) ->pack(@pl), DisplayGroup(); 

    Instead of putting your code inside of <pre>...</pre>tags try putting it in <code> </code> or <c> </c> tags. Then your square brackets for the anonymous array will show up instead of making a broken link.

Re: wide scrollbars
by Anonymous Monk on Nov 04, 2016 at 20:16 UTC
    What are scrollheight/scrollwidth?