Re: Help with Wx::Perl::PubSub
Steve Cookson - gmail <[email protected]> Thu, 14 May 2015 15:33:40 -0300
| Newsgroups | gmane.comp.lang.perl.wxperl |
|---|---|
| Message-ID | <[email protected]> |
Hi François,
This is very interesting. I've not seen it before, what is it supposed
to do to events and why is it better than the standard way of handling them?
Regards
Steve.
On 12/05/15 09:29, RAPPAZ Francois wrote:
> I would like to bind a TextChanged event with a Wx::TextCtrl.
>
> I have this that works:
>
> EVT_TEXT($frame, $w, sub{$self->Test($w)});
> Where $frame is the top level frame, $w the field that emit the signal.
>
> I'm trying to use the Wx::Perl::PubSub module, but none of these works
>
> $w->subscribe('TextChanged', sub{$self->Test($w)} );
> Does nothing
>
> $w->subscribe('TextChanged', $self, 'Test');
> Crash with
> not a code ref at C:/strawberry/perl/site/lib/Wx/Perl/PubSub.pm line 377.
> Wx::Perl::PubSub::emit(Wx::TextCtrl=SCALAR(0x4bd19bc), "TextChanged", "1
> 0.1111/tpj.12544-modd") called at C:/strawberry/perl/site/lib/Wx/Perl/PubSub.pm
> line 390
> Wx::Perl::PubSub::emit_event(Wx::TextCtrl=SCALAR(0x4bd19bc), Wx::Command
> Event=SCALAR(0x406fcec), "TextChanged", "10.1111/tpj.12544-modd") called at C:/s
> trawberry/perl/site/lib/Wx/Perl/PubSub/Events.pm line 205
> Wx::Perl::PubSub::Events::_Wx_TextCtrl_TextChanged(Wx::TextCtrl=SCALAR(0
> x4bd19bc), Wx::CommandEvent=SCALAR(0x406fcec)) called at U:\docs\perl\wxw\refsui
> .pl line 26
> eval {...} called at U:\docs\perl\wxw\refsui.pl line 26
>
>
> $w->subscribe('TextChanged', $frame, 'Test');
> Remains silent
>
> Where Test is
> sub Test {
> my ($self, $w) = @_;
> print $w->GetValue. "\n";
>
> }
>
> Thanks for any help
>
> François
>