I would like to know if it is possible to do with xBrowse, so results are updated in runtime mode:

Uploaded with ImageShack.us
See video: http://www.mediafire.com/?dxm8190tuai1yem
Thanks
Eduardo

#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 lFoundThank you very much.
It works perfect.
xBrowse is too much powerfull!!!.
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
//----------------------------------------------------------------------------//Incredible, Mr. Rao.
Also, to search the entire DB:
cFilter := 'hb_WildMatch( "' + Upper(cPattern) + '", DbRecordInfo( 9 ))'
But in ADS does not work, it says:
Error ADSCDX/0 Operation not supported
I think it will be very interesting to search in the entire db.
I would like to congratulate you for all the extraordinary work done with xBrowse, and especially your kindness to answer and explain in the forums. A gentleman and great master.
Thanks for reminding me about ADS. I realize the need to distinguish ADS in the code under development.
For ADS, particularly client server implementation with large tables, it is desirable that the filter expression can be resolved on the server and if possible optimized.
Instead of using wildmatch function, better to use <expr> $ <fld1>[ + <fld2> ...]. Though this expression is not optimized, used to give me reasonable results on large tables.
For full search, the filter expression you proposed is good for DBFCDX. For ADS, we may better use the FTS syntax and depend on the ADS's beautiful FTS capability
Thank you very much.
Which is please the equivalent in ADS for cFilter := 'hb_WildMatch( "' + Upper(cPattern) + '", DbRecordInfo( 9 ))' , so I can search in all fieds ?
Thank you.
Mr Nao,
Thank you very much for this very interesting sample.
I would like to know if it is possible to use a Get instead of a Say, because it is easier for customers, but the same behaviour (if I press S, it should filter records contaning S, if I add SA, filter with SA...).
Hello.
Is possible to use a Get?
Thank you.
Hello.
As I use a ribbon bar for add, delete, search, print, etc options, when a user clicks on it, focus is not on Say, or if the user press F1, say does not work.
That´s why I need Get, but it does not work, as ON CHANGE clause returns penultimate character, not last, so it does not work.
Any clue?.
Thank you.
Hello.
I would appreciate an answer.
Thank you very much.
On ribbon I use TSSAY class run ok
instead on ADD BUTTON SAYBUTTON it is not transparent
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 lFoundMr. Mda,
Thank you but with get does not work.
Please try to type in the xbrowse area, then go to get and erase and type again.
Hope Mr. Rao checks it.