Wx::Button

From WxPerl wiki

Jump to: navigation, search

To create a button:

 
  my $BTNID=1;
  $button = Wx::Button->new(	  
	 $panel, # parent
	 $BTNID, # ButtonID
	 "Press me", # label
	 [50,50] # position
  );

To attach an event handler:

  use Wx::Event qw( EVT_BUTTON );
  EVT_BUTTON( 
	 $self, # Object to bind to
	 $BTNID, # ButtonID
	 \&ButtonClicked # Subroutine to execute
  );

See Jouke's tutorial - http://www.perl.com/pub/a/2001/09/12/wxtutorial1.html - for a full example.

Personal tools
Google AdSense