CXTPPropertyGridItem colors |
Post Reply |
Author | ||||
hpesata
Groupie Joined: 16 July 2004 Status: Offline Points: 60 |
Post Options
Thanks(0)
Posted: 12 May 2005 at 5:55am |
|||
Hi!
XTP 9601 I need to set different for/background-colors for different property-grid-items. CXTPPropertyGrid::SetCustomColors() just enables me to change the color for ALL items. A similar function like CXTListBase::SetRowColor() would be what I need, something like pItem->SetColor(clrFore, clrBack). are there any plans on including this functionality in future versions ? I saw several requestes on this topic in the forum. thanx in advance! regards, Hans |
||||
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
|||
Yes, we have this in our TODO list for 10.0 release. Thank you. |
||||
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
||||
Kevin6
Groupie Joined: 13 May 2005 Location: United Kingdom Status: Offline Points: 30 |
Post Options
Thanks(0)
|
|||
I also have this problem. Is there a work around for now that you can suggest? (Also when is the planned release date for 10.0?) Regards, Kevin.
|
||||
Kevin.
|
||||
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
|||
You can: 1. Create custom item inherited from CXTPPropertyGridItem 2. Override OnDrawItemValue
or
1 Create custom pain manager inherited from CXTPPropertyGridPaintManager 2. Override void DrawItem(PDRAWITEMSTRUCT lpDrawItemStruct) |
||||
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
||||
Kevin6
Groupie Joined: 13 May 2005 Location: United Kingdom Status: Offline Points: 30 |
Post Options
Thanks(0)
|
|||
Thanks Oleg, but you avoided my other question! I have quite a large application to write and could leave the colouring for now and come back to it later. But I would need to know if 10.0 was 3, 6, 12+ months away. Just a general idea would do. Regards, Kevin.
|
||||
Kevin.
|
||||
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
|||
In Summer :)
|
||||
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
||||
Kevin6
Groupie Joined: 13 May 2005 Location: United Kingdom Status: Offline Points: 30 |
Post Options
Thanks(0)
|
|||
Thanks, that good enough for me! Regards, Kevin.
|
||||
Kevin.
|
||||
CGrant
Newbie Joined: 30 May 2005 Location: United Kingdom Status: Offline Points: 8 |
Post Options
Thanks(0)
|
|||
I'd also like to see a sinple way to set the background color, but the suggestion worked for me. In my case I wanted a simple valid / invalid coloring of items (numeric items outside a min to max range) I always find code examples handy; so I have a class dervied from the ...GridItemNumber that adds range checking by looking at the ::SetValue string to set bool m_valid. The draw override uses it like this:
Keep up the good work Colin Edited by CGrant |
||||
hpesata
Groupie Joined: 16 July 2004 Status: Offline Points: 60 |
Post Options
Thanks(0)
|
|||
Hi Colin!
thanx for your hint! I am lookong for a way to also color the item-caption, not only the value. Do You have any idea on how to do that ? thanx in advance! regards, Hans |
||||
CGrant
Newbie Joined: 30 May 2005 Location: United Kingdom Status: Offline Points: 8 |
Post Options
Thanks(0)
|
|||
I had hoped it would be easy but I haven't exactly managed it. The closest I could get involved my own class derived from CXTPPropertyGridPaintManager
which I set in to the property grid when I created it
and then, as an example, override DrawItem to splat red down on the selected row.
The grid item value is still getting painted nicely but the caption is just a solid red rectangle. Filling it in nicely needs a fair bit more work - see Samples\PropertyGrid\OwnerDraw\SimpleGridPage.cpp for its DrawItem code. Good luck! Colin
|
||||
hpesata
Groupie Joined: 16 July 2004 Status: Offline Points: 60 |
Post Options
Thanks(0)
|
|||
Hi Colin!
Thanx a lot for your detailled support! regards, Hans |
||||
CGrant
Newbie Joined: 30 May 2005 Location: United Kingdom Status: Offline Points: 8 |
Post Options
Thanks(0)
|
|||
Now that I've coughed up the price of the MFC version of PropertyGrid I've got the sources , so I've revisited it to see if it would be easy enough to change the base class to get grid items coloured. I fell foul of include ordering so I opted for this slightly odd approach: I added a virtual method to the class CXTPPropertyGridItem to get the background colour for that item.
and changed the CXTPPropertyGridPaintManager::DrawItem to use that colour
That meant that nothing changed until I had my own class RangeCheckedGridItemNumber derived CXTPPropertyGridItemNumber from that overrode the mehtod
Obviously you can have any logic you like in your method. I quite like the solution since it is a minimal change, but it does change the library; I hope the next release will have its own SetBackgroundColor() method instead Colin |
||||
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 |