Page 1 of 1

Xbrowse header's sort bitmap

Posted: Sun Apr 06, 2014 4:10 pm
by Marcelo Via Giglio
Hello,

a suggestion when we don't need or don't like to show the sort bitmap in the xbrowse's columns, we can add a

Code: Select all

DATA lSortBmp  INIT .T.
 
then in the xBrowse sorce

In new Method add IF...

Code: Select all

   IF ::lSortBmp 
      hBmp        := FWBmpAsc()
      AAdd( ::aSortBmp, { hBmp, 0, nBmpWidth( hBmp ), nBmpHeight( hBmp ), nil, .F. } )
      hBmp        := FWBmpDes()
      AAdd( ::aSortBmp, { hBmp, 0, nBmpWidth( hBmp ), nBmpHeight( hBmp ), nil, .F. } )
   ENDIF
 
In destroy Method add IF ...

Code: Select all

   IF ::lSortBmp
      DeleteObject( ::aSortBmp[ 1 ][ 1 ] )
      DeleteObject( ::aSortBmp[ 2 ][ 1 ] )
   ENDIF
 
In METHOD HeaderWidth CLASS TXBrwColumn modify

Code: Select all

   
if ! Empty( aBitmap := ::aBitmap( If( ValType( ::nHeadBmpNo ) == 'B', Eval( ::nHeadBmpNo ), ::nHeadBmpNo ) ) )
      nWidth   += aBitmap[ BITMAP_WIDTH ] + BMP_EXTRAWIDTH
   elseif ! Empty( ::cSortOrder )
      nWidth += IF( ::oBrw:lSortBmp, ::oBrw:aSortBmp[ 1 ][ BITMAP_WIDTH ], 0 ) + BMP_EXTRAWIDTH // MVG
   endif
 
Finally
In METHOD PaintHeader CLASS TXBrwColumn Modify

Code: Select all

      if ! Empty( ::cOrder ) .AND. ::oBrw:lSortBmp
         aBitmap     := ::oBrw:aSortBmp[ If( ::cOrder == 'A', 1, 2 ) ]
         nBmpAlign   := AL_RIGHT
      elseif !Empty( aBitmap := ::aBitmap( nBmpNo ) )
         nBmpAlign   := ::nHeadBmpAlign
      endif
 
I hope Fivetech can evaluate this modifications

regards

Marcelo