I Know and I have a test how make it with one get or a say but there is not a test sample with more gets
I wish the final user can insert the first, Last, City and state to found a customer into xbrowse
I made this sample :
- Code: Select all Expand view
#include 'fivewin.ch'
#include 'ord.ch'
#include 'xbrowse.ch'
#include 'hbcompat.ch'
REQUEST DBFCDX
static cSeek := ''
static oSeek
function Main()
local oDlg, oBrw,oGrp1
local aGet[4]
local cFirst:=space(20)
local cLast :=space(20)
local cState:=space(2)
local cCity:=space(30)
SetGetColorFocus()
RDDSETDEFAULT( "DBFCDX" )
USE CUSTOMER
INDEX ON FIRST TAG FIRST TO TMFIRST MEMORY
INDEX ON LAST TAG LAST TO TMPLAST MEMORY
INDEX ON CITY TAG CITY TO TMPCITY MEMORY
INDEX ON STATE TAG STATE TO TMPSTATE MEMORY
SET ORDER TO TAG FIRST
GO TOP
Define DIALOG oDlg TITLE "Searching Customers - " ;
FROM 452, 774 to 870, 1303 PIXEL COLOR 0, 14215660 //FONT oFont
@ 1, 4 GROUP oGrp1 TO 65, 255 LABEL "Search" PIXEL;
OF oDlg COLOR 0, 14215660
@ 24, 11 SAY "&First:" SIZE 55, 7 PIXEL OF oDlg COLOR 0, 14215660
@ 38, 11 SAY "&Last :" SIZE 55, 7 PIXEL OF oDlg COLOR 0, 14215660
@ 54, 11 SAY "City:" SIZE 25, 7 PIXEL OF oDlg COLOR 0, 14215660
@ 54, 204 SAY "State:" SIZE 25, 7 PIXEL OF oDlg COLOR 0, 14215660
@ 22, 45 GET aGet[1] VAR cFirst SIZE 130, 10 PIXEL OF oDlg
@ 36, 45 GET aGet[2] VAR cLast SIZE 130, 10 PIXEL OF oDlg
@ 52, 45 GET aGet[3] VAR cState SIZE 130, 10 PIXEL OF oDlg
@ 52, 235 GET aGet[4] VAR cCity SIZE 14, 10 PIXEL OF oDlg
* cSeek := cFirst
@ 80,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
AUTOCOLS ALIAS "CUSTOMER" CELL LINES NOBORDER
* oSeek:bKeyDown := { | nKey | KeyChar( oBrw, nKey ) }
aGet[1]:bKeyDown := { | nKey | KeyChar( oBrw, nKey ) }
aGet[2]:bKeyDown := { | nKey | KeyChar( oBrw, nKey ) }
oBrw:bSeek := nil
oBrw:bKeyChar := { |nKey| KeyChar( oBrw, nKey ) }
oBrw:CreateFromCode()
ACTIVATE DIALOG oDlg CENTERED
RETURN NIL
static function KeyChar( oBrw, nKey )
If nKey == VK_BACK .and. ! Empty( cSeek )
( oBrw:cAlias )->( IncrFilter( oBrw, Left( cSeek, Len( cSeek ) -1 ) ) )
return 0
elseIf nKey > 31
( oBrw:cAlias )->( IncrFilter( oBrw, cSeek + Chr( nKey ) ) )
return 0
Endif
return nil
static function IncrFilter( oBrw, cPattern )
local cFilter, lFound := .f.
local nRecNo, cSaveFilt, lStay
if ValType( cPattern ) == 'C'
if Empty( cPattern )
cSeek := ""
* oSeek:SetText( cSeek )
oSeek:cText( cSeek )
oSeek:REFRESH()
SET FILTER TO !DELETED()
GO TOP
oBrw:Refresh()
lFound := .t.
else
cFilter := 'WildMatch( "*' + Upper(cPattern) + '*", UPPER( FIRST )) .AND. !DELETED()'
cSaveFilt := DBFILTER()
nRecNo := RECNO()
lStay := &cFilter
SET FILTER TO &cFilter
GO TOP
if OrdKeyCount() == 0
SET FILTER TO &cSaveFilt
GO TOP
DBGOTO( nRecNo )
else
cSeek := cPattern
oSeek:cText( cSeek )
oSeek:REFRESH()
if lStay
DBGOTO( nRecNo )
oBrw:Refresh()
else
oBrw:Refresh( .t. )
endif
lFound := .t.
endif
endif
endif
return lFound