FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to define xBrowse-textcolor on diff. Backgrounds ?
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
How to define xBrowse-textcolor on diff. Backgrounds ?
Posted: Fri Jun 17, 2011 07:04 PM
Hello,

I have a problem, to define the xBrowse-textcolor on different Backgrounds.
I tested many dfferent Settings, but doesn't work.
It seems, the needed Color is detected from Background.
Is it possible to define the Main-texcolor like Ligthblue ( same Color like Title )instead of White ?
I tested the different Solutions :



nFColor = Title-textcolor

WITH OBJECT oBrw1
:nStretchCol := 1
:nMarqueeStyle := 4
:bClrSelFocus := { || { nFColor, aSelGrad } }
:bClrRowFocus := { || { nFColor, aRowGrad } }
:bClrSel = { || { nFColor, aRowGrad } }

// :bClrSel = { || { 0, aRowGrad } }

// :bClrSelFocus = { || { nFColor, } }
// :bClrSel = { || { nFColor, } }
// :bRowFocus = { || { nFColor, 16777215 } }
:SetColor( nFColor, )
END



Best Regards
Uwe :-)
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.
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: How to define xBrowse-textcolor on diff. Backgrounds ?
Posted: Sat Jun 18, 2011 03:15 AM

By default, XBrowse uses ContrastColor to paint text, when pictures are gradients are used as background. This is intended to ensure that text is visible in each cell whether the background in that cell is dark or light. This contrast color is derived from the background color of the cell.

This behavior can be disabled by setting oBrw:lContrastClr := .f. In such a case the text color used in bClrStd is used whether or not the color is visible over the background.

Regards



G. N. Rao.

Hyderabad, India
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: How to define xBrowse-textcolor on diff. Backgrounds ?
Posted: Sat Jun 18, 2011 07:52 AM
Mr. Rao,

thank You very much.

The Option is added :



Best Regards
Uwe :-)
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.
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: How to define xBrowse-textcolor on diff. Backgrounds ?
Posted: Tue Jun 21, 2011 07:26 PM
I don't know why, but sometimes I don't get the expexted Results with :
oBrw:lContrastClr := .T.

The Browser on Main-screen :
because Gradient-color white is centered, the Text-color on Bottom Row must be white as well.
The last right Cell-textcolor is black with the same Background-color from the Cell before.



The same Browser zoomed to double Size with different Results :
Because the Background-color of Row 2 is the same for Cell 2, there is no Reason, to show the Text in black.
Texdtcolor White on Browser-bottom is missing.



Maybe a GRADIENT-problem ? Image seems to be OK.



Another Problem : changing the cell-focus :



Maybe a Color-problem ? This Color-sample works fine.



Best Regards
Uwe :-)
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.
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: How to define xBrowse-textcolor on diff. Backgrounds ?
Posted: Wed Jun 22, 2011 03:50 AM

Mr. Uwe

This is the logic adopted inside XBrowse. The luminance of the center line of each cell is calculated and if it exceeds a particular limit, black color is chosen and otherwise white color is chosen. The luminance may vary between adjacent cells even in a single row when image backgrounds are used. The results may not always be exact, but in a majority of cases, visiblity of text on any background is ensured. This logic is used only when gradient or image backgrounds are chosen. In all other cases, the programmer specified color is used.

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion