[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi] Overriding wx member functions
From: |
Greg Chicares |
Subject: |
[lmi] Overriding wx member functions |
Date: |
Sat, 26 Nov 2005 23:40:47 +0000 |
User-agent: |
Mozilla Thunderbird 1.0.2 (Windows/20050317) |
Vadim--I notice that I've been overriding some wx member functions,
and I'd like to ask a few questions about this.
1. Is there any general rule that indicates whether the base-class
member should be called explicitly in a derived-class override, and,
if so, whether it should be called at the beginning of the overriding
function or at the end?
2. I noticed that the OnChildFocus() handler in 'xml_notebook.cpp'
doesn't call the base-class function of the same name, probably with
the ultimate effect that wxControlContainer::SetLastFocus() doesn't
get called. That seemed to be a possible explanation for this problem:
File | New | Illustration
Ctrl-Tab six times, to get to the 'Face' tab
now Ctrl-Tab has no further effect; neither do Tab, Enter, or Cancel
and I'm guessing that a wxPanel in the notebook has the focus
activating another application, then reactivating lmi, gives focus
to the 'Face' notebook tab; then keyboard navigation works again
I tried calling wxDialog::OnChildFocus() at the top of lmi's handler,
but that didn't solve the problem. Should I attempt to solve it in lmi,
or is this a wx library issue?
3. In 'xml_notebook.hpp' I've coded things like
void OnInitDialog (wxInitDialogEvent&);
void OnOK (wxCommandEvent& );
in the hope that I'd be overriding base-class implementations (which
I don't always invoke explicitly, but probably should), but it appears
that I'm actually hiding the base-class versions because they're not
virtual. Is there a reason for them not to be virtual? What practice
is recommended in this case--to use a distinct name in the derived
class? I'm wondering whether I should change all my 'On-' functions
to use a different prefix, in order to avoid problems like this.
- [lmi] Overriding wx member functions,
Greg Chicares <=