Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » Look and Chameleon Technology » [WIN] Chameleon - blocking style changes  () 1 Vote
[WIN] Chameleon - blocking style changes [message #41544] Fri, 27 December 2013 19:15 Go to next message
Zbych is currently offline  Zbych
Messages: 325
Registered: July 2009
Senior Member
Hi,

Is there a way to block chameleon style changes when system (win32) changes it's appearance?
I want to change default colors in my application, but every time system changes it's colors, my application changes them too.

Test case is simple, just run StylerTest from bazaar, set style to "StylerSkin" and then change your system style.
Re: [WIN] Chameleon - blocking style changes [message #41607 is a reply to message #41544] Sun, 05 January 2014 02:49 Go to previous messageGo to next message
bushman is currently offline  bushman
Messages: 134
Registered: February 2009
Experienced Member
Zbych wrote on Fri, 27 December 2013 15:15

Hi,

Is there a way to block chameleon style changes when system (win32) changes it's appearance?
I want to change default colors in my application, but every time system changes it's colors, my application changes them too.

Test case is simple, just run StylerTest from bazaar, set style to "StylerSkin" and then change your system style.


Good question! And you don't even need to change system style for that to happen: just putting your computer in standby mode (closing the lid of my laptop does it) and waking it up again is already enough to mess up with your style entirely.

Also running on windows (8.1)

Re: [WIN] Chameleon - blocking style changes [message #41633 is a reply to message #41544] Mon, 06 January 2014 19:09 Go to previous messageGo to next message
bushman is currently offline  bushman
Messages: 134
Registered: February 2009
Experienced Member
I tried overriding WndProc to react to WM_THEMECHANGED and WM_SYSCOLORCHANGE
LRESULT MyApp::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
	switch(message) {
		case WM_SYSCOLORCHANGE:
		case WM_THEMECHANGED:
			PostCallback(THISBACK(HandleChanges));
			return FALSE;
	}
	return TopWindow::WindowProc(message, wParam, lParam);
}
...

void MyApp::HandleChanges()
{
    RefreshMyAppStyle(); // call custom chameleon style implementation
    RefreshLayoutDeep(); // update GUI look
}


I got mixed results. It works fine when waking up from standby mode, fails miserably when switching to a high contrast theme in Windows 8.1, although style gets perfectly restored when switching back from high contrast theme to previous one.

That's all I got.
tks.
Re: [WIN] Chameleon - blocking style changes [message #41644 is a reply to message #41633] Tue, 07 January 2014 16:04 Go to previous messageGo to next message
Zbych is currently offline  Zbych
Messages: 325
Registered: July 2009
Senior Member
kropniczki wrote on Mon, 06 January 2014 19:09

I tried overriding WndProc to react to WM_THEMECHANGED and WM_SYSCOLORCHANGE



Thank you very much Edson. I just added one more message that should be ignored and it looks that changes are blocked.

LRESULT Kiosk::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
	switch(message) {
		case WM_SYSCOLORCHANGE:
		case WM_THEMECHANGED:
		case WM_SETTINGCHANGE:
			return FALSE;
	}
	return TopWindow::WindowProc(message, wParam, lParam);
}

Re: [WIN] Chameleon - blocking style changes [message #41667 is a reply to message #41644] Wed, 08 January 2014 14:26 Go to previous messageGo to next message
bushman is currently offline  bushman
Messages: 134
Registered: February 2009
Experienced Member
That's the missing message though! I was about to give up after dizzy hours sifting through msdn specs looking for the right msg. Sometimes you feel like a dog chasing its own tail.

It works perfectly. Thanks!






Re: [WIN] Chameleon - blocking style changes [message #41683 is a reply to message #41667] Fri, 10 January 2014 15:26 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
I have decided that because of many factors, it is not that good idea anyway to pick colors on system change, so it is now deleted and behaviour here made standard.

Mirek
Previous Topic: Why does ChPaint(..,img,...) have different behaviour with DRAW / PAINTER
Next Topic: Button font
Goto Forum:
  


Current Time: Thu Mar 28 12:16:49 CET 2024

Total time taken to generate the page: 0.01190 seconds