Hello,
I am currently trying to design a simple Perl program with Win32::GUI. I have a main window which contains a button leading to a sub window, with an text input field. When the program is started, the first user input is displayed correctly to the console after pushing the submit button. If the sub window is called again in the same season, no new input is being accepted, its always the first input only which is getting displayed. Does anyone know how to solve that problem?
Thanks in advance.
OS: Win 7 32-Bit,
Code used:
use strict;
use Win32::GUI();
$| = 1;
sub MAIN{
my $main = Win32::GUI::Window->new(-width => 840, -height => 480,
+-text => 'Main', -name => 'Main');
$main->AddButton(-width => 130, -height => 60, -text => 'Sub', -po
+s => [100,100], -name => 'Sub');
$main->AddButton(-width => 66, -height => 24, -text => 'Exit', -po
+s => [750,410], -name => 'Exit');
$main->Show();
Win32::GUI::Dialog();
sub Sub_Click { ADD(); }
sub Exit_Click { $main->Hide(); system.exit(0); -1; }
sub main_Terminate { $main->Hide(); system.exit(0); -1; }
}
sub ADD{
my $add = Win32::GUI::Window->new(-width => 840, -height => 480, -
+text => 'Add', -name => 'add');
$add->Show();
$add->AddTextfield(-text => 'Input', -width => 360, -height => 130
+, -pos => [100,100], -name => 'input');
$add->AddButton(-width => 130, -height => 60, -text => 'Submit', -
+pos => [100,300], -name => 'Submit');
$add->AddButton(-width => 66, -height => 24, -text => "Back", -pos
+ => [750,410], -name => 'Back2');
Win32::GUI::Dialog();
sub Submit_Click {
print $add->input->Text();
$add->Hide(); MAIN(); return 0;
}
sub Back2_Click { $add->Hide(); MAIN(); -1; }
sub add_Terminate{ $add->Hide(); MAIN(); -1; }
}
MAIN();
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.