Print Page | Close Window

CXTButton, more than one style/theme?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=3604
Printed Date: 10 November 2025 at 1:49am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTButton, more than one style/theme?
Posted By: Dimitris
Subject: CXTButton, more than one style/theme?
Date 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



Replies:
Posted By: Dimitris
Date Posted: 16 February 2006 at 9:28am
Nobody's seen this before?

Anybody?


Posted By: Oleg
Date 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


Posted By: Dimitris
Date Posted: 17 February 2006 at 8:11am
So, there is no solution for 9.5.1 other than upgrade?


Posted By: rmercer
Date 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.



Posted By: Oleg
Date 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


Posted By: Barto
Date 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);

 



Posted By: Dimitris
Date 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.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net