DCBROWSE highlight
DCBROWSE highlight
Is there any way to get the highlight in a browse to show with both a row and a cell highlight at the same time?
The browse would use cell navigation as normal but the rest of the row would get highlighted in a different color.
I don't think it has been done yet but it seems like it might be a useful possibility as it would make reading the data in a browse easier. And it seems it might be possible due to ownerdraw being available.
The browse would use cell navigation as normal but the rest of the row would get highlighted in a different color.
I don't think it has been done yet but it seems like it might be a useful possibility as it would make reading the data in a browse easier. And it seems it might be possible due to ownerdraw being available.
- Attachments
-
- An example of what I mean...
- Browse Highlight with row and cell highlight at the same time.png (28.88 KiB) Viewed 15009 times
Regan Cawkwell
Real Business Applications Ltd
http://www.rbauk.com
Real Business Applications Ltd
http://www.rbauk.com
Re: DCBROWSE highlight
Hi Regan,
I think this is the answer to your question:
I think this is the answer to your question:
Code: Select all
DCBROWSECOL FIELD klant->naam HEADER fMessage(2101) PARENT oBrowse WIDTH 18 ;
COLOR bCOlor;
EVAL {|o|o:DataArea:DrawMode := XBP_DRAW_OWNER}
Re: DCBROWSE highlight
You should be able to do this without the use of owner drawing.
You need to use the ITEMMARKED callback:
@ DCBROWSE .. ITEMMARKED {|a,b,o|sethilitecolor(o)}
STATIC FUNCTION setHiliteColor( oBrowse )
LOCAL oColumn := oBrowse:GetColumn(1), i
oColumn:dataArea:setcellHiliteColor( oBrowse:rowPos,GRA_CLR_DARKRED,GRA_CLR_CYAN, .t. )
FOR i := 2 TO oBrowse:colCount
oColumn:dataArea:setcellHiliteColor( oBrowse:rowPos,GRA_CLR_DARKBLUE,GRA_CLR_YELLOW, .t. )
NEXT
You need to use the ITEMMARKED callback:
@ DCBROWSE .. ITEMMARKED {|a,b,o|sethilitecolor(o)}
STATIC FUNCTION setHiliteColor( oBrowse )
LOCAL oColumn := oBrowse:GetColumn(1), i
oColumn:dataArea:setcellHiliteColor( oBrowse:rowPos,GRA_CLR_DARKRED,GRA_CLR_CYAN, .t. )
FOR i := 2 TO oBrowse:colCount
oColumn:dataArea:setcellHiliteColor( oBrowse:rowPos,GRA_CLR_DARKBLUE,GRA_CLR_YELLOW, .t. )
NEXT
The eXpress train is coming - and it has more cars.
Re: DCBROWSE highlight
This is an excellent, very clean solution and one I have been looking for. One minor change in the FOR loop made this work for me:
@ DCBROWSE .. ITEMMARKED {|a,b,o|sethilitecolor(o)}
STATIC FUNCTION setHiliteColor( oBrowse )
LOCAL oColumn := oBrowse:GetColumn(1), i
oColumn:dataArea:setcellHiliteColor( oBrowse:rowPos,GRA_CLR_DARKRED,GRA_CLR_CYAN, .t. )
FOR i := 2 TO oBrowse:colCount
oColumn := oBrowse:GetColumn(i) // add this line
oColumn:dataArea:setcellHiliteColor( oBrowse:rowPos,GRA_CLR_DARKBLUE,GRA_CLR_YELLOW, .t. )
NEXT
@ DCBROWSE .. ITEMMARKED {|a,b,o|sethilitecolor(o)}
STATIC FUNCTION setHiliteColor( oBrowse )
LOCAL oColumn := oBrowse:GetColumn(1), i
oColumn:dataArea:setcellHiliteColor( oBrowse:rowPos,GRA_CLR_DARKRED,GRA_CLR_CYAN, .t. )
FOR i := 2 TO oBrowse:colCount
oColumn := oBrowse:GetColumn(i) // add this line
oColumn:dataArea:setcellHiliteColor( oBrowse:rowPos,GRA_CLR_DARKBLUE,GRA_CLR_YELLOW, .t. )
NEXT
Re: DCBROWSE highlight
Thanks for correcting my error.One minor change in the FOR loop made this work for me:
The eXpress train is coming - and it has more cars.
Re: DCBROWSE highlight
I'm afraid I just tried that code and it does not work for me.
It changes the highlight color of the first column but the cells in the other columns remain unhilited.
If I change the cursor mode to row, the 1st column is highighted in cyan and the rest are in yellow but then of course I lose the cell navigation.
I might come back to this later as I can understand what it should do but I think something is interfering with it's usage.
It couldn't be a manifest / visual styles issue again, could it?
It changes the highlight color of the first column but the cells in the other columns remain unhilited.
If I change the cursor mode to row, the 1st column is highighted in cyan and the rest are in yellow but then of course I lose the cell navigation.
I might come back to this later as I can understand what it should do but I think something is interfering with it's usage.
It couldn't be a manifest / visual styles issue again, could it?
Regan Cawkwell
Real Business Applications Ltd
http://www.rbauk.com
Real Business Applications Ltd
http://www.rbauk.com
Re: DCBROWSE highlight
It hadn't occurred to me that you were using XBPBRW_CURSOR_CELL.but then of course I lose the cell navigation.
Your question is framed in such a way that I thought you were using XBPBRW_CURSOR_ROW.
So then, it appears that I am answering the wrong question.
I need to see more of your code.
The eXpress train is coming - and it has more cars.
Re: DCBROWSE highlight
Sorry, Roger,
I obviously didn't frame the question well at all. I should have mentioned XBPBRW_CURSOR_CELL specifically.
Could this be down to the fact that when XBPBRW_CURSOR_CELL is used, the change to the internal highlight coloring on the other columns is made but not repainted?
I obviously didn't frame the question well at all. I should have mentioned XBPBRW_CURSOR_CELL specifically.
Could this be down to the fact that when XBPBRW_CURSOR_CELL is used, the change to the internal highlight coloring on the other columns is made but not repainted?
Regan Cawkwell
Real Business Applications Ltd
http://www.rbauk.com
Real Business Applications Ltd
http://www.rbauk.com
Re: DCBROWSE highlight
After working with this a bit more, I think i found a solution for you.
The below sample shows solutions for both Row cursor and Cell cursor.
The below sample shows solutions for both Row cursor and Cell cursor.
Code: Select all
#INCLUDE "dcdialog.CH"
#INCLUDE "appevent.CH"
FUNCTION Main()
LOCAL GetList[0], aDir := Directory(), oBrowse1, oBrowse2, i
@ 0,0 DCBROWSE oBrowse1 DATA aDir SIZE 100, 15 ;
FONT '10.Lucida Console' ;
CURSORMODE XBPBRW_CURSOR_ROW ;
ITEMMARKED {|a,b,o|SetHiliteColorRow(o,aDir), ;
DC_ClearEvents()}
FOR i := 1 TO 10
DCBROWSECOL ELEMENT i HEADER Alltrim(Str(i)) WIDTH 10 PARENT oBrowse1
NEXT
@ 17,0 DCBROWSE oBrowse2 DATA aDir SIZE 100, 15 ;
FONT '10.Lucida Console' ;
CURSORMODE XBPBRW_CURSOR_CELL ;
ITEMMARKED {|a,b,o|SetHiliteColorCell(o,aDir), ;
DC_ClearEvents()} ;
FOR i := 1 TO 10
DCBROWSECOL ELEMENT i HEADER Alltrim(Str(i)) WIDTH 10 PARENT oBrowse2
NEXT
DCREAD GUI FIT TITLE 'Cursor Color Test' ;
EVAL {||SetHiliteColorCell(oBrowse2,aDir)}
RETURN nil
* ---------
PROC appsys ; RETURN
* ---------
STATIC FUNCTION SetHiliteColorRow( oBrowse, aDir )
LOCAL i, oColumn, aData := aDir[oBrowse:arrayElement]
FOR i := 1 TO oBrowse:colCount
oColumn := oBrowse:getColumn(i)
IF aData[2] > 10000 // file size
oColumn:dataArea:setcellHiliteColor( oBrowse:rowPos,GRA_CLR_WHITE,GRA_CLR_RED, .t. )
ELSE
oColumn:dataArea:setcellHiliteColor( oBrowse:rowPos,GRA_CLR_WHITE,GRA_CLR_BLUE, .t. )
ENDIF
NEXT
RETURN nil
* ---------
STATIC FUNCTION SetHiliteColorCell( oBrowse, aDir )
STATIC snRow
LOCAL i, oColumn, aData := aDir[oBrowse:arrayElement]
IF !Empty(snRow)
FOR i := 1 TO oBrowse:colCount
oColumn := oBrowse:getColumn(i)
oColumn:dataArea:setcellColor( snRow,GRA_CLR_BLACK,GRA_CLR_WHITE, .t. )
NEXT
ENDIF
FOR i := 1 TO oBrowse:colCount
oColumn := oBrowse:getColumn(i)
oColumn:dataArea:setcellColor( oBrowse:rowPos-1,GRA_CLR_BLACK,GRA_CLR_WHITE, .t. )
oColumn:dataArea:setcellColor( oBrowse:rowPos+1,GRA_CLR_BLACK,GRA_CLR_WHITE, .t. )
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
NEXT
snRow := oBrowse:rowPos
RETURN nil
The eXpress train is coming - and it has more cars.
Re: DCBROWSE highlight
Thanks Roger.rdonnay wrote:After working with this a bit more, I think i found a solution for you.
The below sample shows solutions for both Row cursor and Cell cursor.
I will try it later today, hopefully.
Regan Cawkwell
Real Business Applications Ltd
http://www.rbauk.com
Real Business Applications Ltd
http://www.rbauk.com