I am looking for a ListCtrl widget with individual entries that behave
like the Firefox address bar, i.e upon typing it opens a popup window
with available choices.
The choices should be limited to these choices, text that is not in
the autocomplete list should not be inserted.
The list has about 20000 entries, so the widget should display the
choices only after they have been limited to a reasonable number.
If there is only one matching item, it should be used automatically
without further selection, and if there is no such item the entry
should be locked, like for an incremental find when there is no match.
I tried to build such a widget from a ListCtrl, but it seems (?)
events are available only when the editing has been done, like
EVT_LIST_END_LABEL_EDIT, and not after each change to the inserted
text.
This is available in a TextCtrl, where EVT_TEXT is emitted every time
the text changes.
I am sure a similar functionality is available somewhere, can anyone
point me to it or help how to build it myself?
On Aug 28, 7:24 am, Daniel <dali...@gmail.com> wrote:
Hello,
I am looking for a ListCtrl widget with individual entries that behave
like the Firefox address bar, i.e upon typing it opens a popup window
with available choices.
The choices should be limited to these choices, text that is not in
the autocomplete list should not be inserted.
The list has about 20000 entries, so the widget should display the
choices only after they have been limited to a reasonable number.
If there is only one matching item, it should be used automatically
without further selection, and if there is no such item the entry
should be locked, like for an incremental find when there is no match.
I tried to build such a widget from a ListCtrl, but it seems (?)
events are available only when the editing has been done, like
EVT_LIST_END_LABEL_EDIT, and not after each change to the inserted
text.
This is available in a TextCtrl, where EVT_TEXT is emitted every time
the text changes.
I am sure a similar functionality is available somewhere, can anyone
point me to it or help how to build it myself?
Thanks
Daniel
Did you check the wiki? It has a tutorial/recipe for just such a
beast:
do you have any idea how to to this for a ListCtrl and not a TextCtrl?
I could not get an EVT_TEXT from a ListCtrl, how do I know the text
entered changed?
do you have any idea how to to this for a ListCtrl and not a TextCtrl?
I could not get an EVT_TEXT from a ListCtrl, how do I know the text
entered changed?
You can get access to the TextCtrl that is used for editing by calling
wx.TextCtrl.GetEditControl. You will then need to bind to the text
control to receive the text control related events.
Cant remember at the moment if it uses one text control throughout the
objects lifespan or if it creates a new one each time you activate the
edit control so you may have to do this each
(EVT_LIST_BEGIN_LABEL_EDIT) event in the ListCtrl.
Cody
···
On Fri, Aug 28, 2009 at 1:54 PM, Daniel<dalist0@gmail.com> wrote:
With your help my code is now running:
the ListCtrl creates a new TextCtrl each time a field is edited, it is
called editor.
By binding ListCtrl.editor's EVT_TXT to the function OnEnteredText in
textCtrlAutoComplete each time a EVT_LIST_BEGIN_LABEL_EDIT is emitted
from the ListCtrl,
I obtained the desired result.
The only difficulty was to change the position of the dropdown menu
(in _showDropDown), because is slightly above the textctrl and stole
the focus so textctrl did
not get any keypress events and it seemed not to work.