Eriam Schaffter > Catalyst-Engine-Wx-0.02_06 > Catalyst::Engine::Wx::Event



Annotate this POD

Module Version: 0.02_05   Source  


Catalyst::Engine::Wx::Event - Catalyst wxPerl Engine events manager


In your wx classes you can attach events the traditionnal way and then call the Catalyst controllers by calling CATALYST_EVT.

    # Attach events
    EVT_BUTTON( $self, $self->{button}, sub {
        CAT_EVT($self, 'Root->hello_world')

You can pass parameters along with your event:

    EVT_BUTTON( $self, $self->{button}, sub {
        CAT_EVT($self, 'Root->hello_world', { message => $self->{message}->GetValue } )

You can also name your controls and get them automatically added to your request's parameters, then you simply use the appropriate event for the control

        my $ctrl = Wx::TextCtrl->new($self, -1, "", wxDefaultPosition, wxDefaultSize);
    CAT_EVT_BUTTON( $self, $self->{button}, 'Root->hello_world');

    # Root->hello_world should receive a message parameter with the value stored in
    # the control


Catalyst::Engine::Wx::Event is the module that you can use to attach events to your controls and to trigger Catalyst controllers.


Calls a Catalyst controller either by its path or by its representation. Where Root->hello_world is the representation of the hello_world sub in the Root module.

You can also call it with '/hello_world'.

The following is equivalent to loading the application if you have not defined a bootstrap option.

    CAT_EVT(undef, 'Root->default');


This event quits the loop and exits the applications.

For exemple this exits the application when you close the window.

    EVT_CLOSE( $window, sub { CAT_EVT_QUIT; } );


Eriam Schaffter, and the Catalyst and wxPerl team.


This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: