On Friday 24 August 2001 02:10, John Levon wrote:
> On Fri, Aug 24, 2001 at 02:04:23AM +0100, John Levon wrote:
> 
> > 1) open dialog on existing citation. if the dialog was previously open,
> > the text after is reset to the parameters for the citation. Unfortunately
> > this triggers a changed() signal, which then tells the button controller
> > bc().valid(), which enables OK. So OK/Apply/Cancel are then enabled even
> > though nothing has /actually/ changed.
> > 
> > So basically update() MUST call bc().restore() or equivalent AFTER
> > it has updated. But I cant work out where to add this. Ideas (please) ?
> 
> that's as clear as mud. the problem is that we need to process all events
> as a result of running update()
> 
> so the epilogue of any call to update() must do :
> 
>       qApp->processEvents();
>       bc().restore();

This looks decidedly fishy to me.

The change of state is coming from the LyX side not the Dialog side and so 
the controller already knows about it. That is, the Citation controller 
should tell the Button Controller about the new state. I thought it did this.

Looking at the code...

This should all be done in ControlInset:

template <class Inset, class Params>
void ControlInset<Inset, Params>::showInset(Inset * inset)
{
        if (inset == 0) return;  // maybe we should Assert this?

        connectInset(inset);
        show(getParams(*inset));
}


template <class Inset, class Params>
void ControlInset<Inset, Params>::createInset(string const & arg)
{
        connectInset();

        if ( !arg.empty() )
                bc().valid(); // so that the user can press Ok

        show(getParams(arg));
}


You can see that we set the state of the input in createInset (although I'm 
not sure that control is ever passed to the dialog in this instance. The 
inset should be created automatically in LyXFunc::Dispatch here). Anyway, 
that's an aside.

John, you should set the bc in these two functions. 

Angus


Reply via email to