but not run ok
- Code: Select all Expand view
#include 'fivewin.ch'
#include 'xbrowse.ch'
FUNCTION MAIN()
local oDlg, oBrw, oFont, oBold
local aRowGrad, aSelGrad, aStdGrad
local n := RGB( 157, 248, 255 )
REQUEST DBFCDX
RDDSETDEFAULT ( "DBFCDX" )
SETBALLOON( .T. )
XbrNumFormat( 'E', .t. )
aRowGrad := { { .5, RGB( 232, 241, 252 ), RGB( 232, 241, 252 ) }, ;
{ .5, RGB( 210, 225, 244 ), RGB( 235, 243, 253 ) } }
aSelGrad := { { .5, RGB( 255, 255, 251 ), RGB( 255, 237, 178 ) }, ;
{ .5, RGB( 255, 218, 103 ), RGB( 255, 233, 162 ) } }
USE CUSTOMER
ORDCREATE( ,"CUST1","UPPER(FIRST)", {|| UPPER(FIRST) } , .F. )
ORDCREATE( ,"CUST2","UPPER(LAST)", {|| UPPER(LAST) } , .F. )
DEFINE FONT oFont NAME 'Tahoma' SIZE 0,-14
DEFINE FONT oBold NAME "TAHOMA" SIZE 0,-12 BOLD
DEFINE DIALOG oDlg SIZE 780,440 PIXEL ;
FONT oFont TITLE 'XBrowse Gradient Rows FWH 9.12'
DBSETORDER("CUST1")
@ 10,10 XBROWSE oBrw OF oDlg ;
SIZE 380,180 PIXEL ;
COLUMNS 'FIRST', "LAST", 'HIREDATE', 'MARRIED', 'SALARY' ;
ALIAS 'CUSTOMER' NOBORDER AUTOSORT //LINES
oBrw:Married:SetCheck() // Default FWH Bitmap is Alpha
WITH OBJECT oBrw:First
:AddBitmap( '\fwh\bitmaps\open2.bmp' ) // non-alpha bitmap
:bBmpData := { || 1 }
END
WITH OBJECT oBrw:HireDate
:AddBitmap( '\fwh\bitmaps\Alphabmp\task.bmp' ) // alpha
:bBmpData := { || 1 }
END
// Relevant Code
for n := 1 to Len( oBrw:aCols )
WITH OBJECT oBrw:aCols[ n ]
if FieldType( n ) != 'L'
:uBarGetVal := uValBlank( fieldGet( n ) )
if FieldType( n ) == 'N'
:cBarGetPic := NumPict( FieldLen( n ), FieldDec( n ) )
endif
endif
END
next
oBrw:lGetBar := .t.
// End of Relevant Code
WITH OBJECT oBrw
:nStretchCol := 1
:nMarqueeStyle := 4
:bClrSelFocus := { || { CLR_BLACK, aSelGrad } }
:bClrRowFocus := { || { CLR_BLACK, aRowGrad } }
:nHeaderHeight := 40 // optional
:oHeaderFonts := oBold
:bClrEdits := { || { CLR_BLACK, CLR_YELLOW } }
:AutoFit()
//
:CreateFromCode()
END
@ 200,12 BTNBMP PROMPT { || If( oBrw:lGetBar, "Hide GetBar", "ShowGetBar" ) } size 90,20 PIXEL OF oDlg FLAT ACTION ( oBrw:lGetBar := ! oBrw:lGetBar, oBrw:Refresh() )
@ 200,112 BTNBMP PROMPT "Set Filter" size 50,20 PIXEL OF oDlg FLAT ACTION ( ( oBrw:cAlias )->( SetFilter( oBrw ) ))
@ 200,192 BTNBMP PROMPT "Clear Filter" size 50,20 PIXEL OF oDlg FLAT ACTION (( oBrw:cAlias )->( DBCLEARFILTER(), oBrw:Refresh(), oBrw:SetFocus() ))
ACTIVATE DIALOG oDlg CENTERED
CLOSE CUSTOMER
RELEASE FONT oFont
RETURN NIL
static function SetFilter( oBrw )
local cFilter := ""
local n, oCol, uVal, cType
for n := 1 to Len( oBrw:aCols )
oCol := oBrw:aCols[ n ]
if ! Empty( uVal := oCol:uBarGetVal )
if !Empty( cFilter )
cFilter += " .AND. "
endif
cType := ValType( uVal )
do case
case cType == 'C'
uVal := Upper( AllTrim( uVal ) )
cFilter += '"' + uVal + '" $ UPPER( ' + FieldName( n ) + " )"
otherwise
cFilter += FieldName( n ) + " == " + cValToChar( uVal )
endcase
endif
next
if Empty( cFilter )
if ! Empty( DBFILTER() )
DBCLEARFILTER()
oBrw:Refresh()
endif
else
if !( DBFILTER() == cFilter )
SET FILTER TO &cFilter
GO TOP
oBrw:Refresh()
endif
endif
oBrw:SetFocus()
return nil
before show the getbar
you digit a name "Gary" and the set the filter and it show only Gary customer