event.skip() in .h preventing derived classes from running

Post here wxCrafter related issues / features / bugs
antoniochang
CodeLite Curious
Posts: 7
Joined: Fri Mar 04, 2022 7:04 pm
Genuine User: Yes
IDE Question: C++
Contact:

event.skip() in .h preventing derived classes from running

Post by antoniochang »

I couldn't get my event handlers to work because the code is only able to enter the parent class' virtual handler which contains "event.Skip()". I added the following line in the derived class' function:
wxMessageBox("Hello World");
where nothing happens. However, replacing the event.Skip() with the above line in wxcrafter.h file (which is autogenerated by wxCrafter) works.

What needs to be done to get the event handler working? Thanks!

DavidGH
CodeLite Plugin
Posts: 819
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: event.skip() in .h preventing derived classes from running

Post by DavidGH »

Hi,

(This is a composite reply to both your threads, as I think the issue is the same for each.)

IIUC you are trying to use the wxCrafter-generated classes direct. Instead you should use them as base-classes to your real code. In fact I usually name the generated files foobase.cpp/h, containing class FooBase; then my Foo.cpp/h contains class Foo and #includes foobase.h.

In your derived class you can override the event handler function. You should then find that the events are correctly caught.

Regards,

David

antoniochang
CodeLite Curious
Posts: 7
Joined: Fri Mar 04, 2022 7:04 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: event.skip() in .h preventing derived classes from running

Post by antoniochang »

That solved it, thanks so much!

Post Reply