Incremental Search

Incremental Search

Postby byron.hopp » 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
byron.hopp
 
Posts: 347
Joined: Sun Nov 06, 2005 3:55 pm
Location: Southern California, USA

Re: Incremental Search

Postby cnavarro » Thu Mar 27, 2014 2: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
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Incremental Search

Postby Franklin Demont » Fri Mar 28, 2014 9: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
Franklin Demont
 
Posts: 166
Joined: Wed Aug 29, 2012 8:25 am

Re: Incremental Search

Postby Rick Lipkin » 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
User avatar
Rick Lipkin
 
Posts: 2617
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Incremental Search

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

Re: Incremental Search

Postby Marcelo Via Giglio » Mon Apr 21, 2014 4:24 pm

Buenos días,

I'm trying to do some think like this

Code: Select all  Expand view
#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
Marcelo Via Giglio
 
Posts: 1050
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: Incremental Search

Postby James Bott » Mon May 05, 2014 9:50 pm

Marcelo,

Why don't you just use a combox?

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

Re: Incremental Search

Postby Marcelo Via Giglio » Tue May 06, 2014 4: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
Marcelo Via Giglio
 
Posts: 1050
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: Incremental Search

Postby byron.hopp » Tue May 06, 2014 6: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
byron.hopp
 
Posts: 347
Joined: Sun Nov 06, 2005 3:55 pm
Location: Southern California, USA

Re: Incremental Search

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

Re: Incremental Search

Postby James Bott » Wed May 07, 2014 3: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: Select all  Expand view
oDBC1:bKeyDown:={|| if(len(trim(cStateID))>=1,(oDBC1:open(),oDBC1:refresh()),)}

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

Re: Incremental Search

Postby Enrico Maria Giordano » Wed May 07, 2014 5: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
User avatar
Enrico Maria Giordano
 
Posts: 8315
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Incremental Search

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

Re: Incremental Search

Postby byron.hopp » Wed May 07, 2014 9: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
byron.hopp
 
Posts: 347
Joined: Sun Nov 06, 2005 3:55 pm
Location: Southern California, USA

Re: Incremental Search

Postby Marcelo Via Giglio » Thu May 08, 2014 4: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
Marcelo Via Giglio
 
Posts: 1050
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], Silvio.Falconi and 72 guests