Print Page | Close Window

HOWTO: XTPPropertyGridItem with drop down tree

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Property Grid
Forum Description: Topics Related to Codejock Property Grid
URL: http://forum.codejock.com/forum_posts.asp?TID=5561
Printed Date: 17 February 2025 at 9:58pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: HOWTO: XTPPropertyGridItem with drop down tree
Posted By: mgampi
Subject: HOWTO: XTPPropertyGridItem with drop down tree
Date Posted: 20 November 2006 at 7:58am
Hi;
 
In our most recent project I need a property grid item with dropdown tree support.
Has anyone ever done this? Whats the (best) design to realize this.
I prefer to use the CXTPPropertyGridItemConstraints* collection to hold the tree items data, due to minimize the break of the existing grid item design.
 
Any help is appreciated
 
Martin



Replies:
Posted By: Oleg
Date Posted: 20 November 2006 at 9:19am
Hi,
 
The best design is to create new class derived from CXTPPropertyGridItem, override its OnInplaceButtonDown and show your tree.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: mgampi
Date Posted: 20 November 2006 at 9:46am
Hi Oleg;
 
I have done this already but I'm having troubles in using the control as if it's an item with a simple list where the constraints container determines the tree nodes.
 
I looked into the internal grid item / constraints design and found out, that its not possible to create my own XTPPropertyGridItemConstraints derived collection, since the m_arrConstraints member is private and no protected or public function exists to insert my own constraint into this list.
 
All I wanted to do is to provide a somehow standard interface to reusable property tree items like shown in this "pseudo" code sequence:
 
pItem=grid.AddChildItem(new CMyPropertyGridItemTree(...))
pConstraints=pItem->GetConstraints()
pConstraints.AddConstraint("Item text", new MyItemConstraintData(...));
 
I need this additional constraint item data to provide such informations as 'parent', 'internal key', ...
My problem is, that I can't find a - only coded once - solution to delete my constraint item data on shutdown.
In my opinion, the right place to do this is in the dtor of the CXTPPropertyGridItemConstraints() class, which I have to override because I use the m_dwData member to store the additional MyItemConstraintData pointer. And now the hidden m_ArrConstraints member comes in once again...
 
I know, that I could change the source of you library, but thats an maintenance issue, and therefore not allowed in our company.
 
Martin
 
 


Posted By: Oleg
Date Posted: 20 November 2006 at 10:40am
Hi,
 
why so difficult... why you can't just add this Tree as member and
 
use pItem->GetTreeCtrl() method to retrieve tree and add nodes.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: mgampi
Date Posted: 20 November 2006 at 1:28pm

Hello Oleg;

you're absolutely right. First I did it the wrong way. I tried to find a somehow 'universal' solution that encapsulates the detail of the tree portion.
On the other hand I wanted to minimize the amount of source code needed to implement tree items with different content.

Martin



Posted By: Oleg
Date Posted: 20 November 2006 at 1:56pm

:)



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



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