in reply to how to set tab order in the perl tk?

See Re^8: how can i create a scrollbar in the main window using perl tk

I'm not really a human, but I play one on earth Remember How Lucky You Are
  • Comment on Re: how to set tab order in the perl tk?

Replies are listed 'Best First'.
Re^2: how to set tab order in the perl tk?
by kapsule (Acolyte) on Dec 23, 2008 at 07:42 UTC
    thanks a lot!!zentara.. I have used the second approach in my application.. But still have some problems..See the Code snippet below:-
    my $spane = $mw->Pane(-bg => "orange")->pack(-expand => 1, -fill => 'b +oth') my $scrl_y = $mw -> Scrollbar(-command=>[$spane,'yview']); $spane -> configure(-yscrollcommand=>[$scrl_y,'set']); $spane -> pack(-expand => 1, -fill => "both", -side => "left"); $scrl_y -> pack(-expand => 1, -fill => "y"); #$spane -> focus; $scrl_y -> focus;
    HERE both of the above approaches ($spane -> focus; ,$scrl_y -> focus; ) are not making scrollbar as a default focus. Please help!! Thanks in Advance
      I said earlier manual scrollbars are a PITA, :-( The Scrolled Pane works pretty well, maybe instead of making your own scrollbars, get them from a Scrolled Pane. Try making a Scrolled('Pane'), then extract the scrollbars with $yscrollbar = $spane->Subwidget('yscrollbar'); and same for x.

      If that dosn't work, post a complete minimal code example of what you are trying, and maybe someone will spot a way to make it work.


      I'm not really a human, but I play one on earth Remember How Lucky You Are
        Thanks Zentara!!! I have tried the above approach, but not working. try the code below.
        use strict; use warnings; use Tk; use Tk::Table; use Tk::Pane; use constant COLUMNS => 5; my $mw = MainWindow->new(); $mw -> resizable (0,0); $mw -> geometry ("+10+10"); $mw -> geometry ("750x500"); my $spane = $mw->Scrolled('Pane', -scrollbars => 'oe', -bg => "orange" )->pack(-expand => 1, -fill => 'both'); #my $yscrollbar = $spane->Subwidget('yscrollbar'); #$yscrollbar->focus; my $local_title = $mw->title ("perl: New File"); my $basic_label = $spane->Label ( -text => "Old Names", -font => "verdanafont 10 bold", -relief => "groove" ) -> pack ( -side => "top", -anchor => "nw", -pady => "10", -padx => "5", -ipadx => "5" ); my $table_frame = $spane->Frame ()->pack (-side => "top", -padx => "10 +"); our $table = $table_frame->Table ( -columns => COLUMNS, -rows => 10, -scrollbars => "o", -fixedrows => 1, -fixedcolumns => 1, -relief => 'raised', -pady => "20", -takefocus => "0" ); for my $col_index (1 .. COLUMNS - 1) { my $col_label = $table->Label ( -text => "$col_index", -width => 20, -relief =>'ridge' ); $table->put (0, $col_index, $col_label); } our $table_frame_two = $spane->Frame (); our $table_two = $table_frame_two ->Table ( -columns => COLUMNS, -rows => 10, -scrollbars => "o", -fixedrows => 1, -fixedcolumns => 1, -relief => 'raised', -takefocus => "0", -pady => "5" ); for my $col_index_2 (1 .. COLUMNS - 1) { my $col_label_2 = $table_two->Label(-text => "$col_index_2 ", -wid +th => 20, -relief =>'ridge'); $table_two->put(0, $col_index_2, $col_label_2); } my $button_frame = $spane->Frame (-bg => "red")->pack ( -side => "bottom", -fill => "both", -anchor => "sw", -pady => "10", -padx => "20" ); our $adv_button = $spane->Button ( -text => "New Names", -font => "verdanafont 10 bold", -command => sub { if ($table_frame_two ->ismapped) { $table_frame_two -> packForget(); } else { $table_frame_two -> pack(); } } )->pack ( -side => "top", -anchor => "w", -pady => "15", -padx => "5" ); our $enter_button = $button_frame -> Button ( -text => "Enter", -font => "verdanafont 10 bold" )->pack ( -side => "left", -padx => "5", -ipadx => "5" ); our $exit_button = $button_frame -> Button(-text=>"Exit", -font => "verdanafont 10 bold") -> pack(-side=>"right",-padx=>"5", -ipadx=>"5"); for my $col_entry (1 .. COLUMNS - 1) { for my $row_entry (1 .. 10 - 1) { my $ent = $table->Entry ( -font => "verdana 10", )-> pack ( -ipady => "15"); $table->put ($row_entry,$col_entry,$ent); } } $table->pack (); for my $col_entry_2 (1 .. COLUMNS - 1) { for my $row_entry_2 (1 .. 10 - 1) { my $ent_2 = $table_two->Entry ( -font => "verdana 10", )-> pack ( -ipady => "15"); $table_two->put ($row_entry_2,$col_entry_2,$ent_2); } } $table_two->pack (); MainLoop();
        thanks in advance..