FW: Scrollbar on main window

FW: Scrollbar on main window

am 27.08.2009 12:59:52 von Tony Bass

Gisle,

Yesterday was way too long, please note that I actually attached the
code this time. I will post this to the list also for posterity's sake.

Sorry to get back to you off the list but I implemented the following
snippet (grossly reduced app) and it works fine on my xp sp3 box, a test
xp sp2, and my win 2003 server but on any of my clients servers or pc's
(4 so far) I've tried it on it hangs, never shows the interface and eats
up 50% CPU until it is killed. Makes no difference whether I run it on
the command line via perl or compiled via perlapp. I pull the code for
BWidget out and it works fine. When I run it through debug it seems to
be getting into an endless loop after it branches into the Tkx module.
Any ideas on where to look would be greatly appreciated.

------ Start Code -------
#!c:/perl/bin -w
use strict ("vars");
use warnings;
use Tkx;

Tkx::package_require("BWidget");

my $mwb = Tkx::widget->new(".");
$mwb->g_wm_geometry("+0+0");
my $mws = $mwb->new_ScrolledWindow();
$mws->g_grid();
my $mwsf = $mws->new_ScrollableFrame(-width=> 1024, -height=> 782);
$mws->setwidget($mwsf);
my $mw = Tkx::widget->new($mwsf->getframe);

$mwb->g_wm_title("Some Title");

(my $nb = $mw->new_ttk__notebook(-height => 758, -width =>
1024))->g_grid();

Tab1();
Tab2();

Tkx::MainLoop();


sub Tab1 {
my $tab1 = $nb->new_ttk__frame(-padding => "10");
}
sub Tab2 {
my $tab2 = $nb->new_ttk__frame(-padding => "1");
$nb->add($tab2, -text => 'Sales', -state=>'normal');
}

--------End Code---------

Thanks,

Tony Bass

-----Original Message-----
From: Gisle Aas [mailto:gisle@activestate.com]
Sent: Tuesday, August 25, 2009 9:31 AM
To: Ken Slater
Cc: Tony W. Bass; activeperl@listserv.ActiveState.com
Subject: Re: Scrollbar on main window


On Aug 25, 2009, at 16:53 , Ken Slater wrote:

> At 04:37 PM 8/23/2009, Tony W. Bass wrote:
>> Content-class: urn:content-classes:message
>> Content-Type: multipart/alternative;
>> boundary="----_=_NextPart_001_01CA2431.805F7A3E"
>>
>> Can anyone tell me how to make the entire tkx window scrollable?
>>
>> my $mw = Tkx::widget->new(".");
>>
>> My application takes a lot of screen space and I need to make it
>> scrollable if the users screen resolution is not set high enough.
>>
>> I am starting to pull out what little hair I have left over this.
>>
>> Many Thanks,
>>
>> Tony
>> _______________________________________________
>
> This may help. I'm new to Tkx and was trying to convert some Tk code.
> I finally got a scrollbar to work in this example.
> Ken

Thanks. I've taken the liberty of cleaning up your example a bit.
That gives me the following program.

--Gisle


#!/usr/bin/perl
# Example of scrollable frame in Perl using the
# Tkx module. Based on Tcl code at http://wiki.tcl.tk/1091.

use strict;
use warnings;
use Tkx;
Tkx::package_require("BWidget"); # new_ScrolledWindow

my $mw = Tkx::widget->new('.');

my $mws = $mw->new_ScrolledWindow();
$mws->g_pack(-expand => 1, -fill => "both");

my $mwsf = $mws->new_ScrollableFrame();
$mws->setwidget($mwsf);

# Fill this frame instead of $mw directly
my $mwf = Tkx::widget->new($mwsf->getframe);

for my $idx ( 1 .. 60 ) {
$mwf->new_checkbutton(
-text => $idx,
)->g_pack(-side=>'top', -anchor=>'w');
}

Tkx::MainLoop();

__END__
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: Scrollbar on main window

am 27.08.2009 20:18:25 von Gisle Aas

On Aug 27, 2009, at 12:59 , Tony W. Bass wrote:

