Page 1 of 6
Incremental Search with Combo Box
Posted: Wed Apr 29, 2009 7:35 pm
by sudip
Hi,
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
Re: Incremental Search with Combo Box
Posted: Fri May 01, 2009 2:24 am
by Rathinagiri
I think for normal combo box we can have 'sort' enabled. For inplace edit combobox I had not verified the same. Are all of your combo box items are alphabetically arranged?
Re: Incremental Search with Combo Box
Posted: Fri May 01, 2009 2:59 am
by sudip
rathinagiri wrote:... Are all of your combo box items are alphabetically arranged?
Yes, I use sorted array with combo box.
Suppose the list is as follows.
Abcd
Acdb
Adbd
Bdcd
Cdbd
When I press "a", pointer goes to "Abcd". But if I press "ac" (very quickly), pointer goes to "Cdbd".
TIA.
Regards.
Sudip
Re: Incremental Search with Combo Box
Posted: Fri May 01, 2009 5:47 pm
by sudip
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.
Thank you very much!!!
Again, I want to know that is it possible with the Combo Box used in Grid?
With best regards.
Sudip
Re: Incremental Search with Combo Box
Posted: Fri May 01, 2009 10:55 pm
by esgici
Please take a look this trial :
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()
*-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._
My opinion is : I don't like it
Any comment ?
Regards
--
Esgici
Re: Incremental Search with Combo Box
Posted: Sat May 02, 2009 4:14 am
by Rathinagiri
In this case, if we use 'sort .t.' incremental search is inbuilt. Isn't it?
Re: Incremental Search with Combo Box
Posted: Sat May 02, 2009 10:32 am
by esgici
rathinagiri wrote:In this case, if we use 'sort .t.' incremental search is inbuilt. Isn't it?
If you use SORT instead of ONDISPLAYCHANGE, yes.
If you use them together, no. When added SORT .T., Incr.Search still continue working.
And when extracted SORT, DISPLAYEDIT, and ONDISPLAYCHANGE, single letter search also continue working
Please try, test and clarify if possible. I feel confused
Regards
--
Esgici
Re: Incremental Search with Combo Box
Posted: Sat May 02, 2009 11:12 am
by Rathinagiri
I too am confused now.
I never used Displayedit and ondisplaychange features.
Re: Incremental Search with Combo Box
Posted: Sat May 02, 2009 11:46 am
by sudip
Hi Esgici,
My opinion is : I don't like it
Any comment ?
May I differ with you? I LIKE it very much

And it will be very helpful to me
Again, 2 points :-
1) Will it run "without" using Display Edit. (sometimes Rathi and I think in similar way, I don't know why

)
2) How can I use this technique in Grid -> Combo box.
Thank you very much.
With best regards.
Sudip
Re: Incremental Search with Combo Box
Posted: Sat May 02, 2009 2:32 pm
by esgici
Hi Sudip
sudip wrote:
Will it run "without" using Display Edit ?
If "it" is incremental search, no; if it's single letter search, yes.
How can I use this technique in Grid -> Combo box ?
Regarding HMG documentation, COMBOBOX under COLUMNCONTROLS property of GRID have only one property /parameter :
acItems; neither event, nor method.
So I don't know either possible using incremental search in that way in the COMBOBOX in GRID.
May be some low-level / undocumented features for achieving this.
Unfortunately all of that features and methods for using theme are completely out of my perspective.
Regards
--
Esgici