wxpythonwxwidgetswxformbuilderwxtextctrl

Custom controls in wxformbuilder


I am currently having a issue with TextCtrlAutoComplete (https://wiki.wxpython.org/TextCtrlAutoComplete) and wxFormBuilder.

I would like to use the Autocomplete version but i have no way of telling wxFormbuilder to use a custom control as far as i can find.

How can i make it so it correctly generates the class. Or how to i correctly override the member in a subclass?

I also have problem with a workaround:

I have a few wxBoxsizers nested. I now have a TextCtrl as a place holder i would like to replace.

If i do :

self.m_textCtrlAlias = TextCtrlAutoComplete(self, [wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0], colSearch=True,choices=['example', 'hello', 'world', 'foo', 'bar'])

The control ends up in the upper left corner of the form. If there any way to replace the other control. I used wxBoxSizer in the master class there also not set as a member.

Anyone has more suggestions i am open to do it.


Solution

  • The way I did: If the control is subclass of another control, say it is subclass of wxTextCtrl, then add wxTextCtrl using wxFormBuilder. Then set the subclass name of the wxTextCtrl to the class name of the control, in your case as I understand it is TextCtrlAutoComplete.

    As you (Pimmetje) also have mentioned " The header can be used to set the import for python."