wxSearchCtrl : cast to wxTextCtrl fails to compile

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
nmset
Knows some wx things
Knows some wx things
Posts: 46
Joined: Fri Nov 26, 2010 4:48 pm

wxSearchCtrl : cast to wxTextCtrl fails to compile

Post by nmset »

Hello,

This compile failure is hard to understand (GTK3, gcc, Linux) :

static_cast<wxTextCtrl*> (aSearchCtrl);

According to the docs, wxSearchCtrl derives from wxTextCtrl, and should be able to cast to wxTextCtrl. Compile succeeds with dynamic_cast, but returns a NULL result.

Casting to wxControl or to wxTextEntry suceeds though, but it's not what I need.

Is there any workaround for this ? Some clarification at least.

Thanks in advance.
User avatar
doublemax
Moderator
Moderator
Posts: 19103
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxSearchCtrl : cast to wxTextCtrl fails to compile

Post by doublemax »

The documentation is outdated.
This control is implemented natively under macOS and GTK 3.6 or later and generically for all the other platforms.
On platforms where a native implementation exists, wxSearchCtrl does not derive from wxTextCtrl.

What exactly do you want to do?
Use the source, Luke!
nmset
Knows some wx things
Knows some wx things
Posts: 46
Joined: Fri Nov 26, 2010 4:48 pm

Re: wxSearchCtrl : cast to wxTextCtrl fails to compile

Post by nmset »

OK, I didn't fully grasp the meaning of 'generically implemented'.

I'm using wxTextCompleterSimple on a few wxTextCtrl controls, and wished to use wxSearchCtrl instead, mainly because of the cancel button. Unfortunately, wxTextCtrl does not provide a cancel button.

It's not a real problem, was just surprising. wxTextCtrl is good enough.

Thanks.
Post Reply