Home » U++ Library support » U++ Widgets - General questions or Mixed problems » Can we get OptionTree:ManualMode?
Can we get OptionTree:ManualMode? [message #16679] |
Mon, 07 July 2008 16:34 |
cbpporter
Messages: 1401 Registered: September 2007
|
Ultimate Contributor |
|
|
So that OptionTree no longer check items for you when you click on other items. This is useful if you have a tree like A/B/C/D and check means process or similar operation, and unchecking C will only process A/B/D, with D processed even though C is skipped.
class OptionTree : public TreeCtrl {
...
bool manualMode;
...
OptionTree& ManualMode() { manualMode = true; return *this; }
void OptionTree::SetOption(int id)
{
Option *opt = option[id];
ASSERT(opt);
if (manualMode)
{
WhenOption();
return;
}
SetChildren(id, opt->Get());
for(;;) {
id = GetParent(id);
if(id < 0)
break;
bool t = false;
bool f = false;
bool n = false;
for(int i = 0; i < GetChildCount(id); i++) {
int chid = GetChild(id, i);
Option *opt = option[chid];
if(opt) {
int x = opt->Get();
if(x == 1)
t = true;
else
if(x == 0)
f = true;
else
n = true;
}
}
opt = option[id];
if(opt) {
if(t && f || n) {
opt->Set(Null);
}
else
opt->Set(t);
}
}
WhenOption();
}
OptionTree::OptionTree(): manualMode(false) { aux.Add(); }
|
|
|
|
|
Goto Forum:
Current Time: Sat May 11 11:59:20 CEST 2024
Total time taken to generate the page: 0.02621 seconds
|