FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Incremental Search on Combobox dropdown (not dropdownlist)
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Incremental Search on Combobox dropdown (not dropdownlist)
Posted: Mon Dec 17, 2012 02:52 PM

To All

I have searched the forum and I see several subjects on this topic, however, I do not seem to find an answer ?

I have no problem using DropDownList .. however, I need to be able have it search like CBS_DROPDOWN. The reason is because if the value is not found in the array, I want to be able to manually type it in... FWH 1203.

Thanks
Rick Lipkin

ps .. I noticed that in the DropDownList .. only the first character is evaluated :(

Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Incremental Search on Combobox dropdown (not dropdownlist)
Posted: Mon Dec 17, 2012 05:00 PM
Try this

Code (fw): Select all Collapse
#include "fivewin.ch"
FUNCTION MAIN
LOCAL oDlg
LOCAL oGet, cGet := "   "
LOCAL oCombo, cCombo := "                                 "
LOCAL aItems := { "ANDREA                           " , ;
                  "ANTONIO                          " , ;
                  "BARBARA                          " , ;
                  "BEPPE                            " , ;
                  "BIRILLO                          " , ;
                  "BIROLLO                          " , ;
                  "BIRULLO                          " , ;
                  "CAVALIERE                        " , ;
                  "CAVALLO                          " , ;
                  "DEMETRIO                         " }


DEFINE DIALOG oDlg FROM 10 , 10 TO 20 , 60

@ 1 , 1 COMBOBOX oCombo VAR cCombo OF oDLG ITEMS aItems STYLE CBS_DROPDOWN SIZE 100 , 200
@ 1 , 20 GET oGet VAR cGet OF oDlg

oCombo:lIncSearch := .T.
oCombo:oGet:bKeyChar = { | nKey | oCombo:KeyChar( nKey ) }

ACTIVATE DIALOG oDlg CENTER

RETURN NIL
Marco Boschi
info@marcoboschi.it
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Incremental Search on Combobox dropdown (not dropdownlist)
Posted: Mon Dec 17, 2012 05:56 PM
Marco

Thank you for your suggestion .. I did see this example and to some extent it works but you have to open the drop down and type your value and if it is not found it returns some unwanted symbols.

Rick Lipkin

Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Incremental Search on Combobox dropdown (not dropdownlist)
Posted: Tue Dec 18, 2012 07:42 AM

Rick,
here it works fine.
I believe you.
Version problems?
let's wait for another suggestion from some developer
marco

Marco Boschi
info@marcoboschi.it
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Re: Incremental Search on Combobox dropdown (not dropdownlist)
Posted: Tue Dec 18, 2012 02:13 PM

This is untested but you may be able to drop down the list when first key is pressed.
oCombo:oGet:bKeyChar = { | nKey | if( oCombo:IsClosed(), oCombo:Open(), nil), oCombo:KeyChar( nKey ) }

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Incremental Search on Combobox dropdown (not dropdownlist)
Posted: Sun Dec 23, 2012 01:06 AM
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion