use strict; use warnings; use Win32::GUI; $| = 1; # Important! - Turn off buffering my $W1 = Win32::GUI::Window->new( -name => 'W1', -title => 'PerlMonks_494615', -pos => [ 100, 100 ], -size => [ 300, 200 ], ); my $T1 = $W1->AddTextfield( -name => 'T1', -text => '', -left => 10, -top => 10, -width => 200, -height => 25, -prompt => ['T1:', 80], ); my $T2 = $W1->AddTextfield( -name => 'T2', -text => '', -left => 10, -top => 35, -width => 200, -height => 25, -prompt => ['T2:', 80], ); $W1->Show(); print "$_->{-name}\t$_->{-handle}\n" foreach $W1, $T1, $T2; Win32::GUI::Dialog(); sub T1_GotFocus { print "\nT1_GotFocus - ",$W1->GetFocus(), "\n"; } sub T2_GotFocus { print "\nT2_GotFocus - ",$W1->GetFocus(), "\n"; } sub T1_LostFocus { print "\nT1_LostFocus - ",$W1->GetFocus(); } sub T2_LostFocus { print "\nT2_LostFocus - ",$W1->GetFocus(); }