Greetings all, I am looking for a better way to locate and select an entry in a combo or list box by pressing a series of keys.
I have been able to do this with the following code but there must be a better way. ? It would be nice to have this as a standard method for these sort of controls. :) 'Pressing Esc clears the search string. 'Label_Search displays the current search string. PUBLIC SUB Listbox_KeyPress() DIM Count AS Integer DIM Found AS Boolean DIM SearchLen AS Integer Found = FALSE IF Key.Code = Key.Esc THEN SearchString = "" SearchLen = 0 Label_Search.Text = "No Search" ELSE SearchString = SearchString & UCase(Key.Text) SearchLen = Len(SearchString) Label_Search.text = SearchString ENDIF REPEAT IF UCase(Left(Listbox[Count].Text, SearchLen)) = (SearchString) THEN Found = TRUE END IF INC Count UNTIL Found OR (Count = (Listbox.Count - 1)) IF found THEN Listbox.index = Count - 1 END PUBLIC SUB Listbox_LostFocus() SearchString = "" END Thank you, Ian Roper Western Australia ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user