sfinster has asked for the wisdom of the Perl Monks concerning the following question:

Is there a way to change the tab order in a Tk GUI? I can only find one reference in a book (Mastering Perl/Tk) that says to change the tab order you need to rearrange your packing order. I spent a long, frustrating time getting the appearance of my GUI correct, and I only managed it by packing some of the bottom stuff first. I'd hate to have to go back to square one. Barring a method for specifying tab order, is there a layperson's guide to packing somewhere? Fondly thinking of my DevStudio environment where I can click on widgets in the order I want...

Replies are listed 'Best First'.
Re: Tab order in Tk GUI
by Mr. Muskrat (Canon) on Jul 17, 2003 at 16:08 UTC

    If I understand it correctly, you create them in tab order. Then follow up by packing them the way you want them to be laid out with pack, grid or whatever.

    Update: Run this and hit the tab key once the Tk window comes up.

    #!/usr/bin/perl use strict; use warnings; use Tk; my $main = MainWindow->new(-title => 'Focus Test'); my $first = $main->Entry(-text => \1); my $second = $main->Entry(-text => \2); my $third = $main->Entry(-text => \3); $third->pack(-side => 'left'); $second->pack(-side => 'left'); $first->pack(-side => 'left'); MainLoop;

      Thank you. This is absolutely not what my book says, but it appears to work. Now to try it out with my 20-widget GUI...