Something else going on.

Crude change to x.pl attached - clicking on 'Hi' text gets a mouse event?

On 23/02/2010 15:36, Johan Vromans wrote:
jvrom...@squirrel.nl (Johan Vromans) writes:

Frame ->  Sizer ->  Panel ->  Sizer ->  Controls looks better,

Except that my controls no longer get clicks :(

-- Johan
#!/usr/bin/perl -w -- 
# generated by wxGlade 8a5c6ed2b841 on Tue Feb 23 12:44:36 2010
# To get wxPerl visit http://wxPerl.sourceforge.net/

use Wx 0.15 qw[:allclasses];
use strict;

package MyFrame;

use Wx qw[:everything];
use base qw(Wx::Frame);
use strict;
use Wx::Event qw( EVT_LEFT_DOWN );

sub new {
    my( $self, $parent, $id, $title, $pos, $size, $style, $name ) = @_;
    $parent = undef              unless defined $parent;
    $id     = -1                 unless defined $id;
    $title  = ""                 unless defined $title;
    $pos    = wxDefaultPosition  unless defined $pos;
    $size   = wxDefaultSize      unless defined $size;
    $name   = ""                 unless defined $name;

# begin wxGlade: MyFrame::new

    $style = wxDEFAULT_FRAME_STYLE 
        unless defined $style;

    $self = $self->SUPER::new( $parent, $id, $title, $pos, $size, $style, $name );
    $self->{panel} = Wx::Panel->new($self, -1);
    $self->{sizer_3_staticbox} = Wx::StaticBox->new($self->{panel}, -1, "cccc" );
    

    # Menu Bar

    $self->{frame_1_menubar} = Wx::MenuBar->new();
    my $wxglade_tmp_menu;
    $self->{Exit} = Wx::Menu->new();
    $self->{frame_1_menubar}->Append($self->{Exit}, "item");
    $self->SetMenuBar($self->{frame_1_menubar});
    
# Menu Bar end

    $self->{label_1} = Wx::StaticText->new($self->{panel}, -1, "Hi", wxDefaultPosition, wxDefaultSize, );

    $self->__set_properties();
    $self->__do_layout();
    
    EVT_LEFT_DOWN($self->{label_1}, \&OnEventCheck);

# end wxGlade
    return $self;

}

sub OnEventCheck {
  my ($label, $event) = @_;
  $event->Skip(1);
  Wx::LogMessage('Event Click');
}


sub __set_properties {
    my $self = shift;

# begin wxGlade: MyFrame::__set_properties

    $self->SetTitle("frame_1");
    $self->SetSize(Wx::Size->new(194, 90));

# end wxGlade
}

sub __do_layout {
    my $self = shift;

# begin wxGlade: MyFrame::__do_layout

    $self->{sizer_1} = Wx::BoxSizer->new(wxVERTICAL);
    $self->{sizer_2} = Wx::BoxSizer->new(wxHORIZONTAL);
    $self->{sizer_3}= Wx::StaticBoxSizer->new($self->{sizer_3_staticbox}, wxHORIZONTAL);
    $self->{sizer_3}->Add($self->{label_1}, 0, wxEXPAND|wxADJUST_MINSIZE, 0);
    $self->{sizer_2}->Add($self->{sizer_3}, 1, wxEXPAND, 0);
    $self->{sizer_1}->Add($self->{sizer_2}, 1, wxEXPAND, 0);
    $self->SetSizer($self->{sizer_1});
    $self->Layout();

# end wxGlade
}

# end of class MyFrame

package MyApp;

use base qw(Wx::App);

sub OnInit {
    my $dialog_1 = MyFrame->new();
    $dialog_1->Show(1);
    return 1;
}

package main;

my $app = MyApp->new;
$app->MainLoop;

Reply via email to