trichview.com

trichview.support




Re: disabled color


Return to index


Author

Message

David Novo

Posted: 10/11/2004 7:04:34


Hi Sergey,


Changing the .color property in this case is a bit of a pain. Here is a

sample of how I would have to do it


procedure myRich.setEnabled(value:boolean)

begin

       if value=false then color:=clGrey;

end


but now I have forgotten the original color. So I have to create a temp

variable to remember the enabled color. Ok, no big deal. But now what

happens if someone changes the .color property programatically to clRed

while the button is disabled. Then the color will change from clGrey to

cl_red, but when the richview becomes enabled, it will go back to the

original color. So now I have to override setColor as well as

setEnabled.


I am not sure if there is an easy solution for this, aside from finding

the place where you actually paint the background on and changing your

code.


A suggestion (stolen from virtualStringTrees). He has a property called


.Colors which in your case would be like


TRichColors=class(Tpersistent)

property BackgroundColor:tColor;

property DisabledBackgroundColor:tColor;

property UnfocusedBackgroundColor:tColor;

etc.

etc.

end;


That way, you can add colors for different states of the component and

use them as needed. You can add states, as you need them.


Just a suggestion, in the meantime, I will try to figure something out.


-Dave




Sergey Tkachenko wrote:


> Hi,

>

> Background color of the whole window?

>

> It's defined in TRichView.Color, or (if TRichView.Color=clNone) in

> TRVStyle.Color.

> You can change these properties when the component disabled/enabled.

>

> > Hi Sergey, is there a quick way to set the disabled color of a

> > richviewedit?

> >

> > I'd like it to appear light gray when i disable it, but it appears

> > white.  What i was thinking of doing was overriding setEnabled, and

> > then just setting the color property in there.

> >

> > Is there a recommended way of doing it?

> >

> > Daniel





Powered by ABC Amber Outlook Express Converter