Home » U++ Library support » TreeCtrl » treectrl with ctrl
Re: treectrl with ctrl [message #23461 is a reply to message #23431] |
Wed, 21 October 2009 08:45  |
 |
mirek
Messages: 14265 Registered: November 2005
|
Ultimate Member |
|
|
kohait00 wrote on Mon, 19 October 2009 03:07 | the goal behind all this is to be able to put something down in the TreeCtrl (be it a key/value pair or a Ctrl content), tag with a kind of hash information and later be able to retrieve exactly this element again, using the key. well, as it seems it works quite well with the key/value approach, but using ctrl as content, there is no way to assign a hash, that is kept *inside* the tree ctrl and not propagated to the ctrl itself. Find'ing the key then results in a for loop, which again decides, where to take the value, from the internal key database or from the control.
but imagine controls that dont support GetData/SetData, like simple ParentCtrl containing others..this would not work.
thats somehow a drawback in double sense (we use the keys only for verification, not for hasching, --> performance)
maybe instead of setting up another SetData() in the Ctrl:: one could just think of an additional method in the TreeCtrl (and maybe the other controls with the same respective behaviour), something like a
void SetK(int id, Value key); which does *not* propagate it to a ctrl's SetData but still sets the internal keys, and a FindK(Value key) method which only searches the internal keys, no matter what content, control or key/value.
so one could still use the Find(Value key) methods, and use the others if one knows what to do.. changig the API is hard, when we have a lot of progs already used to this behaviour.
cheers
|
I guess things got a little bit confused. There are now 3 values associated with each node:
id
key
value
Embedded ctrls are using value. You can set key alone using
Set(id, key, GetValue(id))
the only a little bit tricky part is that if you set just single Value for node, it gets assigned to both key and value...
Now above is a little bit confused, but so am I reading your post 
Mirek
|
|
|
Goto Forum:
Current Time: Sun Jul 06 19:02:00 CEST 2025
Total time taken to generate the page: 0.03514 seconds
|