- Code: Select all Expand view RUN
#include "fivewin.ch"
Function Main()
local oDlg, oBrw, oFont
local aData
USE CUSTOMER
aData := FW_DbfToArray( "FIRST,LAST,STATE" )
CLOSE CUSTOMER
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 700,500 PIXEL TRUEPIXEL FONT oFont
@ 60,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
DATASOURCE aData AUTOCOLS HEADERS "First", "Last", "State" ;
CELL LINES NOBORDER FOOTERS AUTOSORT
WITH OBJECT oBrw
:lIncrFilter:= .t.
:lSeekWild := .t.
:aCols[ 1 ]:bFooter := { || "Records : " + Str( oBrw:nLen ) }
:CreateFromCode()
END
@ 20,450 SAY oBrw:oSeek VAR oBrw:cSeek SIZE 150,20 PIXEL OF oDlg COLOR { 0,16777215 }
@ 10, 20 BTNBMP PROMPT "Set Filter" SIZE 200,40 PIXEL OF oDlg FLAT ;
ACTION ( xSetFilter( oBrw ), oBrw:SetFocus() )
@ 10,240 BTNBMP PROMPT "Clear Filter" SIZE 200,40 PIXEL OF oDlg FLAT ;
ACTION ( xClearFilter( oBrw ), oBrw:SetFocus() )
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
Return nil
Function xSetFilter( oBrw )
local cFilter := ""
local oCol, c
cFilter:= "'NY' $ Upper( cValToChar( aRow[3] ) )"
cFilter := "{ |c,aRow,oBrw| " + cFilter + " }"
oBrw:bFilterExp := &( cFilter )
oBrw:ArrayIncrFilter( "dummy" )
oBrw:Refresh()
oBrw:SetFocus()
Return .t.
Function xClearFilter( oBrw )
If oBrw:nLen < Len( oBrw:aArrayData )
oBrw:bKeyCount := { || Len( oBrw:aArrayData ) }
oBrw:Refresh()
Endif
oBrw:SetFocus()
If oBrw:nLen >= 2
ASort( oBrw:aArrayData,,, { |x, y| if( x[1]==y[1], x[2]<y[2], x[1]<y[1] ) })
EndIF
return .t.
Giving Set Filter filters it by State = "NY". I need to do incremental search on the filtered.
Thanks for the help
Regards