Forum: wxRuby Custom event problem.

Posted by Svend Haugaard Sørensen (Guest)
on 2010-07-05 16:58
Attachment: EventTest.rb (713 Bytes)
(Received via mailing list)
I have some problem making a custom event.

It seem like the initilizer is not visible
in the scope.  Why is that?

I have put a little test program in an attachment,
can anybody tell me, what is wrong with it?
Posted by Alex Fenton (Guest)
on 2010-07-07 10:43
(Received via mailing list)
On 05/07/2010 15:57, Svend Haugaard Sørensen wrote:
> I have some problem making a custom event.
>
> It seem like the initilizer is not visible
> in the scope.  Why is that?
>    

For some reason the allocator (constructor) function for Wx::Event is
undefined - I've just checked the sources and I don't know why SWIG is
doing that. It may be a regression.

Can you inherit from Wx::CommandEvent or some other Event class instead.
You are calling super with the parameters for Wx::CE anyway. That works
fine for me (as per the sample).

PS - at line 21 you call Wx::EvtHandler.process_event. #process_event is
an instance method, not a class method. Every Window, plus the App, has
an event_handler (with an accessor). You pass the event to one of those,
normally the one where the event originates so that it can bubble 
upwards.

hth
alex
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.