Rowcolor - only frame colored

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: Rowcolor - only frame colored

#11 Post by rdonnay »

CLASS XbpColumnLocal FROM XbpColumn
I am not going to make changes to my source code for this.

The color system in eXpress++ has satisfied nearly all users for over 20 years.
Anyone who would want something like this would need to make the changes to the code and support it without my help.

I am willing to make suggestions which will not affect my source code.
The eXpress train is coming - and it has more cars.

Victorio
Posts: 633
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: Rowcolor - only frame colored

#12 Post by Victorio »

Roger
On the row with the blue cursor, please explain to me which colors you want to see. (Foreground, Background).

What is the row color when the blue cursor is not covering it?
Is it black on green, or black on yellow?
In browser default colors are black text on white background. When cursor go to row, white text on blue background.
But rows in browser can have various colors of backgrounds for example black on orange, black on yellow,black on green, etc. its colored by acutally status by informations in row (browser is refreshing every 15 seconds and has informations about online processes running on server)

And when user on client PC browsing he see rows in various colors and colors tell him how status has every row. But when stay on some row, this row repaint by blue background. Because I thing about some
modity to fill not full surface row, but only his part for example frame.
But this is I thing complicated, I can realize it with some function to lighten colors, for example when on row is not cursor, then BG color is dark blue, when on row, then light blue etc.

Nice will be if can modify not only row height but also colored row height in parameter :
*aBrowPres := ;
* { { XBP_PP_COL_HA_FGCLR, GRA_CLR_WHITE }, /* Header FG Color*/ ;
* { XBP_PP_COL_HA_BGCLR, GRA_CLR_DARKGRAY }, /* Header BG Color */ ;
* { XBP_PP_COL_DA_ROWSEPARATOR, XBPCOL_SEP_DOTTED }, /* Row Sep */ ;
* { XBP_PP_COL_DA_COLSEPARATOR, XBPCOL_SEP_DOTTED }, /* Col Sep */ ;
* { XBP_PP_COL_DA_FGCLR, GRA_CLR_BLACK }, /* Row FG Color */ ;
* { XBP_PP_COL_DA_BGCLR, GRA_CLR_WHITE }, /* Row BG Color */ ;
* { XBP_PP_COL_DA_ROWHEIGHT, 16 }, /* Row Height */ ;
* { XBP_PP_COL_HA_HEIGHT, 10 }, /* Header Height */ ;
* { XBP_PP_HILITE_FGCLR, GRA_CLR_WHITE }, /* Hilite FG color */ ;
* { XBP_PP_HILITE_BGCLR, GRA_CLR_DARKBLUE }, /* Hilite BG color */ ;
* { XBP_PP_COL_FA_FGCLR, GRA_CLR_WHITE }, /* Footer FG Color */ ;
* { XBP_PP_COL_FA_BGCLR, GRA_CLR_DARKGRAY }, /* Footer BG Color */ ;
* { XBP_PP_COL_FA_HEIGHT, 10 } /* Footer Height */ ;
* }

If not exist simple solution, do not waste your time, it is not so important for the functionality of the application.

For test I add attachments in other file type

Thanks
Viktor
Attachments
rowcolor.gif
rowcolor.gif (8.84 KiB) Viewed 5841 times
rowcolor.jpg
rowcolor.jpg (47.21 KiB) Viewed 5841 times

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Rowcolor - only frame colored

#13 Post by rdonnay »

Compile and run this sample program.
It uses Ownerdrawing to change the foreground color of the row cursor to the background color of the data row.

Code: Select all

#INCLUDE "dcdialog.CH"

FUNCTION Main()

LOCAL GetList[0], aData, oBrowse, aBrowPres, bOwnerDraw, aRect := {0,0,0,0}

aData := { ;
   { 9,'VLA','NISTOR F',''}, ;
   { 1,'VLA','NISTOR F',''}, ;
   { 2,'VLA','NISTOR F',''}, ;
   { 9,'VLA','NISTOR F',''}, ;
   { 0,'VLA','NISTOR F',''} }

bOwnerDraw := {|a,b,o|DrawCellHighlighted(a,b,o,aData)}

@ 0,0 DCBROWSE oBrowse DATA aData SIZE 40,7 FIT ;
   COLOR {||RowColor(oBrowse,aData)} ;
   CURSORMODE XBPBRW_CURSOR_ROW ;
   USEVISUALSTYLE ;
   ITEMMARKED {||oBrowse:invalidateRect(aRect),aRect := GetRect(oBrowse)} ;
   OWNERDRAW bOwnerDraw

DCBROWSECOL ELEMENT 1 HEADER 'Num' WIDTH 4 PARENT oBrowse OWNERDRAW

DCBROWSECOL ELEMENT 2 HEADER 'Char 1' WIDTH 4 PARENT oBrowse OWNERDRAW

DCBROWSECOL ELEMENT 3 HEADER 'Char 2' WIDTH 15 PARENT oBrowse OWNERDRAW

DCBROWSECOL ELEMENT 4 HEADER '?' WIDTH 5 PARENT oBrowse OWNERDRAW

DCREAD GUI FIT

RETURN nil

PROC appsys ; RETURN

* -----------

STATIC FUNCTION RowColor( oBrowse, aData )

LOCAL nRow := oBrowse:arrayElement, aColor

IF nRow $ {1,2,4}
  aColor := { GRA_CLR_BLACK, GRA_CLR_GREEN }
ELSE
  aColor := { GRA_CLR_BLACK, GRA_CLR_YELLOW }
ENDIF

RETURN aColor

* ------------

STATIC FUNCTION DrawCellHighlighted( oPS, aInfo, oBrowse, aData )

LOCAL xData, nRow, aColor

xData := DC_XtoC(aInfo[ XBP_DRAWINFO_AREA ]:getCell( aInfo[ XBP_DRAWINFO_ITEM ] ))

nRow := aInfo[1]
aColor := RowColor( oBrowse, aData )

IF nRow == oBrowse:rowPos
  oPS:setColor( aColor[2] )
ELSE
  oPs:setcolor( aColor[1] )
ENDIF

GraCaptionStr( oPS, aInfo[ XBP_DRAWINFO_RECT ], ;
                   { aInfo[ XBP_DRAWINFO_RECT, 3 ], ;
                   aInfo[ XBP_DRAWINFO_RECT, 4 ] }, xData )

RETURN .f.

* ------------

STATIC FUNCTION GetRect( oBrowse )

LOCAL aRect

aRect := oBrowse:getColumn(1):dataArea:cellRect(oBrowse:rowPos)
aRect[3] += 1000
aRect[4] += 20

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

Victorio
Posts: 633
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: Rowcolor - only frame colored

#14 Post by Victorio »

Roger, thanks for example, this can be suitable solution, coloring text.

Victorio
Posts: 633
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: Rowcolor - only frame colored

#15 Post by Victorio »

Hi,
Only yesterday I work on it,
Roger, your solution is interesting, this can I use laters.

But this what I searching is as Wolfgang wrote, 4 elements of color help me. I do not know, what simple :dance: .
Now when I have for example COLOR {COLOR_WHITE,COLOR_DARKCYAN,COLOR_WHITE,COLOR_CYAN} this works fine, when not cursor on row, BKG color is dark cyan, when cursor on row, Light cyan and no default blue.

Now solved , thanks.

Post Reply