+ if ( !event.HasModifiers() &&
+ ((keyCode >= '0' && keyCode <= '9') ||
+ (keyCode >= 'a' && keyCode <= 'z') ||
+ (keyCode >= 'A' && keyCode <= 'Z') ||
+ (keyCode == '_') ||
+ (keyCode == '+') ||
+ (keyCode == '*') ||
+ (keyCode == '-')))
+ {
+ // find the next item starting with the given prefix
+ wxChar ch = (wxChar)keyCode;
+ size_t item;
+
+ // if the same character is typed multiple times then go to the
+ // next entry starting with that character instead of searching
+ // for an item starting with multiple copies of this character,
+ // this is more useful and is how it works under Windows.
+ if ( m_findPrefix.length() == 1 && m_findPrefix[0] == ch )
+ {
+ item = PrefixFindItem(m_current, ch);
+ }
+ else
+ {
+ const wxString newPrefix(m_findPrefix + ch);
+ item = PrefixFindItem(m_current, newPrefix);
+ if ( item != (size_t)-1 )
+ m_findPrefix = newPrefix;
+ }
+
+ // also start the timer to reset the current prefix if the user
+ // doesn't press any more alnum keys soon -- we wouldn't want
+ // to use this prefix for a new item search
+ if ( !m_findTimer )
+ {
+ m_findTimer = new wxListFindTimer( this );
+ }
+
+ // Notice that we should start the timer even if we didn't find
+ // anything to make sure we reset the search state later.
+ m_findTimer->Start(wxListFindTimer::DELAY, wxTIMER_ONE_SHOT);
+
+ // restart timer even when there's no match so bell get's reset
+ if ( item != (size_t)-1 )
+ {
+ // Select the found item and go to it.
+ HighlightAll(false);
+ SetItemState(item,
+ wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED,
+ wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED);
+
+ // Reset the bell flag if it had been temporarily disabled
+ // before.
+ if ( m_findBell )
+ m_findBell = 1;
+ }
+ else // No such item
+ {
+ // Signal it with a bell if enabled.
+ if ( m_findBell == 1 )
+ {
+ ::wxBell();
+
+ // Disable it for the next unsuccessful match, we only
+ // beep once, this is usually enough and continuing to
+ // do it would be annoying.
+ m_findBell = -1;
+ }
+ }
+ }
+ else
+ {
+ event.Skip();
+ }