#include 'fivewin.ch'
#include 'ord.ch'
#include 'xbrowse.ch'
#include 'hbcompat.ch'
REQUEST DBFCDX
static cSeek := ''
static oSeek
function Main()
local oDlg, oBrw
RDDSETDEFAULT( "DBFCDX" )
USE CUSTOMER
SET ORDER TO TAG FIRST
GO TOP
DEFINE DIALOG oDlg SIZE 600,400 PIXEL
@ 30,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
AUTOCOLS ALIAS "CUSTOMER" CELL LINES NOBORDER
@ 10,10 SAY oSeek PROMPT cSeek SIZE 100,10 PIXEL ;
OF oDlg COLOR CLR_BLACK,CLR_YELLOW
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 )
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:SetText( cSeek )
if lStay
DBGOTO( nRecNo )
oBrw:Refresh()
else
oBrw:Refresh( .t. )
endif
lFound := .t.
endif
endif
endif
return lFound
xBrowse is too much powerfull!!!
#include 'fivewin.ch'
#include 'ord.ch'
#include 'xbrowse.ch'
#include 'hbcompat.ch'
REQUEST DBFCDX
//----------------------------------------------------------------------------//
function Main()
local oDlg, oBrw
RDDSETDEFAULT( "DBFCDX" )
USE CUSTOMER
SET ORDER TO TAG FIRST
GO TOP
DEFINE DIALOG oDlg SIZE 600,400 PIXEL
@ 30,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
AUTOCOLS AUTOSORT ALIAS "CUSTOMER" CELL LINES NOBORDER
oBrw:lIncrFilter := .t.
oBrw:lSeekWild := .t.
@ 10,10 SAY oBrw:oSeek PROMPT oBrw:cSeek SIZE 100,10 PIXEL ;
OF oDlg COLOR CLR_BLACK,CLR_YELLOW PICTURE '@!'
oBrw:CreateFromCode()
ACTIVATE DIALOG oDlg CENTERED
return nil
//----------------------------------------------------------------------------//
ukservice wrote:Hello.
Is possible to use a Get?
Thank you.
#include 'fivewin.ch'
#include 'ord.ch'
#include 'xbrowse.ch'
#include 'hbcompat.ch'
REQUEST DBFCDX
static cSeek := ''
static oSeek
function Main()
local oDlg, oBrw
RDDSETDEFAULT( "DBFCDX" )
USE CUSTOMER
SET ORDER TO TAG FIRST
GO TOP
DEFINE DIALOG oDlg SIZE 600,400 PIXEL
@ 30,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
AUTOCOLS ALIAS "CUSTOMER" CELL LINES NOBORDER
* @ 10,10 SAY oSeek PROMPT cSeek SIZE 100,10 PIXEL ;
* OF oDlg COLOR CLR_BLACK,CLR_YELLOW
@ 10,10 GET oSeek VAR cSeek SIZE 100,10 PIXEL ;
OF oDlg COLOR CLR_BLACK,CLR_YELLOW
oSeek: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
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 47 guests