KDZ Changing text color in TreeViewCG?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 22/07/2004 at 19:10, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 8.503
Platform: Windows ;
Language(s) : C++ ;---------
Hey all,Can't seem to find a way to change the color of text in a TreeViewCustomGui "tree" column. I've tried DrawCell from TreeViewFunctions, but it doesn't appear to effect anything in that column.
What I want is to color 'folders' differently than 'files' so that the difference is noticed (since there is no other way in cases where the folder has no contents).
Thanks,
Robert -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 25/07/2004 at 22:57, xxxxxxxx wrote:
Couldn't you use TreeViewFunctions::GetColors()?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 26/07/2004 at 07:40, xxxxxxxx wrote:
Hmmm. And here I thought "GetColors" would GET the colors of something and not SET the text colors. Remind me to not only look at the method list, but to check out each entry when searching for appropriate ones.
Thanks again,
Robert -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 26/07/2004 at 10:20, xxxxxxxx wrote:
Well, not quite. Not sure what to ~do~ with this. Here's what I tried, with no effect (note: GetTreeColorXX() return GeData* ) :
virtual void GetColors(void *root, void *userdata, void *obj, GeData* pNormal, GeData* pSelected) { RuntimeItem* rti = (RuntimeItem* )obj; pNormal = rti->GetTreeColorNormal(); pSelected = rti->GetTreeColorSelected(); }
And here's where I set up the GeData (ignore the irrelevant code) - pNormal and pSelected are GeData's as class members to mine and they are set during Construction:
if (type == ITEMTYPE_RUNTIME) { pNormal = GeData(Vector(1, 0.7, 0)); pSelected = GeData(Vector(1, 1, 0)); if (rt == NULL) rt = this; GetOneAhead(rt, riid); } else if (type == ITEMTYPE_FOLDER) { pNormal = GeData(Vector(0, 0.7, 0)); pSelected = GeData(Vector(0, 1, 0)); if (rt == NULL) rt = this; GetOneAhead(rt, riid); } else { pNormal = GeData(Vector(0,0,0)); pSelected = GeData(Vector(1,0,0)); }
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/07/2004 at 04:09, xxxxxxxx wrote:
First of all, there's a bit of naming confusion. When most people see "pNormal" they will think "pointer to normal". That's the way the prefix "p" is used in the signature for GetColors(). However, you seem to use the name "pColor" for a non-pointer GeData. And then I assume that GetTreeColorNormal() returns &pNormal?
Anyway, the main problem is when you do "pNormal = rti->GetTreeColorNormal()". This will simply assign the local copy of the pointer "pNormal". You need to do "*pNormal = ..." to set the value of the pointed GeData instead. -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/07/2004 at 07:40, xxxxxxxx wrote:
Nope.
In RuntimeItem, GeData is a class member
GeData pNormal;
GeData pSelected;Okay, I kept the 'p' prefix just to keep naming conventions synonymous.
In GetColors, I retrieve these members by sending &pNormal;, &pSelected; with the functions GeData* RuntimeItem::GetTreeColorNormal(), GeData* RuntimeItem::GetTreeColorSelected().
So, GetColors is getting pointers to the GeData's. Still doesn't resolve why it doesn't work.
Robert
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/07/2004 at 16:30, xxxxxxxx wrote:
Sorry, I should have been more explicit:
virtual void GetColors(void *root, void *userdata, void *obj, GeData* pNormal, GeData* pSelected) { RuntimeItem* rti = (RuntimeItem* )obj; *pNormal = *rti->GetTreeColorNormal(); *pSelected = *rti->GetTreeColorSelected(); }
Otherwise your only assigning to the local pointer variables, not the pointed GeDatas. In other words, the outside world cannot detect that you've assigned your pointers. Or have I misunderstood where the above code is located?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/07/2004 at 17:14, xxxxxxxx wrote:
So, what you are saying is don't set the pointers to pointers, but set what is pointed to by them?
*pNormal = GeData
and not
pNormal = GeData*
Will have to try that, but I think that I have already tried setting the pointer's data directly to a GeData element with no results.
Thanks,
Robert -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/07/2004 at 17:33, xxxxxxxx wrote:
That worked!
Maybe since my first tests used GeData's directly in the TVF:
*pNormal = GeData(Vector(r,g,b));
... I considered that it had to be a pointer-pointer assignment not realizing that the scope (and data) probably just disappeared in the first instance.