boa-constructor and TextCtrlAutoComplete

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.

Looks like you’d want to (untested):

from TextCtrlAutoComplete import TextCtrlAutoComplete

then

l_choices = [‘foo’, ‘bar’]
self.stu_entry = TextCtrlAutoComplete(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’,
colNames=None, choices = l_choices,
multiChoices=None, showHead=True, dropDownClick=True,
colFetch=-1, colSearch=0, hideOnNoMatch=True,
selectCallback=None, entryCallback=addEntriesMth, matchFunction=None,
**therest)

The callback might add new entries to your l_choices.
Also, note the error comments a few people had.
Mainly, in Boa I’d want to add a plug-in, otherwise Boa will remove the code from __init_controls next time you open the designer.
Copy one of the files in boa/plug-ins and change to add the new entry in List Controls.

Let us know how it goes…

Ray

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

AFrame.py (1.39 KB)

···

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.

Thank you very much for a working example. That's exactly what I needed. I'll try to figure out the magic by looking a the doc you pointed out. Thanks again.

-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

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

...

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.

I think/guess it would be selctCallback, see attached.

Werner

AFrame.py (1.52 KB)

···

On 06/23/2011 06:53 AM, Lang Hurst wrote:

Works perfect for what I needed. Thanks again.

-Lang

···

On 06/23/2011 04:07 AM, werner wrote:

On 06/23/2011 06:53 AM, Lang Hurst wrote:
...

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.

I think/guess it would be selctCallback, see attached.

Werner