Hi,
i have a follow up thought on Bruce's question. The API docs say that
wxStaticText inherits from wxEvtHandler. From what I understand of the C API,
that means it should be able to handle events. That makes me think that the
Linux version is working correctly and that the Windows implementation is not
trapping the event properly?
I did a quick test on Windows XP and I can get a StaticText to accept a right
click event normally with the code below.
Robin
#!/usr/bin/perl -w
use strict;
use Wx;
package MyFrame;
use Wx::Event qw(EVT_RIGHT_DOWN);
use base qw/Wx::Frame/; # Inherit from Wx::Frame
sub new {
my $class = shift;
my $self = $class->SUPER::new(@_); # call the superclass' constructor
my $panel = Wx::Panel->new( $self, # parent
-1 # id
);
$self->{txt} = Wx::StaticText->new( $panel, # parent
1, # id
"Right-click me", # label
[50, 15] # position
);
EVT_RIGHT_DOWN($self->{txt}, sub{print "I clicked the Text!\n"});
return $self;
}
package MyApp;
use base qw(Wx::App); # Inherit from Wx::App
sub OnInit {
my $self = shift;
my $frame = MyFrame->new( undef, # Parent window
-1, # Window id
'Click on static text', # Title
[1,1], # position X, Y
[200, 150] # size X, Y
);
$self->SetTopWindow($frame); # Define the toplevel window
$frame->Show(1); # Show the frame
}
package main;
my $wxobj = MyApp->new(); # New ButtonApp application
$wxobj->MainLoop;
Robin