Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - CXTPPropertyGrid: Custom Colors for Captions
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPPropertyGrid: Custom Colors for Captions

 Post Reply Post Reply
Author
Message
MacW View Drop Down
Senior Member
Senior Member


Joined: 26 June 2007
Status: Offline
Points: 253
Post Options Post Options   Thanks (0) Thanks(0)   Quote MacW Quote  Post ReplyReply Direct Link To This Post Topic: CXTPPropertyGrid: Custom Colors for Captions
    Posted: 27 February 2008 at 9:32am
Hi,

it seems that it is not possible to color individual captions of a CXTPPropertyGrid. I need different colors for different captions.

Using my own CXTPPropertyGridPaintManager and overriding the GetItemTextColor and GetItemBackColor works only for normal items, but not captions.

The problem is the call to DrawCategoryCaptionBackground in "TPPropertyGridPaintManager.cpp" which fills the entire caption with the line color.

This method is not virtual and hence I cannot change the behavior.

Can this be made virtual in the next ToolkitPro release?

And while you're at it, would it be possible to change the AddCategory  / InsertCategory of CXTPPropertyGrid in a way that allows us to use objects derived from CXTPPropertyGridItem?

This is currently only possible with AddChildItem, but not for categories. This causes some rather rough work-arounds. It would be much simpler if you would add a method like

virtual CXTPPropertyGridItem* CreateInstance() which just does a

return new CXTPPropertyGridItem

in the CXTPPropertyGrid class, but could be overloaded to return a derived class instead in a class derived from CXTPPropertyGridItem.







Back to Top
Oleg View Drop Down
Senior Member
Senior Member


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: 27 February 2008 at 11:01am
Hi,
DrawCategoryCaptionBackground is virtual even in 11.1.3 version.
 
Good suggestion about InsertCategory. Changed.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
MacW View Drop Down
Senior Member
Senior Member


Joined: 26 June 2007
Status: Offline
Points: 253
Post Options Post Options   Thanks (0) Thanks(0)   Quote MacW Quote  Post ReplyReply Direct Link To This Post Posted: 27 February 2008 at 2:33pm
Hi, Oleg

Thanks. Must have looked at a derived PaintManager accidentally

The problem I have is that I don't know _which_ caption is to be drawn inside this method. I would need to override the entire DrawItem method in order to change how the caption is filled. The GetItemBackColor takes the item as a parameter, but not the DrawCategoryCaptionBackground method...

Two virtual methods like GetCaptionBackColor and GetCaptionTextColor would solve this problem for me. And would bring the caption painting mechanism in line with the painting mechanism of the normal items.


Thanks for allowing us to use derived classes as categories in upcoming versions. This makes it easier to associate custom data with categories, like with items now.

PS.: I hope XAML support will also make it to the property grid
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.055 seconds.