FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour combobox
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: combobox
Posted: Sun Jul 04, 2010 08:28 PM
Ok, here is a fix. There are just two lines that need to be changed.

James


Code (fw): Select all Collapse
METHOD KeyChar( nKey, nFlags ) CLASS TComboBox
      ...
         otherwise
              ::cSearchKey += Upper( Chr( nKey ) )  // JBott
      endcase

      if Empty( uItem )
         if nNewAt == 0
            nNewAt = AScan( ::aItems, {|x| Upper( x ) = ::cSearchKey } ) // JBott
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: combobox
Posted: Sun Jul 04, 2010 08:40 PM
Here is my test code.

James

Code (fw): Select all Collapse
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    LOCAL oCbx, cVar := ""

    LOCAL aArray:= { "", "Alpha", "Pippo", "Pluto", "Paperino","Pblano" }
    asort(aArray)

    DEFINE DIALOG oDlg

    @ 1, 1 COMBOBOX oCbx VAR cVar;
           ITEMS aArray

    oCbx:lIncSearch = .T.

    @ 3, 1 BUTTON "Close";
           ACTION oDlg:End()

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: combobox
Posted: Sun Jul 04, 2010 08:45 PM

Enrico's example works fine if Caps is pressed for the first typed char.

James enhacement avoids the use of Caps.

Unless I am missing something

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: combobox
Posted: Sun Jul 04, 2010 08:55 PM

Antonio,

Yes, I finally found that it was case sensitive. Enrico's sample is not is sorted order either so that is also a problem.

As we have found, even us programmers didn't think to try case sensitive input. So, I doubt that the users will. This is why I think it should be case insensitive.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: combobox
Posted: Sun Jul 04, 2010 09:48 PM

James,

Yes, you are right. In order to avoid potential users errors lets implement your fixes, thanks :-)

Edited: Already implemented for next FWH build

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 392
Joined: Tue Mar 10, 2009 11:54 AM
Re: combobox
Posted: Mon Jul 05, 2010 07:27 AM

Hi,

the logic (cas sensitive/insensitive) should be adjustable by the developer or user, because sometimes - especially in the german language - there can be importend differences in the orthography regarding lower and upper cases :wink: , and when you want to differentiate in the logic...

Windows 11 Pro 22H2 22621.1848

Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384

Harbour 3.2.0dev (r2008190002)

FWH 23.10 x86
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: combobox
Posted: Mon Jul 05, 2010 05:48 PM
Frank's suggestion could be useful. I suggest defaulting the class to NOT be case sensitive so it doesn't break existing code.

Below is the modified code to make case sensitive optional.

James

Code (fw): Select all Collapse
   DATA ::lCaseSensitive := .F.

...

METHOD KeyChar( nKey, nFlags ) CLASS TComboBox
      ...
         otherwise
            if ::lCaseSensitive
               ::cSearchKey += Chr( nKey )
            else
              ::cSearchKey += Upper( Chr( nKey ) )
            endif
      endcase

      if Empty( uItem )
         if nNewAt == 0
            if ::lCaseSensitive
               nNewAt = AScan( ::aItems, {|x| x = ::cSearchKey } )
            else
               nNewAt = AScan( ::aItems, {|x| Upper( x ) = ::cSearchKey } )
            endif
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: combobox
Posted: Tue Jul 06, 2010 02:59 AM

James,

Implemented for next FWH build :-)

Thanks! :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 392
Joined: Tue Mar 10, 2009 11:54 AM
Re: combobox
Posted: Tue Jul 06, 2010 10:38 AM

I love FWH :D

Windows 11 Pro 22H2 22621.1848

Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384

Harbour 3.2.0dev (r2008190002)

FWH 23.10 x86
Posts: 124
Joined: Sat Dec 05, 2009 12:44 PM
Re: combobox
Posted: Thu Jul 08, 2010 06:00 PM

Thank you James if you can find a solution
kind regards
José

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: combobox
Posted: Thu Jul 08, 2010 10:13 PM
Jose,

Thank you James if you can find a solution


I am not sure what you meant by that. I did find a solution.

Is the combobox now working for you or not? If not, what version of FWH are you using? Did you make the changes to TCombobox that I posted? Are you using the sample test code I provided?

Regards,
James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 124
Joined: Sat Dec 05, 2009 12:44 PM
Re: combobox
Posted: Wed Jul 14, 2010 07:05 PM

James,
Thank you for your test code of Sun Jul 04, 2010 8:40 pm
I compiled it with my FWH 9.11 that I buyed some 6 months ago
The compiling gives no problems but the incremental search still do not work
Do I need a more recent version of FWH and so Yes, can I download it for free with my 9.11 licence?
Kind regards
José (Belgium) non prof. user

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: combobox
Posted: Thu Jul 15, 2010 12:16 AM

Jose,

If you will email me a copy of your COMBOBOX.PRG, I will test it here.

jbott at compuserve dot com

If I find that version doesn't work, you will need to upgrade to a new version of FWH. You can not get this for free.

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: combobox
Posted: Thu Jul 15, 2010 07:28 AM

James,

If it is a bug in his version, then there is no problem to provide him the fixed combobox :-)

thanks,

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 124
Joined: Sat Dec 05, 2009 12:44 PM
Re: combobox
Posted: Thu Jul 15, 2010 12:22 PM

James,
I simply compiled your test code

include "Fivewin.ch"

FUNCTION MAIN()

LOCAL oDlg

LOCAL oCbx, cVar := ""

LOCAL aArray:= { "", "Alpha", "Pippo", "Pluto", "Paperino","Pblano" }
asort(aArray)

DEFINE DIALOG oDlg

@ 1, 1 COMBOBOX oCbx VAR cVar;
       ITEMS aArray

oCbx:lIncSearch = .T.

@ 3, 1 BUTTON "Close";
       ACTION oDlg:End()

ACTIVATE DIALOG oDlg;
         CENTER

RETURN NIL

Kind regards
José