treat widget input correctly
This commit is contained in:
parent
e0b1d12a60
commit
9c98766700
2 changed files with 19 additions and 6 deletions
|
@ -111,10 +111,9 @@ void PropertyList::delete_arrays()
|
|||
for (int i = 0; i < _num_entries; i++)
|
||||
delete[] _entries[i];
|
||||
|
||||
for (int j = 0; j < _num_children; j++) {
|
||||
for (int j = 0; j < _num_children; j++)
|
||||
if (!_children[j]->nChildren())
|
||||
_children[j]->removeChangeListener(this);
|
||||
}
|
||||
|
||||
delete[] _entries;
|
||||
delete[] _children;
|
||||
|
@ -297,9 +296,23 @@ void PropertyList::valueChanged(SGPropertyNode *nd)
|
|||
|
||||
void PropertyList::setValue(const char *s)
|
||||
{
|
||||
SGPropertyNode *p = fgGetNode(s, false);
|
||||
if (p)
|
||||
setCurrent(p);
|
||||
SGPropertyNode *p;
|
||||
try {
|
||||
p = fgGetNode(s, false);
|
||||
} catch (const stdString& m) {
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "property-list: " << m);
|
||||
return;
|
||||
}
|
||||
setCurrent(p);
|
||||
}
|
||||
|
||||
|
||||
void PropertyList::setCurrent(SGPropertyNode *p)
|
||||
{
|
||||
bool same = (_curr == p);
|
||||
_return = _curr = p;
|
||||
update(same);
|
||||
if (!same)
|
||||
publish(p);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
~PropertyList();
|
||||
|
||||
void update (bool restore_slider_pos = false);
|
||||
void setCurrent(SGPropertyNode *p) { _curr = p; update(); publish(p); }
|
||||
void setCurrent(SGPropertyNode *p);
|
||||
SGPropertyNode *getCurrent() const { return _curr; }
|
||||
void publish(SGPropertyNode *p) { _return = p; invokeCallback(); }
|
||||
void toggleFlags() { _flags->setBoolValue(!_flags->getBoolValue()); }
|
||||
|
|
Loading…
Reference in a new issue