|
|
Home » U++ Library support » TreeCtrl » Bug changing text after node insertion
|
|
|
Re: Bug changing text after node insertion [message #16860 is a reply to message #16859] |
Thu, 17 July 2008 17:57   |
cbpporter
Messages: 1427 Registered: September 2007
|
Ultimate Contributor |
|
|
Thank you masu for investigating. Still, removing nodes and adding then is much more complicated that it should be and doesn't address the problem directly.
Mirek's function would solve the problem but from a purist point of view it doesn't make that much sense. Nodes do not logically have a label property. If we accept setting the label as a valid operation, than what is the difference between setting the label and setting the key. Are both operations defined? Can you mix them? If you mix them can you get a combination that results in two labels again? And why does adding a node behave differently than setting the node to a different value?
Shouldn't we rather add SetKey/SetValue functions, or just Set variant for both, as in Node and other cases? Anyway, which value is the key and which is the values and which is passed to Display/Converts is not too clear.
[Updated on: Thu, 17 July 2008 17:57] Report message to a moderator
|
|
|
|
|
|
|
|
Re: Bug changing text after node insertion [message #16923 is a reply to message #16921] |
Mon, 21 July 2008 10:23   |
cbpporter
Messages: 1427 Registered: September 2007
|
Ultimate Contributor |
|
|
It is getting closer. There is still a problem as you can see in this screenshot I created. The text is diplayed once for the label and once for the key/value. It seems to display the value.
I'm using SetLabel, and also the normal Set to set key and value. I also use a modified version of Copy to repopulate another tree with the checked items of this tree.
int CopyIfSelected(TreeCtrl& dst, int did, const OptionTree& src, int id)
{
TreeCtrl::Node x = src.GetNode(id);
x.ctrl = NULL;
int orig = did;
if (src.Get(id))
did = dst.Add(did, x);
dst.Open(orig);
for(int i = 0; i < src.GetChildCount(id); i++)
CopyIfSelected(dst, did, src, src.GetChild(id, i));
return did;
}
When I use Set, the first parameter is a struct and the second one is the string that I display. Swapping these around or leaving out the second string parameter will clear the extra text that appears in the right, but the are is still clickable, leaving a small little gray rect when clicked. I could live with that for now, but both swapping the parameters or leaving one out will render my CoyIfSelected function useless, because it will not set the text in the destination Tree.
|
|
|
Re: Bug changing text after node insertion [message #16924 is a reply to message #16923] |
Mon, 21 July 2008 10:43   |
 |
mirek
Messages: 14257 Registered: November 2005
|
Ultimate Member |
|
|
cbpporter wrote on Mon, 21 July 2008 04:23 | It is getting closer. There is still a problem as you can see in this screenshot I created. The text is diplayed once for the label and once for the key/value. It seems to display the value.
I'm using SetLabel, and also the normal Set to set key and value. I also use a modified version of Copy to repopulate another tree with the checked items of this tree.
int CopyIfSelected(TreeCtrl& dst, int did, const OptionTree& src, int id)
{
TreeCtrl::Node x = src.GetNode(id);
x.ctrl = NULL;
int orig = did;
if (src.Get(id))
did = dst.Add(did, x);
dst.Open(orig);
for(int i = 0; i < src.GetChildCount(id); i++)
CopyIfSelected(dst, did, src, src.GetChild(id, i));
return did;
}
When I use Set, the first parameter is a struct and the second one is the string that I display. Swapping these around or leaving out the second string parameter will clear the extra text that appears in the right, but the are is still clickable, leaving a small little gray rect when clicked. I could live with that for now, but both swapping the parameters or leaving one out will render my CoyIfSelected function useless, because it will not set the text in the destination Tree.
|
I guess we will need GetLabel too....
Mirek
|
|
|
|
|
Re: Bug changing text after node insertion [message #16927 is a reply to message #16926] |
Mon, 21 July 2008 12:36   |
cbpporter
Messages: 1427 Registered: September 2007
|
Ultimate Contributor |
|
|
luzr wrote on Mon, 21 July 2008 12:52 |
Ehm, but it is not a double text... These are different things, the label is an attribute of widget... Widget can have more than one attributes.
OK, one possible solution would be to supress the "value" when ctrl is set for the node.
Mirek
|
I know that the two text are from different sources, one is the label of the Option and the other is the value painted on the control (with a huge space between then, probably because of the Width of the Option), but still by my definition if there are two text (doesn't matter why), that constitutes a double text .
Yes, suppressing it and moving the region in which when you click an item it will be highlighted with a dotted rect so that it encapsulates the Option would probably work.
Quote: |
OTOH I believe that current solution when both are used is in fact more general.
|
I'm not sure I understand. What is current solution? Or do you mean solution as in the way things work right now, not "solution to my problem".
|
|
|
|
|
|
Re: Bug changing text after node insertion [message #16932 is a reply to message #16930] |
Mon, 21 July 2008 14:56   |
cbpporter
Messages: 1427 Registered: September 2007
|
Ultimate Contributor |
|
|
I guess we have different representations on what a tree control should do.
Maybe it would be better for me to find a different solution rather than tweak OptionTree to suit my needs, since it seems that it was built with other needs in mind.
Also, I think there is something broken with MINGW debugger. I download RC2 today and debugging doesn't work for me. It was always a little buggy under MINGW, but it was usable. But now, break points are sometimes ignored step in and over don't work at all.
[Updated on: Mon, 21 July 2008 14:56] Report message to a moderator
|
|
|
|
|
Goto Forum:
Current Time: Sun May 11 14:50:51 CEST 2025
Total time taken to generate the page: 0.02226 seconds
|
|
|