initial run ok , them when I click on header it refresh the oBrw but not the nHeadBmpNo why ?
look this sample
- Code: Select all Expand view
#include "fivewin.ch"
REQUEST DBFCDX
function Main()
local oDlg, oBrw
local oDbf
local nOrder:= 1
oDbf :=TDatabase():Open( , "Customer", "DBFCDX", .T. )
oDbf:setorder(1)
DEFINE DIALOG oDlg SIZE 400,400 PIXEL TRUEPIXEL
@ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
DATASOURCE oDbf AUTOCOLS AUTOSORT CELL LINES NOBORDER
WITH OBJECT oBrw
*:AddBitmap( { "sort_up.bmp","sort_down.bmp" } )
:AddBitmap( { , } )
WITH OBJECT oBrw:aCols[1]
:AddBitmap( { "sort_up.bmp","sort_down.bmp" } )
:nHeadBmpNo := iif( nOrder == 1, 1, 2 )
:bLClickHeader :={ || SortDbf(2,oBrw,oDbf ) }
END
:CreateFromCode()
END
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT ( DeleteObject( oBrw:aSortBmp[ 1, 1 ] ), ;
DeleteObject( oBrw:aSortBmp[ 2, 1 ] ), ;
oBrw:aSortBmp := oBrw:aBitmaps, ;
oBrw:aBitmaps := {} )
return nil
FUNCTION SortDbf(nOrden, oBrw, oDbf )
LOCAL nRecno := oDbf:RecNo()
LOCAL nLen := Len( oBrw:aCols )
LOCAL n
local nBmp
FOR n := 1 TO nLen
* IF oBrw:aCols[ n ]:nHeadBmpNo != NIL .AND. oBrw:aCols[ n ]:nHeadBmpNo > 0
IF oBrw:aCols[ n ]:Cargo == nOrden
oBrw:aCols[ n ]:nHeadBmpNo := 1
nBmp:= 1
oDbf:Gotop()
ELSE
oBrw:aCols[ n ]:nHeadBmpNo := 2
nBmp:= 2
oDbf:GoBottom()
ENDIF
* ENDIF
* oBrw:aCols[1]:bOnChange := {|o|o:oBrw:RefreshHeaders()}
NEXT
oBrw:RefreshHeaders()
// oBrw:SetSortBmp( ".\bitmaps\sort_up.bmp",".\bitmaps\sort_down.bmp" )
oBrw:Refresh( .T. )
oBrw:SetFocus( .T. )
RETURN nBmp
give me error
Error description: Error BASE/1075 Argument error: >
Args:
[ 1] = B {|| ... }
[ 2] = N 0