stringplayer92 has asked for the wisdom of the Perl Monks concerning the following question:
Here is the important parts of my code:
#!/usr/bin/perl use Win32::GUI(); # Perl module for access to Windows <API functions @chosen; $main = Win32::GUI::Window->new( -name => 'Main', #name of the window, use for events -width => 675, -height => 600, -text => 'Keno', #title of window -minsize => [675, 600], -dialogui => 1 #contorls special keyboard handling ); ########Controls#################################### # 80 Buttons... Probably better and much more efficient #way... # The subroutine under "-onClick => &Button_Click(x)" is #executing be +fore the app. even shows up #basically I have 80 similar buttons $Button1= Win32::GUI::Button->new(-parent => $main, -pushlike => 1, -n +ame => Button1, -text => '1', -onClick => &Button_Click(1),-height => + 50, -width => 50, -pos => [15, 55],); $main->Show(); #By default windows are hidden, so make + #it visible... Win32::GUI::Dialog(); #start a Windows message loop, to + #get user interaction #######-Event Handlers################################ sub Main_Terminate{ -1; #Terminates loop }; sub Button_Click{ my $arg = $_[0]; #my $size = @chosen; unless( @chosen[9] ) { print "$arg was choosen\n"; push (@chosen, $ar +g); #my $message = Win32::MsgBox("$arg was choosen", 0, "$arg was choosen +"); } else { print "To many numbers chosen\n";} };
P.S. As you can tell from my profile, I am new to perlmonks. And sorry about the formatting, I had some trouble... (mostly laziness)
Thanks,
stringplayer92
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Subroutines not working right
by Joost (Canon) on Feb 21, 2008 at 23:42 UTC | |
by stringplayer92 (Initiate) on Feb 21, 2008 at 23:48 UTC | |
by ikegami (Patriarch) on Feb 22, 2008 at 00:02 UTC | |
by Joost (Canon) on Feb 22, 2008 at 00:00 UTC | |
by stringplayer92 (Initiate) on Feb 22, 2008 at 00:08 UTC | |
by thundergnat (Deacon) on Feb 22, 2008 at 01:40 UTC |