I'm really showing my lack of programming acumen with this question, but I'm stumped. My application is working fine with your above code looking like this:
def __init__(self, parent):
self._init_ctrls(parent)
self.stu_entry = TextCtrlAutoComplete(id=wx.NewId(),
name='stu_entry', parent=self.panel1, pos=wx.Point(48, 16),
size=wx.Size(368, 27), style=0, value=u'Student',
choices=auto_choices[:])
I'm drawing the choices from a sqlite3 query. Works great. I'd like to run something when the name is picked (double clicked, enter key, whatever). I'm can't figure out how to. In the class definition is:
def __init__ ( self, parent, colNames=None, choices = None,
multiChoices=None, showHead=True, dropDownClick=True,
colFetch=-1, colSearch=0, hideOnNoMatch=True,
selectCallback=None, entryCallback=None, matchFunction=None,
**therest) :
So I need to do something with either selectCallback or entryCallback, but I'm not sure how to trigger it or where to write my def. I'd appreciate anything pointing me in the right direction.
-Lang
···
On 06/15/2011 08:53 AM, werner wrote:
On 06/15/2011 06:39 AM, grakker wrote:
I'm working on a somewhat basic application to help me at work. I
would like to have a auto-completion text entry using (I guess this is
what I want, it's the only thing I've found) http://wiki.wxpython.org/TextCtrlAutoComplete
I have my UI pretty complete, but I just don't know how to go about
doing what I want. I'm hoping someone can give me an example that I
might be able to change up. Right now it's just
self.stu_entry = wx.TextCtrl(id=wxID_MAINWINDOWSTU_ENTRY,
name=u'stu_entry', parent=self.panel1, pos=wx.Point(48,
16),
size=wx.Size(368, 27), style=0, value=u'Student')
And then I have the TextCtrlAutoComplete.py file/class that I
include. I'm sure that I sound like a moron, but I really don't know
where to go from here. Thanks.
You have to manually add this type of control as is shown in the attached sample.
Initially I thought that I could define it as a CustomClass to Boa and define it like a wx.TextCtrl but as the TextCtrlAutoComplete is not known to Boa and its constructor is not matching wx.TextCtrl or another known control this is not possible. Using CustomClass has the big advantage that one could use the Boa UI designer.
See the section "Working with generated source code" in the Boa doc for a bit more detail.
Werner