John Levon wrote:
> On Wed, Jan 15, 2003 at 05:46:57PM +0100, Juergen Spitzmueller wrote:
>> if (isValid())
>> bc().valid();
>> else
>> bc().invalid();

ButtonController::valid takes an optional arg (bool = true), so simplify 
your code with
        bc().valid(isValid());
 
>> there cures the problem with the index and URL dialog, but now the
>> buttons are enabled even when nothing has been changed.
> 
> So  we need to work out the different case ? What *is* different ?
> 
> Hmm, we have createIndex vs. showIndex. We somehow need t o leverage
> that. Angus ?
>
> Why doesn't xforms have the same problem

Probably because someone (me?) has been lazy and shoved the bc().valid() 
call in the xforms code rather than in the controllers code:

FormIndex.C:    bc().valid(!contents.empty());

Really, we should take this out of the gui dirs and modify 
ControlInset::update. Perhaps something like below. 

Having said that, I do not think that this should be done before the 1.4 
cycle. There's a lot of tweaking gone into this stuff which we'd almost 
certainly break.

template <class Inset, class Params>
void ControlInset<Inset, Params>::update()
{
        // paranoia check
        if (params_) delete params_;

        if (inset_)
                params_ = new Params(getParams(*inset_));
        else
                params_ = new Params();

        if (emergency_exit_) {
                hide();
                return;
        }

        bc().readOnly(bufferIsReadonly());
        view().update();

        // The widgets may not be valid, so refresh the button controller
+       bc().valid(params->valid());
        bc().refresh();
}

-- 
Angus

Reply via email to