Link to home
Start Free TrialLog in
Avatar of radixk
radixk

asked on

SWT detecting system color changes

I have a SWT app using the CTabFolder and I am setting it's color to a gradient based on the system colors.  It works perfectly and looks great.

The problem is that when the system colors are changed after the control is created it doesn't update the CTabFolder colors.  I think I need to add a listener to the display object but I can't seem to figure out what it is I should be listening for.  Also, since the tabs are created at runtime on demand, how would I loop through them and change the colors when the listener is fired?
Avatar of DrWarezz
DrWarezz

Yeah, you'll probably need to create a Thread to keep checking the system colours, and if they change, it updates the CTabFolder.

gL,
[r.D]
Avatar of radixk

ASKER

I figured this one out.

I created a Hashtable at startup and placed the current system colors in it.  I then created a paint listener in the CTabFolder and then compared the Hashtable to the current system colors.  If they're different, I set the colors and then update the hashtable with the current colors.

Works perfect.
Sounds nice ;)

Go here: https://www.experts-exchange.com/Community_Support/

And request a thread deletion and refund of points :)

best of luck for the future
[r.D]
ASKER CERTIFIED SOLUTION
Avatar of ee_ai_construct
ee_ai_construct
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial