FindControl with wxToolBar

I have created a toolbar from xml using LoadToolBar
and I need to get a reference to one of the items in it (a wxTextCtrl)
so that I can query and set the value in it. When I call toolBar.FindControl(XRCID(“textctrl”)) using non-debug Python this works, but
when I run it in debug mode I get an assert

wxWindows\include\wx/tbarbase.h(120): assert
“IsControl()” failed: this toolbar tool
is not a control

I actually get this assert once for every item I have in the
toolbar that is not a control (i.e. a button or a separator). If the wxTextCtrl
is the only item in the toolbar then FindControl
works properly. Is there some way
that I can get a reference to the wxTextCtrl without an assert being raised?

Thanks,

Jed

Jed Burgess wrote:

I have created a toolbar from xml using LoadToolBar and I need to get a reference to one of the items in it (a wxTextCtrl) so that I can query and set the value in it. When I call toolBar.FindControl(XRCID(“textctrl”)) using non-debug Python this works, but when I run it in debug mode I get an assert

wxWindows\include\wx/tbarbase.h(120): assert “IsControl()” failed: this toolbar tool is not a control

I actually get this assert once for every item I have in the toolbar that is not a control (i.e. a button or a separator). If the wxTextCtrl is the only item in the toolbar then FindControl works properly. Is there some way that I can get a reference to the wxTextCtrl without an assert being raised?

toolbar.FindWIndowById(XRCID("textctrl"))

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!