Hello Perlmonks

I want/need to make my Perl/Tk app to accept themes.
Tkx seems the way to go. Yesterday I tried to do the
first conversion, but I was not very successful.
The grid does not behave as expected when placing scrollbars.

My original code:
use Tk; use Tk::HList; use Tk::LabFrame; my $mw = MainWindow->new; my $gui_period_f = $mw->LabFrame( -label => "report month", -labelside => 'acrosstop', -relief => 'groove', -borderwidth => '5' ); my $b_period = $gui_period_f->Button( -text => "change year", -command => sub { &do_select_period }, -foreground => 'darkgrey' ); my $gui_period = $gui_period_f->Scrolled( qw/HList -background grey -scrollbars se -height 5 -width 35/ ); # $gui_period->bind( '<ButtonRelease-1>' => \&show_period ); $gui_period->configure( -selectmode => 'single' ); $gui_period->configure( -browsecmd => \&show_period ); $gui_period->configure( -separator => '+' ); $gui_period_f->grid( -row => 1, -column => 0, -rowspan => 2, -sticky => 'nsew' ); $b_period->grid( -row => 1, -column => 0, -rowspan => 1, -sticky => 'nsew' ); $gui_period->grid( -row => 2, -column => 0, -rowspan => 1, -sticky => 'nsew' ); MainLoop;
This produces: http://img199.imageshack.us/img199/9596/scrolltest.png
A straight conversion to Tkx looks like this:
use Tkx; my $mw = Tkx::widget->new("."); my $gui_period_f = $mw->new_ttk__labelframe( -text => "report period", -labelanchor => 'ne', -relief => 'groove', -borderwidth => '5' ); my $b_period = $gui_period_f->new_ttk__button( -text => "change year", -command => sub { &do_select_period() }, #-foreground => $dark ); my $gui_period = $gui_period_f->new_ttk__treeview( #-background => 'grey', -height => 5, # -width => 35 ); my $gui_period_sbv = $mw->new_ttk__scrollbar( -command => [ $gui_period, "yview" ], -orient => "vertical" ); my $gui_period_sbh = $mw->new_ttk__scrollbar( -command => [ $gui_period, "xview" ], -orient => "horizontal" ); $gui_period->configure( -yscrollcommand => [ $gui_period_sbv, "set" ] +); $gui_period->configure( -xscrollcommand => [ $gui_period_sbh, "set" ] +); $gui_period_f->g_grid( -row => 1, -column => 0, -rowspan => 3, -columnspan => 2, -sticky => 'nwes' ); $b_period->g_grid( -row => 1, -column => 0, -sticky => 'nwes' ); $gui_period->g_grid( -row => 2, -column => 0, -sticky => 'nwes' ); $gui_period_sbv->g_grid( -row => 2, -column => 1, -sticky => 'ns' ); $gui_period_sbh->g_grid( -row => 3, -column => 0, -sticky => 'we' ); Tkx::MainLoop();
The resulting image: http://img194.imageshack.us/img194/503/scrolltesttkx.png

Can someone tell me how to attach scrollbars with Tkx 'the right way'?

Thank you all

In reply to Tkx grid problem by momo33

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.