Incremental Search with Combo Box

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
sudip
Posts: 1454
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Incremental Search with Combo Box

Post 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
With best regards,
Sudip
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Incremental Search with Combo Box

Post 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?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
sudip
Posts: 1454
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: Incremental Search with Combo Box

Post 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
With best regards,
Sudip
User avatar
sudip
Posts: 1454
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: Incremental Search with Combo Box

Post by sudip »

Roberto Lopez wrote:
sudip wrote: BTW, do you have any idea how to use incremental search in combobox. viewtopic.php?f=5&t=404
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
With best regards,
Sudip
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Incremental Search with Combo Box

Post 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
Viva INTERNATIONAL HMG :D
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Incremental Search with Combo Box

Post by Rathinagiri »

In this case, if we use 'sort .t.' incremental search is inbuilt. Isn't it?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Incremental Search with Combo Box

Post 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
Viva INTERNATIONAL HMG :D
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Incremental Search with Combo Box

Post by Rathinagiri »

I too am confused now. :)

I never used Displayedit and ondisplaychange features.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
sudip
Posts: 1454
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: Incremental Search with Combo Box

Post by sudip »

Hi Esgici,
My opinion is : I don't like it :(

Any comment ?
May I differ with you? I LIKE it very much ;) :D 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
With best regards,
Sudip
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Incremental Search with Combo Box

Post 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
Viva INTERNATIONAL HMG :D
Post Reply