combobox

Re: combobox

Postby James Bott » Sun Jul 04, 2010 8:28 pm

Ok, here is a fix. There are just two lines that need to be changed.

James


Code: Select all  Expand view
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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: combobox

Postby James Bott » Sun Jul 04, 2010 8:40 pm

Here is my test code.

James

Code: Select all  Expand view
#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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: combobox

Postby Antonio Linares » Sun Jul 04, 2010 8: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41318
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: combobox

Postby James Bott » Sun Jul 04, 2010 8: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: combobox

Postby Antonio Linares » Sun Jul 04, 2010 9: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41318
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: combobox

Postby frose » Mon Jul 05, 2010 7: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
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg

Re: combobox

Postby James Bott » Mon Jul 05, 2010 5: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: Select all  Expand view
  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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: combobox

Postby Antonio Linares » Tue Jul 06, 2010 2:59 am

James,

Implemented for next FWH build :-)

Thanks! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41318
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: combobox

Postby frose » 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
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg

Re: combobox

Postby jds » Thu Jul 08, 2010 6:00 pm

Thank you James if you can find a solution
kind regards
José
jds
 
Posts: 117
Joined: Sat Dec 05, 2009 12:44 pm

Re: combobox

Postby James Bott » 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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: combobox

Postby jds » Wed Jul 14, 2010 7: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
jds
 
Posts: 117
Joined: Sat Dec 05, 2009 12:44 pm

Re: combobox

Postby James Bott » 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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: combobox

Postby Antonio Linares » Thu Jul 15, 2010 7: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41318
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: combobox

Postby jds » 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é
jds
 
Posts: 117
Joined: Sat Dec 05, 2009 12:44 pm

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: nageswaragunupudi and 12 guests