- Code: Select all Expand view
#include "Fivewin.ch"
#define MO_NONE 0
#define MO_ASC 1
#define MO_DESC 2
FUNCTION MAIN()
LOCAL oDlg, oBrw
USE TEST
DEFINE DIALOG oDlg SIZE 400, 300
oBrw = TMyWBrowse():New( 0, 0, , ,;
{ || { TEST -> last, TEST -> first, "" } },;
{ "LAST", "FIRST", "" },;
{ 150, 150, 0 } )
oBrw:lCellStyle = .T.
oBrw:abOrd = { { || MO_ASC }, { || MO_DESC }, { || MO_NONE }, { || MO_NONE } }
ACTIVATE DIALOG oDlg;
ON INIT oDlg:SetControl( oBrw );
CENTER
CLOSE
RETURN NIL
CLASS TMyWBrowse FROM TWBrowse
DATA abOrd
METHOD Paint()
ENDCLASS
#define SM_CYHSCROLL 3
METHOD Paint() CLASS TMyWBrowse
LOCAL aValues := ::aHeaders
LOCAL aColSizes := ::GetColSizes()
LOCAL nWidth := WNDWIDTH( ::hWnd ) - IF( ::oVScroll != nil .AND. EVAL( ::bLogicLen ) > 1, GETSYSMETRICS( SM_CYHSCROLL ) + 3, 0 )
LOCAL nColStart := -1
LOCAL nTop, nLeft, nRight
LOCAL hGPen, hWPen
LOCAL i
Super:Paint()
hGPen = CREATEPEN( 0, 1, CLR_GRAY )
hWPen = CREATEPEN( 0, 1, CLR_WHITE )
nTop = 3
FOR i = ::nColPos TO LEN( aValues )
nLeft = nColStart + 1
nRight = MIN( nColStart := ( nLeft + aColSizes[ i ] - 1 ), nWidth )
IF nLeft > nWidth
EXIT
ENDIF
IF i == LEN( aValues )
nRight = nWidth
ENDIF
nRight -= 10
IF EVAL( ::abOrd[ i ] ) = MO_ASC
MOVETO( ::hDC, nRight, nTop )
LINETO( ::hDC, nRight + 6, nTop, hGPen )
LINETO( ::hDC, nRight + 3, nTop + 6, hWPen )
LINETO( ::hDC, nRight, nTop, hGPen )
ENDIF
IF EVAL( ::abOrd[ i ] ) = MO_DESC
MOVETO( ::hDC, nRight, nTop + 6 )
LINETO( ::hDC, nRight + 6, nTop + 6, hGPen )
LINETO( ::hDC, nRight + 3, nTop, hWPen )
LINETO( ::hDC, nRight, nTop + 6, hGPen )
ENDIF
NEXT
DELETEOBJECT( hWPen )
DELETEOBJECT( hGPen )
RETURN 0
EMG