Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - CXTButton, more than one style/theme?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTButton, more than one style/theme?

 Post Reply Post Reply
Author
Message
Dimitris View Drop Down
Newbie
Newbie


Joined: 06 February 2006
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Dimitris Quote  Post ReplyReply Direct Link To This Post Topic: CXTButton, more than one style/theme?
    Posted: 06 February 2006 at 3:00am
Hello,

I am using the CXTButton class for some of the buttons in my app, because I want to have the flat look. Some of these buttons appear in a dialog, and some of them appear in a CFormView derived class, with different background colors. All these buttons have just an icon with transparency on them. I use the SetAlternateColors() function to set the correct colors for the buttons.

The problem is, that when the formview appears at the same time as the dialog, the background color of the buttons gets messed up (either in the dialog or the view), and after that they remain messed up.

It seems as if when I call SetAlternateColors() the colors affect the theme (which is shared by all CXTButtons), and not the specific buttons.

I tried initializing and using different themes, but I keep getting memory errors when the app closes.

Any ideas?

We are using version 9.5.1
Back to Top
Dimitris View Drop Down
Newbie
Newbie


Joined: 06 February 2006
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Dimitris Quote  Post ReplyReply Direct Link To This Post Posted: 16 February 2006 at 9:28am
Nobody's seen this before?

Anybody?
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: 17 February 2006 at 8:10am

Hi,

9.5.1 is quite old version, it used another way to theme buttons...

 

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Dimitris View Drop Down
Newbie
Newbie


Joined: 06 February 2006
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Dimitris Quote  Post ReplyReply Direct Link To This Post Posted: 17 February 2006 at 8:11am
So, there is no solution for 9.5.1 other than upgrade?
Back to Top
rmercer View Drop Down
Groupie
Groupie


Joined: 22 February 2006
Status: Offline
Points: 34
Post Options Post Options   Thanks (0) Thanks(0)   Quote rmercer Quote  Post ReplyReply Direct Link To This Post Posted: 22 February 2006 at 3:40pm

Originally posted by Dimitris Dimitris wrote:

So, there is no solution for 9.5.1 other than upgrade?

I'm using 9.81 and have the same problem.  If you look at their code you'll understand why it's doing this.  When you set the colors it's actually setting them in the theme, and the theme handles painting the button.  The end result is if you modify one button it will effect all CXTButtons the next time they repaint.

It would be great if you could set the button theme and colors on a per-button basis.

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: 23 February 2006 at 7:46am

Hello,

At least in 9.70 it is possible to set theme for individual buttons.

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Barto View Drop Down
Groupie
Groupie


Joined: 27 February 2005
Location: Germany
Status: Offline
Points: 60
Post Options Post Options   Thanks (0) Thanks(0)   Quote Barto Quote  Post ReplyReply Direct Link To This Post Posted: 23 February 2006 at 8:16am

class CMyButtonTheme : public CXTButtonTheme
{
protected:
 virtual void DrawButtonText(CDC* pDC, UINT nState, CRect& rcItem, CXTButton* pButton);

 friend class CXTButton;
};

m_wButton.SetTheme(new CMyButtonTheme);

 

Back to Top
Dimitris View Drop Down
Newbie
Newbie


Joined: 06 February 2006
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Dimitris Quote  Post ReplyReply Direct Link To This Post Posted: 23 February 2006 at 8:21am
I'm not sure your solution would work Barto, but I think you're right about the way to do it.

I would subclass the CXTButton class rather than CXTButtonTheme and create two seperate classes to use two different themes.
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.218 seconds.