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
In reply to Subroutines not working right by stringplayer92
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |