DCBROWSE highlight

This forum is for eXpress++ general support.
Message
Author
User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCBROWSE highlight

#11 Post by rdonnay »

Here is another improvement.
Replace SetHiliteColorCell() with the below code.
It is faster and prevents flicker.

Code: Select all

STATIC FUNCTION SetHiliteColorCell( oBrowse )

LOCAL i, j, oColumn, nColorFG, nColorBG

FOR j := 1 TO oBrowse:rowCount
  FOR i := 1 TO oBrowse:colCount
    oColumn := oBrowse:getColumn(i)
    IF oBrowse:rowPos # j
      oColumn:dataArea:getCellColor( j, @nColorFG, @nColorBG)
      IF nColorFG # GRA_CLR_BLACK .OR. nColorBG # GRA_CLR_WHITE
        oColumn:dataArea:setCellColor( j,GRA_CLR_BLACK,GRA_CLR_WHITE, .t. )
      ENDIF
    ELSE
      IF oBrowse:colPos == i
        oColumn:dataArea:setCellHiliteColor( oBrowse:rowPos,GRA_CLR_BLACK,GRA_CLR_CYAN, .t. )
      ELSE
        oColumn:dataArea:setCellColor( oBrowse:rowPos,GRA_CLR_BLACK,GRA_CLR_YELLOW, .t. )
      ENDIF
    ENDIF
  NEXT
NEXT

RETURN nil
The eXpress train is coming - and it has more cars.

reganc
Posts: 259
Joined: Thu Jan 28, 2010 3:08 am
Location: Hersham, Surrey, UK
Contact:

Re: DCBROWSE highlight

#12 Post by reganc »

rdonnay wrote:Here is another improvement.
Replace SetHiliteColorCell() with the below code.
It is faster and prevents flicker.
Roger, that works great.

I had tried your previous one and had a few issues with the browse repainting but most of that seemed to be down to the speed it was doing stuff.

I can see that the actual coloring is the thing that takes the time. I had tried various things but I didn't think about doing a full browse 'test and repaint only if necessary' in a set of loops like that. I'm kicking myself as I hadn't thought of it.

Well done, and thank you very much.
Regan Cawkwell
Real Business Applications Ltd
http://www.rbauk.com

Post Reply