Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Skin Framework
  New Posts New Posts RSS Feed - CXTButton
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTButton

 Post Reply Post Reply
Author
Message
Simon HB9DRV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 July 2005
Location: Switzerland
Status: Offline
Points: 458
Post Options Post Options   Thanks (0) Thanks(0)   Quote Simon HB9DRV Quote  Post ReplyReply Direct Link To This Post Topic: CXTButton
    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
Back to Top
Simon HB9DRV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 July 2005
Location: Switzerland
Status: Offline
Points: 458
Post Options Post Options   Thanks (0) Thanks(0)   Quote Simon HB9DRV Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Simon HB9DRV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 July 2005
Location: Switzerland
Status: Offline
Points: 458
Post Options Post Options   Thanks (0) Thanks(0)   Quote Simon HB9DRV Quote  Post ReplyReply Direct Link To This Post Posted: 16 March 2007 at 12:45am
Originally posted by oleg 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
Back to Top
Simon HB9DRV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 July 2005
Location: Switzerland
Status: Offline
Points: 458
Post Options Post Options   Thanks (0) Thanks(0)   Quote Simon HB9DRV Quote  Post ReplyReply Direct Link To This Post Posted: 16 March 2007 at 2:56am
Originally posted by oleg 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:
  1. Changed the Normal button to class CXTButton.
  2. In CSkinPropertyPageControls::OnInitDialog() I set m_btnNormal.SetXButtonStyle(BS_XT_WINXP_COMPAT);
  3. 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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Simon HB9DRV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 July 2005
Location: Switzerland
Status: Offline
Points: 458
Post Options Post Options   Thanks (0) Thanks(0)   Quote Simon HB9DRV Quote  Post ReplyReply Direct Link To This Post Posted: 19 March 2007 at 4:47am
Originally posted by oleg 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
Back to Top
Simon HB9DRV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 July 2005
Location: Switzerland
Status: Offline
Points: 458
Post Options Post Options   Thanks (0) Thanks(0)   Quote Simon HB9DRV Quote  Post ReplyReply Direct Link To This Post Posted: 19 March 2007 at 4:53am
Originally posted by Simon HB9DRV Simon HB9DRV wrote:

Originally posted by oleg 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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Simon HB9DRV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 July 2005
Location: Switzerland
Status: Offline
Points: 458
Post Options Post Options   Thanks (0) Thanks(0)   Quote Simon HB9DRV Quote  Post ReplyReply Direct Link To This Post Posted: 19 March 2007 at 9:20am
Originally posted by oleg 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
Back to Top
Simon HB9DRV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 July 2005
Location: Switzerland
Status: Offline
Points: 458
Post Options Post Options   Thanks (0) Thanks(0)   Quote Simon HB9DRV Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Simon HB9DRV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 July 2005
Location: Switzerland
Status: Offline
Points: 458
Post Options Post Options   Thanks (0) Thanks(0)   Quote Simon HB9DRV Quote  Post ReplyReply Direct Link To This Post Posted: 19 March 2007 at 1:31pm
Fixed, many thanks!
Simon HB9DRV
Back to Top
Simon HB9DRV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 July 2005
Location: Switzerland
Status: Offline
Points: 458
Post Options Post Options   Thanks (0) Thanks(0)   Quote Simon HB9DRV Quote  Post ReplyReply Direct Link To This Post Posted: 19 March 2007 at 1:52pm
Originally posted by Simon HB9DRV 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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Simon HB9DRV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 July 2005
Location: Switzerland
Status: Offline
Points: 458
Post Options Post Options   Thanks (0) Thanks(0)   Quote Simon HB9DRV Quote  Post ReplyReply Direct Link To This Post Posted: 20 March 2007 at 3:58am
Originally posted by oleg 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.