CXTButton
Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Skin Framework
Forum Description: Topics Related to Codejock Skin Framework
URL: http://forum.codejock.com/forum_posts.asp?TID=6279
Printed Date: 24 November 2024 at 8:14am Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: CXTButton
Posted By: Simon HB9DRV
Subject: CXTButton
Date Posted: 31 January 2007 at 3:17am
Hi Support,
How do I skin CXTButton using 10.4.2?
I've taken the SkinMDI Sample, changed the Normal button to CXTButton and no luck!
It's OK when it starts, as soon as I change the skin - it goes wrong.
I use CXTButton so that I can add bitmaps to buttons for my users, many of whom speak little or no English.
All help received with many, many thanks for an excellent product and support.
------------- Simon HB9DRV
|
Replies:
Posted By: Simon HB9DRV
Date Posted: 14 March 2007 at 4:47pm
Bump - not essential but it would be good to have this fixed for the next major release if possible.
------------- Simon HB9DRV
|
Posted By: Oleg
Date Posted: 16 March 2007 at 12:40am
Hi,
Set Style BS_XT_WINXP_COMPAT:
SetXButtonStyle(BS_XT_WINXP_COMPAT);
------------- Oleg, Support Team CODEJOCK SOFTWARE SOLUTIONS
|
Posted By: Simon HB9DRV
Date Posted: 16 March 2007 at 12:45am
oleg wrote:
Hi,
Set Style BS_XT_WINXP_COMPAT:
SetXButtonStyle(BS_XT_WINXP_COMPAT); |
Thanks - will try after taking dogs for a walk.
------------- Simon HB9DRV
|
Posted By: Simon HB9DRV
Date Posted: 16 March 2007 at 2:56am
oleg wrote:
Hi,
Set Style BS_XT_WINXP_COMPAT:
SetXButtonStyle(BS_XT_WINXP_COMPAT); |
Already tried that - doesn't help.
Here's what I have done:
- Changed the Normal button to class CXTButton.
- In CSkinPropertyPageControls::OnInitDialog() I set m_btnNormal.SetXButtonStyle(BS_XT_WINXP_COMPAT);
- I then select a new skin and the Normal button is not drawn correctly - it just looks like an old-fashioned button.
Have you tried changing the sample? I am using XP with VisualStudio 6.0.
Should I do something else when the new skin is applied? I am sure you want to fix this for version 11 - or maybe just fix me !
------------- Simon HB9DRV
|
Posted By: Oleg
Date Posted: 19 March 2007 at 2:15am
Lets try together:
In SkinMDI sample:
in SkinPropertyPageControls.h add
CXTButton m_btn;
in SkinPropertyPageControls.cpp add
DDX_Control(pDX, IDC_BTN_NORMAL, m_btn);
and
m_btn.SetXButtonStyle(BS_XT_WINXP_COMPAT);
run sample. Don't you see skinned button?
------------- Oleg, Support Team CODEJOCK SOFTWARE SOLUTIONS
|
Posted By: Simon HB9DRV
Date Posted: 19 March 2007 at 4:47am
oleg wrote:
Lets try together:
In SkinMDI sample:
in SkinPropertyPageControls.h add
CXTButton m_btn;
in SkinPropertyPageControls.cpp add
DDX_Control(pDX, IDC_BTN_NORMAL, m_btn);
and
m_btn.SetXButtonStyle(BS_XT_WINXP_COMPAT);
run sample. Don't you see skinned button?
|
Yes, that works.
Now select a new skin in Skins and Themes, then look at the button in the Options page - the skin doesn't get applied; the button is drawn incorrectly.
What happens when you change the skin by just clicking an entry on Skins and Themes? Do NOT restart the program or apply fairy dust (!), just click back to the Options page.
------------- Simon HB9DRV
|
Posted By: Simon HB9DRV
Date Posted: 19 March 2007 at 4:53am
Simon HB9DRV wrote:
oleg wrote:
Lets try together:
In SkinMDI sample:
in SkinPropertyPageControls.h add
CXTButton m_btn;
in SkinPropertyPageControls.cpp add
DDX_Control(pDX, IDC_BTN_NORMAL, m_btn);
and
m_btn.SetXButtonStyle(BS_XT_WINXP_COMPAT);
run sample. Don't you see skinned button?
|
Yes, that works.
Now select a new skin in Skins and Themes, then look at the button in the Options page - the skin doesn't get applied; the button is drawn incorrectly.
What happens when you change the skin by just clicking an entry on Skins and Themes? Do NOT restart the program or apply fairy dust (!), just click back to the Options page. |
BTW - using 10.4.2 static UNICODE library (not DLL).
------------- Simon HB9DRV
|
Posted By: Oleg
Date Posted: 19 March 2007 at 9:05am
Please add in void CXTButtonTheme::RefreshMetrics()
this line
if (m_themeWrapper.ThemeDataOpen()) m_themeWrapper.OpenThemeData(0, L"BUTTON");
button didn't refresh theme if systemcolors was changed.
Thanks!
------------- Oleg, Support Team CODEJOCK SOFTWARE SOLUTIONS
|
Posted By: Simon HB9DRV
Date Posted: 19 March 2007 at 9:20am
oleg wrote:
Please add in void CXTButtonTheme::RefreshMetrics()
this line
if (m_themeWrapper.ThemeDataOpen()) m_themeWrapper.OpenThemeData(0, L"BUTTON");
button didn't refresh theme if systemcolors was changed.
Thanks!
|
Heh - thanks very much - great support.
This is for you:-)
------------- Simon HB9DRV
|
Posted By: Simon HB9DRV
Date Posted: 19 March 2007 at 9:47am
I think an extra refresh / redraw is needed - I can do this myself. Look at the picture below, you see there's a button next to Reset with a bitmap where I have caused half to be redrawn by moving another window over it.
[Edit - redraw isn't enough - control needs to receive focus I think.]
I modified code as suggested:
void CXTButtonTheme::RefreshMetrics() { CXTThemeManagerStyle::RefreshMetrics();
// background colors. m_crBack.SetStandardValue(GetXtremeColor(COLOR_BTNFACE));
// text colors. m_crText.SetStandardValue(GetXtremeColor(COLOR_BTNTEXT)); m_crTextDisabled.SetStandardValue(GetXtremeColor(COLOR_GRAYTEXT));
// border colors. m_crBorderHilite.SetStandardValue(GetXtremeColor(COLOR_BTNFACE)); m_crBorderShadow.SetStandardValue(GetXtremeColor(COLOR_3DSHADOW)); m_crBorder3DHilite.SetStandardValue(GetXtremeColor(COLOR_3DHILIGHT)); m_crBorder3DShadow.SetStandardValue(GetXtremeColor(COLOR_3DDKSHADOW));
if (m_themeWrapper.ThemeDataOpen()) m_themeWrapper.OpenThemeData(0, L"BUTTON"); }
(I hope this makes sense.)
------------- Simon HB9DRV
|
Posted By: Oleg
Date Posted: 19 March 2007 at 12:04pm
Hi,
ok, one more fix -
in XTThemeManager.h
add in IMPLEMENT_THEME_REFRESH:
#define IMPLEMENT_THEME_REFRESH(theClass, theBase)\ BOOL theClass::OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult) {\ if (message == WM_SETTINGCHANGE || message == WM_SYSCOLORCHANGE)\ {\ GetTheme()->RefreshMetrics();\ Invalidate(FALSE);\ }\ return theBase::OnWndMsg(message, wParam, lParam, pResult);\ }
Thanks!
------------- Oleg, Support Team CODEJOCK SOFTWARE SOLUTIONS
|
Posted By: Simon HB9DRV
Date Posted: 19 March 2007 at 1:31pm
Fixed, many thanks!
------------- Simon HB9DRV
|
Posted By: Simon HB9DRV
Date Posted: 19 March 2007 at 1:52pm
Simon HB9DRV wrote:
Fixed, many thanks! |
Sorry Oleg,
Not fixed - this may be causing the framework to loop (in fact it is). I will have to live without this extra line for now, I will try to get a serious diagnosis of the problem this week.
------------- Simon HB9DRV
|
Posted By: Oleg
Date Posted: 20 March 2007 at 2:34am
Hi,
:( strange. May be you added Invalidate(FALSE); not in "if" block ?
What loop did you have, can you show some callstack?
------------- Oleg, Support Team CODEJOCK SOFTWARE SOLUTIONS
|
Posted By: Simon HB9DRV
Date Posted: 20 March 2007 at 3:58am
oleg wrote:
Hi,
:( strange. May be you added Invalidate(FALSE); not in "if" block ?
What loop did you have, can you show some callstack? |
Hi,
I'll get some stacks for you. The extra OnPaint caused by the Invalidate is the problem, anyway the stacks will appear today/tomorrow.
------------- Simon HB9DRV
|
|