CXTButton |
Post Reply |
Author | ||
Simon HB9DRV
Senior Member Joined: 07 July 2005 Location: Switzerland Status: Offline Points: 458 |
Post Options
Thanks(0)
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
|
||
Simon HB9DRV
Senior Member Joined: 07 July 2005 Location: Switzerland Status: Offline Points: 458 |
Post Options
Thanks(0)
|
|
Bump - not essential but it would be good to have this fixed for the next major release if possible.
|
||
Simon HB9DRV
|
||
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
|
Hi,
Set Style BS_XT_WINXP_COMPAT:
SetXButtonStyle(BS_XT_WINXP_COMPAT);
|
||
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
||
Simon HB9DRV
Senior Member Joined: 07 July 2005 Location: Switzerland Status: Offline Points: 458 |
Post Options
Thanks(0)
|
|
Thanks - will try after taking dogs for a walk.
|
||
Simon HB9DRV
|
||
Simon HB9DRV
Senior Member Joined: 07 July 2005 Location: Switzerland Status: Offline Points: 458 |
Post Options
Thanks(0)
|
|
Already tried that - doesn't help.
Here's what I have done:
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
|
||
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
|
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 |
||
Simon HB9DRV
Senior Member Joined: 07 July 2005 Location: Switzerland Status: Offline Points: 458 |
Post Options
Thanks(0)
|
|
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
|
||
Simon HB9DRV
Senior Member Joined: 07 July 2005 Location: Switzerland Status: Offline Points: 458 |
Post Options
Thanks(0)
|
|
BTW - using 10.4.2 static UNICODE library (not DLL).
|
||
Simon HB9DRV
|
||
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
|
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 |
||
Simon HB9DRV
Senior Member Joined: 07 July 2005 Location: Switzerland Status: Offline Points: 458 |
Post Options
Thanks(0)
|
|
Heh - thanks very much - great support.
This is for you:-) |
||
Simon HB9DRV
|
||
Simon HB9DRV
Senior Member Joined: 07 July 2005 Location: Switzerland Status: Offline Points: 458 |
Post Options
Thanks(0)
|
|
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
|
||
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
|
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 |
||
Simon HB9DRV
Senior Member Joined: 07 July 2005 Location: Switzerland Status: Offline Points: 458 |
Post Options
Thanks(0)
|
|
Fixed, many thanks!
|
||
Simon HB9DRV
|
||
Simon HB9DRV
Senior Member Joined: 07 July 2005 Location: Switzerland Status: Offline Points: 458 |
Post Options
Thanks(0)
|
|
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
|
||
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
|
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 |
||
Simon HB9DRV
Senior Member Joined: 07 July 2005 Location: Switzerland Status: Offline Points: 458 |
Post Options
Thanks(0)
|
|
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
|
||
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |