How can I use combobox with incremental search? My combobox use only the first letter of the item for searching.
Again, I am using combobox mainly within grid

TIA.
With best regards.
Sudip
Moderator: Rathinagiri
Yes, I use sorted array with combo box.rathinagiri wrote:... Are all of your combo box items are alphabetically arranged?
Thank you very much!!!Roberto Lopez wrote:I usually solve that, with an OnChange procedure that takes value from edit control of the combo and search inside combo with a loop across all elements.sudip wrote: BTW, do you have any idea how to use incremental search in combobox. viewtopic.php?f=5&t=404
Code: Select all
#include "minigui.ch"
PROC Main()
aCidades := {}
MakeData()
DEFINE WINDOW frmISCBX ;
AT 0,0 ;
WIDTH 400 ;
HEIGHT 200 ;
TITLE 'Incremental Search in Combo Box' ;
MAIN
ON KEY ESCAPE ACTION frmISCBX.Release
DEFINE COMBOBOX cmbIncrS
ROW 10
COL 10
WIDTH 200
ITEMS aCidades
VALUE 1
DISPLAYEDIT .T.
ONDISPLAYCHANGE DoIncrSrch( this.DisplayValue )
END COMBOBOX // cmbIncrS
END WINDOW // frmISCBX
frmISCBX.CENTER
frmISCBX.ACTIVATE
RETURN // Main()
*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._
PROC DoIncrSrch( xDispVal )
LOCAL nItemNo := ASCAN( aCidades, xDispVal )
IF nItemNo > 0
frmISCBX.cmbIncrS.Value := nItemNo
ENDIF nItemNo > 0
RETU // DoIncrSrch()
*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._
PROC MakeData()
aCidades := { "Bagdad" ,;
"Berlim" ,;
"Blumenal" ,;
"Brasilia" ,;
"Buenos aires" ,;
"Canoas" ,;
"Caracas" ,;
"Lima" ,;
"Monte carlo" ,;
"Montreal" ,;
"New york" ,;
"Niger" ,;
"Panama" ,;
"Paris" ,;
"Pequim" ,;
"Rio de janeiro" ,;
"Roma" ,;
"Sao paulo" ,;
"Sidney" ,;
"Tokyo" ,;
"Toronto" }
RETURN // MakeData()
*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._
If you use SORT instead of ONDISPLAYCHANGE, yes.rathinagiri wrote:In this case, if we use 'sort .t.' incremental search is inbuilt. Isn't it?
May I differ with you? I LIKE it very muchMy opinion is : I don't like it
Any comment ?
If "it" is incremental search, no; if it's single letter search, yes.sudip wrote: Will it run "without" using Display Edit ?
Regarding HMG documentation, COMBOBOX under COLUMNCONTROLS property of GRID have only one property /parameter : acItems; neither event, nor method.How can I use this technique in Grid -> Combo box ?