Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

-expand behaves different in regular function and package (see code)... ned help

0 views
Skip to first unread message

S.Mokhtarzad

unread,
Apr 30, 2003, 11:56:54 PM4/30/03
to
I have been trying to write a module in Tk. I have written it in two ways
1- Normal module and my function (testing) is a sub in the package
2- A Tk module (code provided below)

When I use the module and call the subroutine every thing works the way I
expect it
however, when I use the Tk package code I have the following problem

a- The configure called in the "populate" does not seem to work so long as
the object is packed in "$self"
b- The widgets in the main window do not expand to fill the main window when
it is
resized.

I do not think it is a OS problem but here is my env:


OS = win2k
This is perl, v5.6.1 built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail
Copyright 1987-2001, Larry Wall
Binary build 633 provided by ActiveState Corp. http://www.ActiveState.com
Built 21:33:05 Jun 17 2002

here is the script (testing.pl) file
------------------------------------------
unshift( @INC, '.' );
use Tk;
require testing;

my $top = MainWindow->new;
$top->testing->pack;
MainLoop;
------------------------------------------

here is the module (testing.pm)
package testing;

$VERSION = "1.00" ;

use Tk;
use Tk::widgets qw/Listbox Checkbutton/;
use base qw/Tk::Frame/;
use strict;
Construct Tk::Widget 'testing';
my $option = 1;

sub ClassInit {
my( $class, $mw ) = @_;
$class->SUPER::ClassInit( $mw );
}

sub Populate {
my( $self, $args ) = @_;

$self->SUPER::Populate($args);

my $l = $self->Scrolled( 'Listbox' )->pack( -side => 'top',
-expand => 1,
-fill => 'both'
);

my $cb = $self->Checkbutton->pack( -side => 'left',
-anchor => 'nw',
-expand => 1,
-fill => 'x'
);

$l->configure( -background => 'white',
-relief => 'sunken'
);

$cb->configure( -text => 'Test checkbutton',
-variable => \$option
);
}

1;
-----------------------------------------------

Regards,
Shahriar Mokhtarzad :-)


0 new messages