[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: Background Color (return to default behavior after change)

Hi, Jared.

It's probably easier for you to cache the background color when your 
application starts, and compare to that if you need to.
Or even better, to keep track of whether or not you have set it (i.e. if you 
didn't set it, then it's still set at the default).

We wouldn't be able to change getBackground() to return null, because people 
rely on it that api always returning a color.
Note that if you do open a feature request to have new api something like 
"hasDefaultBackground()", it would have to be for foreground and font also. 
You would also have to explain why you need it - I'm a little unclear on 
that.

Carolyn

"Jared Warren" <jared.warren@xxxxxxxxx> wrote in message 
news:e7a5aedfdf886f7db7d9b0988c591a46$1@xxxxxxxxxxxxxxxxxx
> Further investigation reveals that I can call setBackground(null) to get 
> the Composite back into the "default" state.
>
> This will probably work for my immediate need; however, I don't see a way 
> to tell if the Composite was in the "default" state before the first 
> setBackground() (in other words, I can't handle the case where the 
> background was previously set to a non-default state, because I can't ask 
> the composite if it has been set or not.)
>
> Question:  If this were to be added (the ability to tell if a control's 
> background is in the default state), would it be more appropriate to have 
> "getBackground()" return "null", or would it be better to add an 
> "hasDefaultBackground()" method?
>