> Gisle,
>
> Yesterday was way too long, please note that I actually attached the
> code this time. I will post this to the list also for posterity's
> sake.
>
> Sorry to get back to you off the list but I implemented the following
> snippet (grossly reduced app) and it works fine on my xp sp3 box, a
> test
> xp sp2, and my win 2003 server but on any of my clients servers or
> pc's
> (4 so far) I've tried it on it hangs, never shows the interface and
> eats
> up 50% CPU until it is killed. Makes no difference whether I run it on
> the command line via perl or compiled via perlapp. I pull the code for
> BWidget out and it works fine. When I run it through debug it seems to
> be getting into an endless loop after it branches into the Tkx module.
> Any ideas on where to look would be greatly appreciated.

I don't really see anything wrong with it, but it does seem odd to
have scrollbars outside of a notebook. Isn't that something you want
to have inside on those tabs where it's required.

--Gisle


>
> ------ Start Code -------
> #!c:/perl/bin -w
> use strict ("vars");
> use warnings;
> use Tkx;
>
> Tkx::package_require("BWidget");
>
> my $mwb = Tkx::widget->new(".");
> $mwb->g_wm_geometry("+0+0");
> my $mws = $mwb->new_ScrolledWindow();
> $mws->g_grid();
> my $mwsf = $mws->new_ScrollableFrame(-width=> 1024, -height=> 782);
> $mws->setwidget($mwsf);
> my $mw = Tkx::widget->new($mwsf->getframe);
>
> $mwb->g_wm_title("Some Title");
>
> (my $nb = $mw->new_ttk__notebook(-height => 758, -width =>
> 1024))->g_grid();
>
> Tab1();
> Tab2();
>
> Tkx::MainLoop();
>
>
> sub Tab1 {
> my $tab1 = $nb->new_ttk__frame(-padding => "10");
> }
> sub Tab2 {
> my $tab2 = $nb->new_ttk__frame(-padding => "1");
> $nb->add($tab2, -text => 'Sales', -state=>'normal');
> }
>
> --------End Code---------
>
> Thanks,
>
> Tony Bass
>
> -----Original Message-----
> From: Gisle Aas [mailto:gisle@activestate.com]
> Sent: Tuesday, August 25, 2009 9:31 AM
> To: Ken Slater
> Cc: Tony W. Bass; activeperl@listserv.ActiveState.com
> Subject: Re: Scrollbar on main window
>
>
> On Aug 25, 2009, at 16:53 , Ken Slater wrote:
>
>> At 04:37 PM 8/23/2009, Tony W. Bass wrote:
>>> Content-class: urn:content-classes:message
>>> Content-Type: multipart/alternative;
>>> boundary="----_=_NextPart_001_01CA2431.805F7A3E"
>>>
>>> Can anyone tell me how to make the entire tkx window scrollable?
>>>
>>> my $mw = Tkx::widget->new(".");
>>>
>>> My application takes a lot of screen space and I need to make it
>>> scrollable if the users screen resolution is not set high enough.
>>>
>>> I am starting to pull out what little hair I have left over this.
>>>
>>> Many Thanks,
>>>
>>> Tony
>>> _______________________________________________
>>
>> This may help. I'm new to Tkx and was trying to convert some Tk code.
>> I finally got a scrollbar to work in this example.
>> Ken
>
> Thanks. I've taken the liberty of cleaning up your example a bit.
> That gives me the following program.
>
> --Gisle
>
>
> #!/usr/bin/perl
> # Example of scrollable frame in Perl using the
> # Tkx module. Based on Tcl code at http://wiki.tcl.tk/1091.
>
> use strict;
> use warnings;
> use Tkx;
> Tkx::package_require("BWidget"); # new_ScrolledWindow
>
> my $mw = Tkx::widget->new('.');
>
> my $mws = $mw->new_ScrolledWindow();
> $mws->g_pack(-expand => 1, -fill => "both");
>
> my $mwsf = $mws->new_ScrollableFrame();
> $mws->setwidget($mwsf);
>
> # Fill this frame instead of $mw directly
> my $mwf = Tkx::widget->new($mwsf->getframe);
>
> for my $idx ( 1 .. 60 ) {
> $mwf->new_checkbutton(
> -text => $idx,
> )->g_pack(-side=>'top', -anchor=>'w');
> }
>
> Tkx::MainLoop();
>
> __END__
> _______________________________________________
> ActivePerl mailing list
> ActivePerl@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

