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
advice needed on get and combobox
- Richard Chidiak
- Posts: 946
- Joined: Thu Oct 06, 2005 7:05 pm
- Location: France
- Contact:
- Antonio Linares
- Site Admin
- Posts: 42516
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 75 times
- Contact:
-
- Posts: 167
- Joined: Thu Mar 22, 2007 11:24 am
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 :
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.
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
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.09 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.09 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
- Richard Chidiak
- Posts: 946
- Joined: Thu Oct 06, 2005 7:05 pm
- Location: France
- Contact:
- Richard Chidiak
- Posts: 946
- Joined: Thu Oct 06, 2005 7:05 pm
- Location: France
- Contact:
- Richard Chidiak
- Posts: 946
- Joined: Thu Oct 06, 2005 7:05 pm
- Location: France
- Contact:
- Antonio Linares
- Site Admin
- Posts: 42516
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 75 times
- Contact:
Richard,
Here you have the source code:
Here you have the source code:
Code: Select all | Expand
// 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
//----------------------------------------------------------------------------//