Hola,

Currently I am working on a Perl client class for Y Windows
(http://www.y-windows.org). My Y class currently acts like a
POE::Component in that it creates it's own session and passes events
back to the calling session. I am looking for a way to propagate events
up to different widgets if the event is not handled in the widget it was
for. Right now I am using this hack:

# In each widget class through inheritance of Y::Object.
sub dispatch_event {
    my $self = shift;
    my $signal_name = shift;
    
    return unless exists $self->{registered}{$signal_name};
    
    my $context = new Y::Context;
    
    for (@{$self->{registered}{$signal_name}}) {
        $poe_kernel->post(
            $_->[0], $_->[1], 
            $context, $signal_name, @_, 
            @{$_}[2 .. $#$_]
        );
    }   
    $poe_kernel->yield(
        check_event => $self, 
        $context, $signal_name, @_, 
        @{$_}[2 .. $#$_]
    );
}

# handler for check_event
sub handler_check_event { 
    my ($kernel, $object, $context, $signal_name, @params) =
        @_[KERNEL, ARG0 .. $#_];
    
    unless ($context->handled) {
        my $parent = $object->get_parent;
        if ($parent) {
            $parent->dispatch_event($signal_name, @params);
        }
    }
}

Thanks,

Scott

-- 
Scott Beck <[EMAIL PROTECTED]>
Gossamer Threads

Reply via email to