RE: Scrollbar on main window

am 27.08.2009 21:54:10 von Tony Bass

It's on the outside because I was trying to have the entire program have
scrollbars in case the screen resolution was too low for the program, in
this case the screen is 1024x768 which should be the lowest resolution
but in case someone has it set to 800x600 I wanted to be able to have
them access all the fields and controls. I'm not sure it's absolutely
necessary but I got it working fairly well until I tried to run it on
the clients machines where it hung before displaying anything. If I pull
out the the ScrolledWindow code it all runs fine. Very odd and hopefully
it doesn't affect the entire BWidget set because there are a few other
widgets in the I wanted to look at.

In another question, do you know of any editable grid or tree that works
with Tkx? Perl-Tk used to have a nice one but I can't find an equivalent
widget in TCl accessible via Tkx.

Again Thanks for your help.

Tony

-----Original Message-----
From: Gisle Aas [mailto:gisle@activestate.com]
Sent: Thursday, August 27, 2009 11:18 AM
To: Tony W. Bass
Cc: activeperl@listserv.ActiveState.com
Subject: Re: Scrollbar on main window

On Aug 27, 2009, at 12:59 , Tony W. Bass wrote:

> Gisle,
>
> Yesterday was way too long, please note that I actually attached the
> code this time. I will post this to the list also for posterity's
> sake.
>
> Sorry to get back to you off the list but I implemented the following
> snippet (grossly reduced app) and it works fine on my xp sp3 box, a
> test
> xp sp2, and my win 2003 server but on any of my clients servers or
> pc's
> (4 so far) I've tried it on it hangs, never shows the interface and
> eats
> up 50% CPU until it is killed. Makes no difference whether I run it on
> the command line via perl or compiled via perlapp. I pull the code for
> BWidget out and it works fine. When I run it through debug it seems to
> be getting into an endless loop after it branches into the Tkx module.
> Any ideas on where to look would be greatly appreciated.

I don't really see anything wrong with it, but it does seem odd to
have scrollbars outside of a notebook. Isn't that something you want
to have inside on those tabs where it's required.

--Gisle


