ghettofinger has asked for the wisdom of the Perl Monks concerning the following question:
Today I have decided to make a windows front end using Win32::GUI. Subroutines play into this pretty heavily and I am running into problems. Specifically I need to figure out how to properly pass variables into my subroutine, and if I am correctly calling my sub. Here is my code:
use Win32::GUI; $main=Win32::GUI::Window->new(-title=>"application",-name=>"Main",-wid +th => 400, -height => 200); $main->AddButton(-name=>"BOK",-text=>"GO!",-pos=>[148,125], -onClick=> + \&SUBMIT,); my $urlfield = $main->AddTextfield( -name => "urlfield", -text => "", -left => 10, -top => 10, -width => 200, -height => 25, -prompt => ["URL:", 80], ); $main->Show(); Win32::GUI::Dialog(); sub Window_Terminate { return -1; # Stop message loop and finish program } sub SUBMIT { my ($submitted_url) = @_; print "$submitted_url \n"; }
I thought that I had it correct. I call SUBMIT within the AddButton, and it will print newlines, but no data. What am I missing? I appreciate everyone's help.
Thanks,
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Passing variables to subroutines and Win32::GUI
by pg (Canon) on Aug 21, 2005 at 07:31 UTC | |
by ghettofinger (Monk) on Aug 21, 2005 at 07:45 UTC | |
by Util (Priest) on Aug 22, 2005 at 04:44 UTC |