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

Hi, I have created a small GUI for login window. I want to add the feature of 'tab'. So that if the user click tab key while on one text field it set the focus to next text field which is a typical behavior of a form.
use warnings; use Win32::GUI(); my $MainWindow = Win32::GUI::Window->new( -text => 'Main', -name => 'MainWindow', -pos => [ 10, 10 ], -size => [ 900, 900 ], ); my $loginIDLabel = $MainWindow->AddLabel( -text => "User ID:", -pos => [ 10, 10 ], ); my $loginPassLabel = $MainWindow->AddLabel( -text => "Password:", -pos => [ 10, 40 ], ); my $loginIDTextFields = $MainWindow->AddTextfield( -name => "LoginID", -width => 150, -height => 20, -pos => [60,8], ); my $loginPassTextField = $MainWindow->AddTextfield( -name => "LoginPass", -width => 150, -height => 20, -pos => [60,38], -password => 1, ); my $loginSave = $MainWindow->AddButton( -name => "Save", -text => "Save", -pos => [ 50, 80 ], ); my $loginReset = $MainWindow->AddButton( -name => "Reset", -text => "Reset", -pos => [ 100, 80 ], ); $MainWindow->Show(); Win32::GUI::Dialog(); sub Reset_Click { #wish to reset the textfield content return 0; }; sub Save_Click { #wish to call a subroutine return -1; };
Can any one please suggest how to achieve it. Thanks in advance

Replies are listed 'Best First'.
Re: Adding tab sequence in the GUI created through win32
by roboticus (Chancellor) on May 18, 2013 at 14:20 UTC

    samir_gambler:

    Check out the GUI::Reference::Options pod, there's a "-tabstop" option there which is related to what you want. I don't see how to set the order, though. (It might simply be the order that you add tabstopped controls to the container.) You might want to review the tests for Win32::Gui to see how to use the tabstop option.

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

      Thanks.....It worked...