Combobox incremental seek bug

Combobox incremental seek bug

Postby Marco Turco » Thu May 03, 2007 11:17 am

Hi,
I think there is a bug using the incremental seek in a combobox.

In this self-contained sample at:
www.softwarexp.co.uk/beta/combo.zip

I have and array with 3 elements: First, Second, Third,
When the combobox has the focus press the "S" key to go to the "Second" element then press the "Give me the position" button and you will see that the position value is not the numeric value but the string "Second".

Any ideas ?

Marco
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Postby Armando » Thu May 03, 2007 1:11 pm

Marco:

Pls try with a numeric var as follow:

acMonths := {"Jan","Feb","Mar","Apr","May","Jun",;
"Jul","Aug","Sep","Oct","Nov","Dec"}

nMonth := 1

REDEFINE COMBOBOX oGet VAR nMonth ID 100 OF oDlg;
PROMPTS acMonths

Regards, Armando
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3209
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Postby Marco Turco » Thu May 03, 2007 2:40 pm

Nothing to do.

If I select the month pressing the first key the return value will be the string instead of the numeric position.

See www.softwarexp.co.uk/beta/test.png

This problem appairs with the latest fivewin version,the FWH April 2006 build runs fine.

Marco
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Postby Antonio Linares » Thu May 03, 2007 6:17 pm

Marco,

Please make this change at source\classes\combobox.prg line 506:

::Set( If( ValType( Eval( ::bSetGet ) ) == "N", AScan( ::aItems, uItem ), uItem ) )
regards, saludos

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

Postby Marco Turco » Thu May 03, 2007 7:26 pm

Yes, the return value is correct now
but the incremental seek runs only for the first key pressed.

You can easely check it in the sample I gave you.

Marco
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Postby Antonio Linares » Thu May 03, 2007 7:41 pm

Marco,

It seems to work fine.

Please remember that you have to press Space in order to make a new search
regards, saludos

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

Postby Marco Turco » Thu May 03, 2007 8:08 pm

Yes, pressing SPACE the seek reinitialize itself but this solution is really unpracticol for the customer.

For example if you have an array like:

Antonio
Fabio
Andrea
Marco
Alfonso
..
..
Alexandro


with the old FWH April 2006 the customer simply pressing "A" go to the first name that start with this character and then can scroll all the name below simply re-pressing "A".

with this latest FWH the customer pressing "A" go to the first name and then he need to use the arrow key to go the next "A" name because the key seek doen't run anymore (and the names could also are not in alphabetic order).

Hope I am explained the problem,
however I can send you a self-contained sample linked with the new and with the old combobox class to show you the difference.

Marco
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Postby Antonio Linares » Thu May 03, 2007 9:27 pm

Marco,

Yes, you are right, it behaves in a different way. Several customers requested this new behavior to perform incremental search.

You may use the Class TComboBox from the previous FWH build.
regards, saludos

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

Postby Ugo » Sat May 05, 2007 8:16 pm

Antonio Linares wrote:You may use the Class TComboBox from the previous FWH build.


Antonio,
I have insert any modification for incremental or previous use.
If insert the new clause INCREMENTAL the incremental search is active
without new clause the Combobox search is the previous version.

Modify this:

in fivewin.ch:
Code: Select all  Expand view
#xcommand @ <nRow>, <nCol> COMBOBOX [ <oCbx> VAR ] <cVar> ;
             [ <it: PROMPTS, ITEMS> <aItems> ] ;
             [ SIZE <nWidth>, <nHeight> ] ;
             [ <dlg:OF,WINDOW,DIALOG> <oWnd> ] ;
             [ <help:HELPID, HELP ID> <nHelpId> ] ;
             [ ON CHANGE <uChange> ] ;
             [ VALID <uValid> ] ;
             [ <color: COLOR,COLORS> <nClrText> [,<nClrBack>] ] ;
             [ <pixel: PIXEL> ] ;
             [ FONT <oFont> ] ;
             [ <update: UPDATE> ] ;
             [ MESSAGE <cMsg> ] ;
             [ WHEN <uWhen> ] ;
             [ <design: DESIGN> ] ;
             [ BITMAPS <acBitmaps> ] ;
             [ ON DRAWITEM <uBmpSelect> ] ;
             [ STYLE <nStyle> ] ;
             [ <pict: PICT, PICTURE> <cPicture> ];
             [ ON EDIT CHANGE <uEChange> ] ;
             [ <search: INCREMENTAL, SEARCH, INCR_SEARCH> ] ;
       => ;
          [ <oCbx> := ] TComboBox():New( <nRow>, <nCol>, bSETGET(<cVar>),;
             <aItems>, <nWidth>, <nHeight>, <oWnd>, <nHelpId>,;
             [{|Self|<uChange>}], <{uValid}>, <nClrText>, <nClrBack>,;
             <.pixel.>, <oFont>, <cMsg>, <.update.>, <{uWhen}>,;
             <.design.>, <acBitmaps>, [{|nItem|<uBmpSelect>}], <nStyle>,;
             <cPicture>, [<{uEChange}>], [<.search.>] )

#xcommand REDEFINE COMBOBOX [ <oCbx> VAR ] <cVar> ;
             [ <items: PROMPTS, ITEMS> <aItems> ] ;
             [ ID <nId> ] ;
             [ <dlg:OF,WINDOW,DIALOG> <oWnd> ] ;
             [ <help:HELPID, HELP ID> <nHelpId> ] ;
             [ ON CHANGE <uChange> ] ;
             [ VALID   <uValid> ] ;
             [ <color: COLOR,COLORS> <nClrText> [,<nClrBack>] ] ;
             [ <update: UPDATE> ] ;
             [ MESSAGE <cMsg> ] ;
             [ WHEN <uWhen> ] ;
             [ BITMAPS <acBitmaps> ] ;
             [ ON DRAWITEM <uBmpSelect> ] ;
             [ STYLE <nStyle> ] ;
             [ <pict: PICT, PICTURE> <cPicture> ];
             [ ON EDIT CHANGE <uEChange> ] ;
             [ <search: INCREMENTAL, SEARCH, INCR_SEARCH> ] ;
       => ;
          [ <oCbx> := ] TComboBox():ReDefine( <nId>, bSETGET(<cVar>),;
             <aItems>, <oWnd>, <nHelpId>, <{uValid}>, [{|Self|<uChange>}],;
             <nClrText>, <nClrBack>, <cMsg>, <.update.>, <{uWhen}>,;
             <acBitmaps>, [{|nItem|<uBmpSelect>}], <nStyle>, <cPicture>,;
             [<{uEChange}>], [<.search.>] )


in Combobox.prg
Code: Select all  Expand view
// at the top
#define MY_INCREMENTAL_SEARCH .F.

...

CLASS TComboBox FROM TControl
   ...
   DATA   lIncrSearch

...
METHOD New( nRow, nCol, bSetGet, aItems, nWidth, nHeight, oWnd, nHelpId,;
            bChange, bValid, nClrFore, nClrBack, lPixel, oFont,;
            cMsg, lUpdate, bWhen, lDesign, acBitmaps, bDrawItem, nStyle,;
            cPict, bEChange, lIncSearch ) CLASS TComboBox
...
   DEFAULT ...,;
           lIncSearch := MY_INCREMENTAL_SEARCH
...
   ::lIncrSearch := lIncSearch
...


METHOD ReDefine( nId, bSetGet, aItems, oWnd, nHelpId, bValid, ;
                 bChange, nClrFore, nClrBack, cMsg, lUpdate, ;
                 bWhen, acBitmaps, bDrawItem, nStyle, cPict, ;
                 bEChange, lIncSearch ) CLASS TComboBox
...
   DEFAULT ...,;
           lIncSearch := MY_INCREMENTAL_SEARCH
...
   ::lIncrSearch := lIncSearch
...



METHOD KeyChar( nKey, nFlags ) CLASS TComboBox

...

   IF ::lIncrSearch
      // Incremental search

      // Actual code 70x version

   else
      // previous method
      Return Super:KeyChar( nKey, nFlags )
   endif

   Return Nil


if you want i send to your private mail the source.
Ciao, best regards,
Ugo
User avatar
Ugo
 
Posts: 283
Joined: Sat Oct 15, 2005 6:40 am
Location: Turin, Italy

Postby James Bott » Sun May 06, 2007 2:43 am

Marco,

Antonio
Fabio
Andrea
Marco
Alfonso
..
..
Alexandro

I don't think this is a very good design. Potentially, the user could have to type a lot more keystrokes to find what they are looking for. What if there are 50 items beginning with A. They might have to type A, 50 times. However, you can usually find what you want with an incremenal search with 3 or 4 keystrokes even in large lists.

Most users are also going to expect lists to be sorted. Is there a reason you can't use a sorted list?

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Marco Turco » Tue May 08, 2007 8:18 am

Hi James,
I created an unsorted list only for this sample for a better explain of this problem.

In my commercial apps I obviusly use combos with sorted arrays.

The problem of this new kind of incremental seek is that it is a programmer-like feature and not an end-user feature.
Unfortunately I could have a human-monkey meeting point customers but really I have had a lot of call of customers with many difficult to scroll the combos list with this solution.

There is also the problem that if the customer doesn't remember well the name it want to search then it need to continue the search with the mouse or arrows key. With the old system it has only to press the initial key and (in my apps) it can also make list filters pressing a button.

Best Regars,

Marco
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Postby James Bott » Tue May 08, 2007 5:08 pm

Marco,

>The problem of this new kind of incremental seek is that it is a programmer-like feature and not an end-user feature. Unfortunately I could have a human-monkey meeting point customers but really I have had a lot of call of customers with many difficult to scroll the combos list with this solution.

I have not heard any complaints. Do you suppose this is just because the behavior changed and they were not used to it? I find that this will happen no matter great of an improvement you make, but after a few weeks they get used to it and you never hear about it again.

>There is also the problem that if the customer doesn't remember well the name it want to search then it need to continue the search with the mouse or arrows key. With the old system it has only to press the initial key and (in my apps) it can also make list filters pressing a button.

In contrast, if they do know the name, then they are going to have to type a lot more keystrokes. If you are looking for a name, Stevens, and there are a hundred names starting with S in the list, and given that T is about 3/4 of the way through the alphabet, with the old system they would have to type S about 75 times. With the new system, they could get to the first occurance of Stevens probably with only two keystrokes-ST. That is a big difference.

I just tried an example with only about 200 names in the list and nine starting with S and one Stevens. It takes 2 keystrokes to get to Stevens using incremental searching and 7 with the old system. Still much less work with incremental searching.

If your app supports user configuration, then you could allow each user to configure this particular behavior to the way they like it. That solves it nicely.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 41 guests

cron