Hi,
I want to start by thanking Mattia for his very helpful answer to my
previous question.
I continue to be confused by the behavior of wxperl on Windows
compared to linux. In this case, I am surprised by the behavior of an
event bound to a right mouse click.
In this script, I have a StaticText inside of a StaticBox. I want to
bind an action to a right click on both static items.
#!/usr/bin/perl
package MyApp;
use base 'Wx::App';
use Wx qw(:everything);
use Wx::Event qw(EVT_RIGHT_DOWN);
sub OnInit {
my $frame = Wx::Frame -> new(undef, -1, 'demo', [-1,-1], [250,150]);
my $sizer = Wx::BoxSizer->new(wxVERTICAL);
my $box = Wx::StaticBox->new($frame, -1, 'Blah blah');
my $boxsizer = Wx::StaticBoxSizer->new( $box, wxVERTICAL );
$sizer -> Add($boxsizer, 1, wxALL, 5);
my $st = Wx::StaticText -> new($frame, -1, "This is some text");
$boxsizer -> Add($st, 1, wxGROW|wxALL, 10);
EVT_RIGHT_DOWN($st, sub{print "I clicked the Text!\n"});
EVT_RIGHT_DOWN($box, sub{print "I clicked the Box!\n"});
$frame -> SetSizerAndFit($sizer);
$frame -> Show(1);
1;
};
package main;
use Wx qw(:everything);
my $app = MyApp->new->MainLoop;
On linux, the text gets printed to STDOUT when clicking on either one.
On Windows, the event for right-clicking on the StaticText happens,
but the one of right-clicking on the StaticBox does not.
Is there a reason for this? Is there something I can do to make sure
that the event gets issued for the StaticBox?
Thanks a mmillion,
B
--
Bruce Ravel ------------------------------------ [email protected]
National Institute of Standards and Technology
Synchrotron Methods Group at NSLS --- Beamlines U7A, X24A, X23A2
Building 535A
Upton NY, 11973
My homepage: http://xafs.org/BruceRavel
EXAFS software: http://cars9.uchicago.edu/~ravel/software/exafs/