Home » U++ Library support » TreeCtrl » treectrl with ctrl
Re: treectrl with ctrl [message #22913 is a reply to message #22905] |
Fri, 28 August 2009 11:47   |
 |
mirek
Messages: 14255 Registered: November 2005
|
Ultimate Member |
|
|
sapiency wrote on Wed, 26 August 2009 09:39 | hi,
with controls in Nodes it is not possible to use 'Value' and 'Key'
void TreeCtrl::Set(int id, Value v)
{
Item& m = item[id];
if(m.ctrl)
m.ctrl->SetData(v);
else {
m.value = m.key = v;
RefreshItem(id);
}
SetOption(id);
}
void TreeCtrl::Set(int id, Value k, Value v)
{
Item& m = item[id];
if(m.ctrl)
m.ctrl->SetData(v);
else {
m.key = k;
m.value = v;
RefreshItem(id);
}
SetOption(id);
}
This could be solved if there would be a virtual method in Ctrl
virtual void SetData(const Value& data, const Value& value) {}
and modify the method in TreeCtrl to:
void TreeCtrl::Set(int id, Value k, Value v)
{
Item& m = item[id];
if(m.ctrl)
m.ctrl->SetData(k, v);
else {
m.key = k;
m.value = v;
RefreshItem(id);
}
SetOption(id);
}
Maybe it is possible to extend the code
regards
reinhard
|
Well, I think the design is quite right for value - widget now represents the Value of node. This behaviour is also consistent with ArrayCtrl.
There is a sort of question of what to do with key though. I think we should try something better...
Mirek
|
|
|
Goto Forum:
Current Time: Sat Apr 26 08:43:17 CEST 2025
Total time taken to generate the page: 0.00810 seconds
|