Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 231019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:53:53+00:00 2026-05-11T19:53:53+00:00

The following code produces pretty much what I want, but the scrollable pane on

  • 0

The following code produces pretty much what I want, but the scrollable pane on the left doesn’t scroll. I am using ActivePerl 5.8.9 Build 825:

The code is:

use Tk;
use Tk::Pane;
use Tk::LabFrame;

# create the application window
my $MW = MainWindow->new ( -background => "GREY" );

# set the x/y size for the window
$MW->geometry("800x600");

# add a window title
$MW->title("Monitor Boxes");

# Disallow window resizing
$MW->resizable(0,0);

# create a labelled frame on the window to house the list of buttons to be pressed
$boxListFrame = &create_framed_section( "List Of Boxes", 
                    "acrosstop", 
                    5, 
                    5, 
                    170, 
                    565,
                    "BLUE", 
                    "GREY");

# create a labelled frame on the window to house the information to be displayed 
# when a particular button is pressed
$statusOfBoxFrame = &create_framed_section( "Status", 
                        "acrosstop", 
                        185, 
                        5, 
                        600, 
                        565, 
                        "BLUE", 
                        "GREY");

# create a scrollable pane in the left hand pane so that if more buttons than 
# is able to be displayed are put onto the application the scroll bar will allow 
# the ones not displayed to be access
my $pane = $MW->Scrolled(   'Pane', 
                -scrollbars => 'e', 
                -width => 140, 
                -height => 555, 
                -background => "GREY")->place(-x=>15,-y=>25);

# setup the array of buttons
@boxes = ("BUTTON1", "BUTTON2", "BUTTON3", "BUTTON4", "BUTTON5", "BUTTON6", "BUTTON7", "BUTTON8", "BUTTON9", "BUTTON10", "BUTTON11", "BUTTON12", "BUTTON13", "BUTTON14", "BUTTON15", "BUTTON16");

# put the buttons onto the scrollable pane in the frame on the window (LOL)
DisplayCheckButtons( $pane, @boxes);

# wait until the user exits the app
MainLoop;

# exit the app
exit 0;

sub DisplayCheckButtons 
{
    my ( $parent, @names ) = @_;
    $Frame->destroy if $Frame;
    $Frame = $parent->Frame(    -width => 160, 
                    -height => 555, 
                    -background => "GREY")->place(-x=>15,-y=>15);

    $xpos = 5;
    $ypos = 5;

    foreach $box (@names)
    {
        $buttons->{$box} = $Frame->Button(-text => $box)->place(-x=>$xpos,-y=>$ypos);

        $ypos = $ypos + 40;

    }
}

sub create_framed_section
{
    # get the parameters
    my($label, $labelside, $posX, $posY, $width, $height, $fontColour, $backgroundColour) = @_;

    # create the item in the desired position with supplied information
    $frame = $MW->LabFrame( -label      => $label,
                -labelside  => $labelside,
                -width      => $width,
                -height     => $height,
                -foreground => $fontColour,
                -background => $backgroundColour,
                )->place(-x=>$posX,-y=>$posY);

    return $frame;
}

I hope that someone can point out the minor thing that I have missed from this and end my frustration.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T19:53:54+00:00Added an answer on May 11, 2026 at 7:53 pm

    A few observations first: Your code is not strict safe which makes debugging harder. You are also not calling pack on any of your widgets. You shouldn’t use an ampersand before the sub name when invoking subs unless you know its effects and want them — see perldoc perlsub for details.

    The widths of the three panels add up to more than 800. The layout you want is not that clear.

    Now, here is some code (stolen from PerlMongers) that creates a scrollable pane with a bunch of buttons:

    #!/usr/bin/perl
    
    use strict;
    use warnings;
    
    use Tk;
    use Tk::Pane;
    
    my $top = MainWindow->new;
    $top->Label(-text => "Enter the scroll frame")->pack;
    
    my $frame = $top->Scrolled(
        'Frame',
        -scrollbars => "e",
    )->pack;
    
    $frame->Button(-text => "BUTTON $_")->pack for ( 1 .. 16 );
    
    MainLoop;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following code produces wrong and inconsistent output with gcc (4.1.2 20080704) but correct
The following code produces a lvalue required as left operand of assignment if( c
The following code produces the image that follows. The image I am using for
The following code produces an error hr=0x80020005 (wrong type). #import <msi.dll> using namespace WindowsInstaller;
The following code produces a ListView with the names of the customers: private void
The following code produces the result I don't understand this. Any ideas why? If
I have the following code that produces a background image in a table cell.
The following code: ref class A { private: int% referenceToAnInt; }; produces the following
Given the following code: var a = 'somegarbage=http://somesite.com/foo/bar/&moregarbage'; var result = a.match(/http.+\//g); Produces the
I have a select query that currently produces the following results: Description Code Price

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.