Thanks to all who replied.
Here is the code that I received.
my ($ButtonClicked, @other_params) = @_;
my $ButtonName = $ButtonClicked->{-name};
Thanks to Sean for the email
He was nice enough to explain the mechanics of the code above and how it
fetches the button -name
Here's the button add and button_click sub for all who may want it.
### add button #########################
my $Button = new Win32::GUI::Button($Main,
-name => "Test",
-tip => "Test",
-width => 15,
-height => 15,
-left => 600,
-onClick => 'Button_Clicked',
);
$Main->AddButton($Button);
####################################
####################################
sub Button_Clicked
{
my ($ButtonClicked, @other_params) = @_;
my $ButtonName = $ButtonClicked->{-name};
### $ButtonName is now ready for use :) ###
}
#####################################
Thanks,
Doug
The first item passed into the onClick subroutine is the
Win32::GUI::Button object. (Note: NOT the {-name} of the object, but the
blessed Perl object itself.)
> ### create buttons ###########################################
> $ButtonNumber = new Win32::GUI::Button($Main,
> -name => "$ButtonName",
> -tip => "$ButtonName",
> -pos => [$posX, $posY],
> -size => [15, 15],
> -onClick => 'Button_Clicked',
> );
>
>
> ### sub that all buttons go to ###
> sub Button_Clicked{
>
> ?????????????????????????? get button -name here. :P
my ($button, @other_params) = @_;
my $ButtonName = $button->{-name};
> $Main->Status3->Text("$ButtonName");## display button name in status bar
> }
> #########################################################
I can't recall off the top of my head what the other params are, but the
docs should say. (And if all you want is the name, they are not important.)
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/