I have quite some C behind me but am a complete C++ newbie, picking it up primarily for wxWidgets.
I'd like to have a class derived from wxTextCtrl which is set to read-only. That works fine. However, it still receives focus and the cursor blinks in the otherwise immutable text field. My derived class looks like this:
Code: Select all
class MyClass : public wxTextCtrl
{
public:
MyClass( wxWindow *parent, wxWindowId id );
virtual bool AcceptsFocus() { return false; }
... other members ...
};
If I put some debug print in the AcceptsFocus() method it reveals that it is never actually called.
The IsFocusable() and CanAcceptFocus() methods of the object return true.
I don't think that that would matter, but it's all on Linux.
So, the question would be, could someone tell me what complete misunderstanding of C++, virtual functions and the general operation of wxWidgets renders that code inoperable? I'm serious, I know very little of either subject, so even a minor enlightenment would be most appreciated.