>
> ------ Start Code -------
> #!c:/perl/bin -w
> use strict ("vars");
> use warnings;
> use Tkx;
>
> Tkx::package_require("BWidget");
>
> my $mwb = Tkx::widget->new(".");
> $mwb->g_wm_geometry("+0+0");
> my $mws = $mwb->new_ScrolledWindow();
> $mws->g_grid();
> my $mwsf = $mws->new_ScrollableFrame(-width=> 1024, -height=> 782);
> $mws->setwidget($mwsf);
> my $mw = Tkx::widget->new($mwsf->getframe);
>
> $mwb->g_wm_title("Some Title");
>
> (my $nb = $mw->new_ttk__notebook(-height => 758, -width =>
> 1024))->g_grid();
>
> Tab1();
> Tab2();
>
> Tkx::MainLoop();
>
>
> sub Tab1 {
> my $tab1 = $nb->new_ttk__frame(-padding => "10");
> }
> sub Tab2 {
> my $tab2 = $nb->new_ttk__frame(-padding => "1");
> $nb->add($tab2, -text => 'Sales', -state=>'normal');
> }
>
> --------End Code---------
>
> Thanks,
>
> Tony Bass
>
> -----Original Message-----
> From: Gisle Aas [mailto:gisle@activestate.com]
> Sent: Tuesday, August 25, 2009 9:31 AM
> To: Ken Slater
> Cc: Tony W. Bass; activeperl@listserv.ActiveState.com
> Subject: Re: Scrollbar on main window
>
>
> On Aug 25, 2009, at 16:53 , Ken Slater wrote:
>
>> At 04:37 PM 8/23/2009, Tony W. Bass wrote:
>>> Content-class: urn:content-classes:message
>>> Content-Type: multipart/alternative;
>>> boundary="----_=_NextPart_001_01CA2431.805F7A3E"
>>>
>>> Can anyone tell me how to make the entire tkx window scrollable?
>>>
>>> my $mw = Tkx::widget->new(".");
>>>
>>> My application takes a lot of screen space and I need to make it
>>> scrollable if the users screen resolution is not set high enough.
>>>
>>> I am starting to pull out what little hair I have left over this.
>>>
>>> Many Thanks,
>>>
>>> Tony
>>> _______________________________________________
>>
>> This may help. I'm new to Tkx and was trying to convert some Tk code.
>> I finally got a scrollbar to work in this example.
>> Ken
>
> Thanks. I've taken the liberty of cleaning up your example a bit.
> That gives me the following program.
>
> --Gisle
>
>
> #!/usr/bin/perl
> # Example of scrollable frame in Perl using the
> # Tkx module. Based on Tcl code at http://wiki.tcl.tk/1091.
>
> use strict;
> use warnings;
> use Tkx;
> Tkx::package_require("BWidget"); # new_ScrolledWindow
>
> my $mw = Tkx::widget->new('.');
>
> my $mws = $mw->new_ScrolledWindow();
> $mws->g_pack(-expand => 1, -fill => "both");
>
> my $mwsf = $mws->new_ScrollableFrame();
> $mws->setwidget($mwsf);
>
> # Fill this frame instead of $mw directly
> my $mwf = Tkx::widget->new($mwsf->getframe);
>
> for my $idx ( 1 .. 60 ) {
> $mwf->new_checkbutton(
> -text => $idx,
> )->g_pack(-side=>'top', -anchor=>'w');
> }
>
> Tkx::MainLoop();
>
> __END__
> _______________________________________________
> ActivePerl mailing list
> ActivePerl@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: Scrollbar on main window

am 27.08.2009 22:44:53 von Gisle Aas

On Aug 27, 2009, at 21:54 , Tony W. Bass wrote:

> In another question, do you know of any editable grid or tree that
> works
> with Tkx? Perl-Tk used to have a nice one but I can't find an
> equivalent
> widget in TCl accessible via Tkx.

Not sure what your requirements are. For some of the PDK tools we
used the treectrl[1] widget. It seems quite flexible and should be
available out of the box with ActivePerl. The tktable[2] is another
possibility that also ships with ActivePerl.

--Gisle


[1] http://wiki.tcl.tk/6064
[2] http://aspn.activestate.com/ASPN/docs/ActiveTcl/tktable/tkTa ble.html
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

RE: Scrollbar on main window

am 01.09.2009 16:26:04 von Tony Bass

I need a basic 3 column grid where 1 column is editable, i.e. Quantity,
Description, Price where the description and price are set readonly and
the quantity is input. The tktable widget looks like a good match. Is
there an example of how it get data in and out of the widget with perl
available anywhere, I am having a problem with translating the tcl doc's
and creating a tcl array in perl.

Thanks,

Tony

-----Original Message-----
From: Gisle Aas [mailto:gisle@activestate.com]
Sent: Thursday, August 27, 2009 1:45 PM
To: Tony W. Bass
Cc: activeperl@listserv.ActiveState.com
Subject: Re: Scrollbar on main window

On Aug 27, 2009, at 21:54 , Tony W. Bass wrote:

> In another question, do you know of any editable grid or tree that
> works
> with Tkx? Perl-Tk used to have a nice one but I can't find an
> equivalent
> widget in TCl accessible via Tkx.

Not sure what your requirements are. For some of the PDK tools we
used the treectrl[1] widget. It seems quite flexible and should be
available out of the box with ActivePerl. The tktable[2] is another
possibility that also ships with ActivePerl.

--Gisle


[1] http://wiki.tcl.tk/6064
[2] http://aspn.activestate.com/ASPN/docs/ActiveTcl/tktable/tkTa ble.html
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs