FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Incremental Search
Posts: 408
Joined: Sun Nov 06, 2005 03:55 PM
Incremental Search
Posted: Wed Mar 26, 2014 11:15 PM

All,

Has anybody written a incremental search for a get which will display the selections beneath the get. Similar to how Google Chrome displays a selection list below the address bar when searching.
It would be nice if the list is about the same size as the get, where as Google goes across the entire width of the browser.

thanks,

Byron ...

Thanks,

Byron Hopp

Matrix Computer Services
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Incremental Search
Posted: Thu Mar 27, 2014 02:07 PM
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 166
Joined: Wed Aug 29, 2012 08:25 AM
Re: Incremental Search
Posted: Fri Mar 28, 2014 09:25 AM
byron.hopp wrote:All,

Has anybody written a incremental search for a get which will display the selections beneath the get. Similar to how Google Chrome displays a selection list below the address bar when searching.
It would be nice if the list is about the same size as the get, where as Google goes across the entire width of the browser.

thanks,

Byron ...


Byron ,

Why not a combobox ?

I have written a GET , with a ACTION clausule which invokes XBROWSE , and works as a combobox with multiple columns . The source ( +/- 2500 lines) is to big to publish it here.

Frank
test
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Incremental Search
Posted: Fri Mar 28, 2014 12:40 PM

Byron

I accidentally stumbled on 'incremental filters' using ADO and xBrowse. Check out \samples\AdoRick.prg

Rick Lipkin

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Incremental Search
Posted: Mon Apr 21, 2014 03:18 PM

Byron,

You can use a combobox for array data or dbcombo for dbf data.

For the combobox you need to set lIcremental= .t. for incremental searching.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: Incremental Search
Posted: Mon Apr 21, 2014 04:24 PM
Buenos días,

I'm trying to do some think like this

Code (fw): Select all Collapse
#Include "FiveWin.Ch"
#include "xbrowse.ch"

static a := {"","AAAB","AAACA","AAADA","AAAE","AAAFA","AAAFB","AAAFC","AAAFD"}, oBrw

Function Main()
   Local oDlg
   Local oGet, oGet1
   local cVar := space( 20 )

   DEFINE DIALOG oDlg from 0,0 to 400,400 pixel

   @ 15,15 get oGet  var cVar picture "@!" size 120,12 of oDlg pixel
      
   @ 29,15 get oGet1 var cVar picture "@!" size 120,12 of oDlg pixel

   oGet:aSource  := a
   oGet:bSearch  := {|i,e| AT( i, e ) > 0 }
   oGet:cSource  := 'ARRAY'
   oGet:lenDisplay := 8

   ACTIVATE DIALOG oDlg 
 
 return nil


you can donwload the exe sample from:

https://app.box.com/s/r34a51i5qnvkqfl6oyhf

But there is a problem, when the list is showed and we move the dialog, try and you will know what I say

because I'm modified the get class I can't public the source code

Regards

Marcelo
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Incremental Search
Posted: Mon May 05, 2014 09:50 PM

Marcelo,

Why don't you just use a combox?

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: Incremental Search
Posted: Tue May 06, 2014 04:04 PM

James,

use combobox allways is a possibility, but when we have huge data it is not an option

What I want to do is a serch control like input URL in a web browser with data source from DBF, array..... The prototype work, but I have the problem when the dialog is moved

thanks

Marcelo

Posts: 408
Joined: Sun Nov 06, 2005 03:55 PM
Re: Incremental Search
Posted: Tue May 06, 2014 06:04 PM

We used a listbox and set the bMoved of the parent to destroy the listbox which is triggered with the parent dialog is moved. When it is redrawn it references from the Get field it is displaying options for and therefore redraws it in the correct place. We are trying to move all of our code outside of the get class using extend class in xHarbour, when complete I will post. We populate the options for selection outside of the class to an array inside the class so it doesn't matter how you get your data (Dbf, Sql, Soap, Json).

Thanks,

Byron Hopp

Matrix Computer Services
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Incremental Search
Posted: Wed May 07, 2014 02:34 PM
Marcelo,

use combobox always is a possibility, but when we have huge data it is not an option


With large data you can use a dbcombo control. It looks like a combobox but uses a database instead of an array.

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Incremental Search
Posted: Wed May 07, 2014 03:43 PM
Marcelo,

See FWH\samples\testdbc1.prg for a dbcombo example. To turn on incremental searching, you will need to set oDBC1:lIncSearch:=.t. (it defaults to .f.).

If you want the control's list to open automatically when the user starts typing add this line:

Code (fw): Select all Collapse
oDBC1:bKeyDown:={|| if(len(trim(cStateID))>=1,(oDBC1:open(),oDBC1:refresh()),)}

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Incremental Search
Posted: Wed May 07, 2014 05:48 PM
James,

James Bott wrote:With large data you can use a dbcombo control. It looks like a combobox but uses a database instead of an array.


DbCombo uses a standard combobox, so we cannot use it for large data.

EMG
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Incremental Search
Posted: Wed May 07, 2014 08:23 PM

Enrico,

Ah yes, of course you are right.

I have used dbcombo's for some rather large databases without trouble. Normally, you would be using a filter also to filter out only unique items so the array would be smaller than the database.

I am having a hard time thinking of a situation where you would need millions of items in a control. It is usually something like cities, surnames, etc. Marcelo, perhaps you can give us an example? Also, how large is large?

Best Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 408
Joined: Sun Nov 06, 2005 03:55 PM
Re: Incremental Search
Posted: Wed May 07, 2014 09:27 PM

We set ours to 5, it is incremental so it updates with every keystroke, I believe that having to utilize the scroll bar is not as helpful in this type of feature. We go our of our way not to show the scroll bar on the right. I just tested with Google and their incremental search displays 6 items. We are using Json on the application to transport the data so less is better for this feature. So every time you hit a key at most it sends 5 back. We do a "Select distinct top 5 <field> from <table> order by <field>". Right now we are having big problems with Json when attempting to search for "xharbour / fivewin" the forward slash causes great issues. We are trying to nail this down. Any recommendations would be greatly appreciated.

Thanks,

Byron Hopp

Matrix Computer Services
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: Incremental Search
Posted: Thu May 08, 2014 04:10 PM

James,

I think not for the data size only can be interesting this type of control, it is easy for the user we can define how we can search the data and we don't need to use mouse, with combox is similar but not equal.

I will try to post some samples to evaluate the proposal

regards

Marcelo