Home: Perl Programming Help: Win32 Programming Help:
Reseting textfield text



samir_gambler
New User

May 3, 2013, 4:32 AM


Views: 22610
Reseting textfield text

Hello,

I am new to Perl GUI. I am trying to make a window with option to enter login ID and Password. I want to add a button to reset the textfield entry. I am unable to reset the text box entry. please have a look into the code


Code
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;
};

thanks....


samir_gambler
New User

May 3, 2013, 12:06 PM


Views: 22605
Re: [samir_gambler] Reseting textfield text

Well I got the answer. I am writing the answer so that it might be helpful for someone else....

Code
$loginIDTextFields->Text("");