possible with xBrowse?
possible with xBrowse?
Hello.
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
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
Saludos,
Eduardo
Eduardo
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: possible with xBrowse?
I prepared a sample for Incremental Filter using \fwh\samples\customer.dbf. The incremental filter is applied to the field "FIRST". You may test this on customer.dbf first and then adopt to your dbf structure and requirements.
Instead of using WildMatch function we could use simple "$" also. But by using WildMatch function, the user can enter wildcard character "?" inside the search expression.
Code: Select all
#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
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: possible with xBrowse?
Thank you very much.
It works perfect.
xBrowse is too much powerfull!!!.
It works perfect.
xBrowse is too much powerfull!!!.
Saludos,
Eduardo
Eduardo
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: possible with xBrowse?
Will become more powerful.xBrowse is too much powerfull!!!
Incremental filters like the above will be provided natively in the XBrowse from the next version.
Then the application code to achieve the above can be as small as:
Code: Select all
#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
//----------------------------------------------------------------------------//
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: possible with xBrowse?
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.
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.
Saludos,
Eduardo
Eduardo
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: possible with xBrowse?
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
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
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: possible with xBrowse?
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.
Which is please the equivalent in ADS for cFilter := 'hb_WildMatch( "*' + Upper(cPattern) + '*", DbRecordInfo( 9 ))' , so I can search in all fieds ?
Thank you.
Saludos,
Eduardo
Eduardo
Re: possible with xBrowse?
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...).
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...).
FWH 11.11, Harbour 3.1 and Borland C++ 5.82
Re: possible with xBrowse?
Hello.
Is possible to use a Get?
Thank you.
Is possible to use a Get?
Thank you.
FWH 11.11, Harbour 3.1 and Borland C++ 5.82
Re: possible with xBrowse?
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.
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.
FWH 11.11, Harbour 3.1 and Borland C++ 5.82
Re: possible with xBrowse?
Hello.
I would appreciate an answer.
Thank you very much.
I would appreciate an answer.
Thank you very much.
FWH 11.11, Harbour 3.1 and Borland C++ 5.82
- MdaSolution
- Posts: 401
- Joined: Tue Jan 05, 2010 2:33 pm
Re: possible with xBrowse?
On ribbon I use TSSAY class run ok
instead on ADD BUTTON SAYBUTTON it is not transparent
instead on ADD BUTTON SAYBUTTON it is not transparent
FWH .. BC582.. xharbour
- MdaSolution
- Posts: 401
- Joined: Tue Jan 05, 2010 2:33 pm
Re: possible with xBrowse?
ukservice wrote:Hello.
Is possible to use a Get?
Thank you.
I think it can be possible only you must change also the
oSeek:SetText( cSeek )
I 'm thinking with
oSeek:cText( cSeek )
oSeek:REFRESH()
Last edited by MdaSolution on Mon Aug 29, 2011 11:53 am, edited 1 time in total.
FWH .. BC582.. xharbour
- MdaSolution
- Posts: 401
- Joined: Tue Jan 05, 2010 2:33 pm
Re: possible with xBrowse?
TRY IT HERE RUN OK
version with A get
version with A get
Code: Select all
#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
FWH .. BC582.. xharbour
Re: possible with xBrowse?
Mr. 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.
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.
FWH 11.11, Harbour 3.1 and Borland C++ 5.82