Xbrowse colors

Xbrowse colors

Postby Silvio.Falconi » Tue Sep 17, 2019 8:58 am

Image
I colorize only some columns
the problem is when I use the MarqueeStyle I cannot use
:nMarqueeStyle := MARQSTYLE_HIGHLROW
or
:nMarqueeStyle := MARQSTYLE_HIGHLWIN7

because it not show the red colors of that columns

how I can resolve it ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: Xbrowse colors

Postby ukoenig » Tue Sep 17, 2019 10:42 am

Silvio,

the solution You are looking for ?

Image

regards
Uwe :?:
Last edited by ukoenig on Tue Sep 17, 2019 11:47 am, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Xbrowse colors

Postby Silvio.Falconi » Tue Sep 17, 2019 10:49 am

yes
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: Xbrowse colors

Postby ukoenig » Tue Sep 17, 2019 11:06 am

Silvio,

Code: Select all  Expand view  RUN

@ 0, 0 XBROWSE oBrw OF oWnd ;
ALIAS 'CUSTOMER' AUTOCOLS ;
LINES  
//I colorize only some columns
//the problem is when I use the MarqueeStyle I cannot use
oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROW
//or
//:nMarqueeStyle := MARQSTYLE_HIGHLWIN7
//because it not show the red colors of that columns

WITH OBJECT oBrw:aCols[ 3 ] // colored column
    :bPaintText := { | oCol, hDC, cText, aRect | ;
    DRAW_RECT( oCol, hDC, cText, aRect, 255 ) }
END

//------------------------

STATIC FUNCTION DRAW_RECT ( oCol, hDC, cText, aRect, nCellcolor )
LOCAL nTop      := aRect[ 1 ]
LOCAL nLeft     := aRect[ 2 ]
LOCAL nBottom   := aRect[ 3 ]
LOCAL nRight    := aRect[ 4 ]
LOCAL nFontHt  := GetTextHeight( oCol:oBrw:hWnd, hDC )
LOCAL nColor, Fieldvalue, hBrush1

IF nCellcolor <> NIL // Full cellcolor
     hBrush1 := CreateSolidBrush( nCellcolor )
     hOld1:= SelectObject( hBrush1 )
     FillRect( hDC, { nTop -1, nLeft -4, nBottom +1, nRight +2 }, hBrush1 )
     SelectObject( hOld1 )
     DeleteObject( hBrush1 )
ENDIF

//oCol:nDataStyle  0 = lefft, 1 = centered, 2 = right
DrawTextEx( hDC, cText, { nTop, nLeft, nTop + nFontHt + 4, nRight }, 0 ) //oCol:nDataStyle )

RETURN NIL  
 


regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Xbrowse colors

Postby Silvio.Falconi » Tue Sep 17, 2019 11:32 am

I cannot believe is not exist a command directly on xbrowse ...Nages ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: Xbrowse colors

Postby ukoenig » Tue Sep 17, 2019 11:49 am

Silvio,

with the solution from above it is possible to color a cellpart

FillRect( hDC, { nTop -1, nRight -20, nBottom +1, nRight +4 }, hBrush1 )

Image

regards
Uwe :D
Last edited by ukoenig on Tue Sep 17, 2019 12:57 pm, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Xbrowse colors

Postby Silvio.Falconi » Tue Sep 17, 2019 11:57 am

Uwe I have some column on red please see the picture I posted

AEval( oBrw:aCols, { |o| o:bClrStd := SetStdColor( o ) }, 2 )

static function SetStdColor( oCol )
return { || CellColor( oCol ) }

static function CellColor( oCol )

local aColor := { CLR_BLACK, CLR_WHITE }
local oBrw := oCol:oBrw
local nRow := oBrw:nArrayAt
local nCol := oCol:nCreationOrder
local cVal := oCol:Value

if ! Empty( cVal )
if nCol = 3 .or. ncol = 5 ;
.or. nCol= 7 .or. nCol= 9 .or. nCol= 11 ;
.or. nCol= 13 .or. nCol= 15 .or. nCol= 17 .or. nCol= 19 .or. nCol= 21
aColor := { CLR_WHITE, CLR_HRED }
else
aColor := { CLR_BLACK,CLR_WHITE }
endif
endif

return aColor
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: Xbrowse colors

Postby ukoenig » Tue Sep 17, 2019 12:59 pm

Silvio,

very short, just a few lines

Code: Select all  Expand view  RUN

@ 0, 0 XBROWSE oBrw OF oWnd ;
ALIAS 'CUSTOMER' AUTOCOLS LINES  

oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROW
oBrw:bClrStd:= {|| { 0, 16766638 } } // Black on LightBlue

nCol := 2 // start col
FOR I := 2 TO 7
    WITH OBJECT oBrw:aCols[ nCol ]
        :bPaintText := { | oCol, hDC, cText, aRect | ;
        DRAW_RECT( oCol, hDC, cText, aRect, 255 ) }
    END
    nCol += 2 // every 2. col
NEXT

//------------------------

STATIC FUNCTION DRAW_RECT ( oCol, hDC, cText, aRect, nCellcolor )
LOCAL nFontHt := GetTextHeight( oCol:oBrw:hWnd, hDC )

IF nCellcolor <> NIL // Full cellcolor
    hBrush1 := CreateSolidBrush( nCellcolor )
        hOld1   := SelectObject( hBrush1 )
    FillRect( hDC, { aRect[ 1 ] -1, aRect[ 2 ] -2, aRect[ 3 ] +1, aRect[ 4 ] + 1 }, hBrush1 )
    SelectObject( hOld1 )
    DeleteObject( hBrush1 )
ENDIF

DeleteObject( hBrush1 )

//oCol:nDataStyle  0 = lefft, 1 = centered, 2 = right
DrawTextEx( hDC, cText, { aRect[ 1 ], aRect[ 2 ], aRect[ 1 ] + nFontHt + 4, aRect[ 4 ] }, 0 ) //oCol:nDataStyle )

RETURN NIL  
 


Image

regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 34 guests