doublemax wrote: ↑Sun Jan 22, 2023 5:36 pmIf you cast "third" to "Two *", it will work
It does, thanx!
doublemax wrote: ↑Sun Jan 22, 2023 5:36 pmHowever, the whole issue is a little "smelly". But as i don't know the real application, it's only a guess.
The real life situation is as follows: I have a user interface with a lot of different controls and I handle key and mouse events in the uppermost class of my nested UI. For the events to get propagated to the uppermost wxFrame, I use a simple base class
Code: Select all
class propagatorBase {
public:
void propagate(wxKeyEvent& evt) {
evt.ResumePropagation(levelsToPropagate);
evt.Skip();
}
void propagateMouse(wxMouseEvent& evt) {
evt.ResumePropagation(levelsToPropagate);
evt.Skip();
}
protected:
static const int levelsToPropagate = 100;
};
For every control type, I made an inheriting class like this:
Code: Select all
class DECLDIR_CONF textCtrlPropagator : public wxTextCtrl, public propagatorBase {
public:
textCtrlPropagator(wxWindow *par, int height, long style = 0)
: wxTextCtrl(par, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(-1, height), style | wxTE_PROCESS_ENTER),
propagatorBase() {
Bind(wxEVT_KEY_DOWN, &propagatorBase::propagate, this);
Bind(wxEVT_KEY_UP, &propagatorBase::propagate, this);
Bind(wxEVT_MOUSEWHEEL, &propagatorBase::propagateMouse, this);
}
};
9 out of 10 times this works well, but I have one special class that needs individual key event handling. So I keep only the mousewheel event and unbind the key events in only this one class so it can make special things for special key events.
Is there a less smelly way to do it?