Author Topic: wxSmith - wxToolBar subclass and events  (Read 2724 times)

Offline cacb

  • Regular
  • ***
  • Posts: 426
wxSmith - wxToolBar subclass and events
« on: November 09, 2008, 01:41:01 pm »

I have a wxFrame based application with a wxToolbar. Now I want to subclass the wxToolbar to, say, wxMyToolbar and gove it some additional features. But i also want to use standard buttons etc. and define them and connect events using wxSmith.

When I create events for buttons in the toolbar, the events are now directed to my wxFrame derived class. Is there any way I can tell wxSmith to direct toolbar events to the wxMyToolbar class? I have told wxSmith to use wxMyToolbar and that works ok. But it would be nice if I could also tell it to generate event handlers in wxMyToolbar.

Is there a way?

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
Re: wxSmith - wxToolBar subclass and events
« Reply #1 on: November 10, 2008, 09:26:24 am »
Hi cacb

There's no support for custom events in wxSmith right now, this means that item can only provide events which are predefined.

You can submit some feature request, I think that this task require some considering. Fir example there could be some way to add customized items and configure set properties, events etc. for them.


Offline cacb

  • Regular
  • ***
  • Posts: 426
Re: wxSmith - wxToolBar subclass and events
« Reply #2 on: November 10, 2008, 10:31:13 am »
Hi byo,

Btw., did I say that wxSmith is great?  :D  It really is.

In this case I was not really thinking of custom events (although that would be great). All I wanted was to tell wxSmith to to associate any toolbar events (standard or custom) with my wxMyToolBar class, so that the event handlers were generated there. Even if this is only for the standard events that are currently supported, it makes for a cleaner design. As it is now I tend to get too many event handlers in my frame class. If I want to have event handlers in wxMyToolBar, I must do it manually and not via wxSmith. So being able to say which class is to handle the event seems like a good idea to me.

I guess custom events might be useful too, but it isn't all clear to me exactly what it should be like or when it would be useful. Perhaps describing some good example would clarify it. One thing I have seen, is the need for some way to put other items in a toolbar. For example, it should be easy to place a combo box in a toolbar using wxSmith, and then handle events in the containing toolbar class.

But the initial idea was being able to direct standard events to my own class, and not just the wxFrame derivative. I hope you understand what I mean.   :)