advice needed on get and combobox

advice needed on get and combobox

Postby Richard Chidiak » Mon Oct 01, 2007 8:21 am

Hello

I have a large table (coutry city names and zip codes) to check in my app.

Ideally this is a dbcombo feature, but unfortunately i get thrown out by xharbour for memory problems... The table has 50.000 entries. I am running a vista with 2 gb memory.

I have written a listbox (txbrowse) incremental search for it, and it works ok. My problem is calling this function meanwhile the get.

I have tried the valid clause, but this gets evaluated once the get is finished. This is what i am doing now because i have no other solution and it is not the best way.

Is there a way to type some characters in te get and have simultaneously a listbox showing values close to what you type ?

Ex : If i type P everything starting with p will appear, pa....etc

thanks for your help,

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Postby Antonio Linares » Mon Oct 01, 2007 11:35 am

Richard,

There is an incremental search on a browse sample in FWPPC\samples\TestBrwS.prg.

The source code is basically the same for FWH :-)
regards, saludos

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

Postby demont frank » Mon Oct 01, 2007 12:27 pm

Richard,

Some year's ago i wrote a combo class , using btnget and tsbrowse. It was on fivewin.info from patrick mast (TsCombox2.0)

The last month's it is rewritten for txbrowse. It can be used with array's (never tryed with 50000 records) , or from dbf

If you are intrested , i can send it.

Frank Demont
demont frank
 
Posts: 167
Joined: Thu Mar 22, 2007 11:24 am

Postby driessen » Mon Oct 01, 2007 1:38 pm

Richard,

I had a similar situation in my application.

I had a get-field to input the city, then I wanted to switch to a listbox to select the right city, then I wanted to return to my original window in which the city and the zip-code are shown.

What I did is this :
Code: Select all  Expand view

REDEFINE GET oGET[1] VAR cPPL ID 109 OF ParDlg PICTURE REPLICATE("X",40)
VALID (GemeenteOK("cPPNR","cPPL") .OR. ActGem("cPPNR","cPPL",ParDlg)) .AND. FocusSet(oGET[2]) UPDATE



Funtion "GemeenteOK()" checks if the zip-code(cPPNR) and the city (cPPL) belong together. If "Yes", ".T." is returned, otherwise ".F."

Function "ActGem()" shows me a listbox in a second window to select the right city and its connected zip-code. Of course you can make buttons to "Select" or "Deselect". It gives you also the opportunity to add a new city and zip-code if necessary. ".T." is always returned.

Function "FocusSet()" puts the focus on the next field. ".T." is always returned.

At the end, the VALID-clause is always ".T.", so it will never stop you of going on.

All this works very well.

Good luck.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Postby Richard Chidiak » Mon Oct 01, 2007 2:35 pm

Antonio

I am still using may 07 fwh, there is no testbrws in thie version .

I plan to upgrade to the next release though

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Postby Richard Chidiak » Mon Oct 01, 2007 2:35 pm

Franck

Yes please, il qill be glad to have it

my email is richard@cbati.com

thanks in advance
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Postby Richard Chidiak » Mon Oct 01, 2007 2:36 pm

Michel

Thanks for the suggestion, i will give it a try.

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Postby Antonio Linares » Mon Oct 01, 2007 10:05 pm

Richard,

Here you have the source code:
Code: Select all  Expand view
// FiveWin for Pocket PC - Testing browses with incremental search

#include "FWCE.ch"

REQUEST DBFCDX

//----------------------------------------------------------------------------//

function Main()

   local oWnd, oBrw, hBmp := ReadBitmap( CurDir() + "\go.bmp" )
   local oSay, cSearch := ""

   USE ( CurDir() + "\Customer" ) VIA "DBFCDX"
   if ! File( CurDir() + "\LAST.CDX" )
      INDEX ON Customer->Last TO ( CurDir() + "\LAST" )
   endif   
   Customer->( OrdSetFocus( "LAST" ) )
   Customer->( DbGoTop() )

   DEFINE WINDOW oWnd TITLE "IncSearch"
   
   @ 1, 1 LISTBOX oBrw ;
      FIELDS hBmp, Customer->Last, Customer->First ;
      HEADERS "", "Last", "First" ;
      SIZE 220, 167
   
   oBrw:bKeyChar = { | nKey, nFlags | Search( nKey, @cSearch ), oBrw:Refresh(),;
                                      oSay:Refresh() }
   
   @ 14,  2 SAY "Searching:" SIZE 60, 30
   @ 14, 12 SAY oSay PROMPT cSearch SIZE 80, 30
   
   ACTIVATE WINDOW oWnd ;
      ON CLICK MsgInfo( "Click!" )
   
return nil

//----------------------------------------------------------------------------//

function Search( nKey, cSearch )

   if nKey = 8
      cSearch = SubStr( cSearch, 1, Len( cSearch ) - 1 )
   else
      cSearch += Upper( Chr( nKey ) )
   endif
   
   Customer->( DbSeek( cSearch, .t. ) )

return nil

//----------------------------------------------------------------------------//
regards, saludos

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 79 guests

cron