On Friday 24 August 2001 14:09, John Levon wrote:
> On Fri, Aug 24, 2001 at 02:00:07PM +0100, Angus Leeming wrote:
>
> > > it is ::build() that must be protected in this way.
> >
> > Sorry, I don't understand you.
> > As far as I can see, build() is a virtual function that is called only
from
> > show. Wither you test whether the dialog has been built before you call
build
> > or you do it in every single build method. I opted for the former. Why is
the
> > other better?
>
> Please, go back and read my original post in this thread. If you've deleted
it, here's a summary :
>
> The very first time a dialog is shown we effectively do :
>
> refreshReadOnly
> show
>
> now, this first refreshReadOnly is no use whatsoever because the list of
readonly widgets
> is (obviuosly) empty until build() is called, as the first thing of show().
>
> So we need to do :
>
> build()
> refreshReadOnly
> show()
>
> in the right places.
>
> See ?
Ahhhhh! Well spotted.
Wouldn't it be cleaner to do
template <class Inset, class Params>
void ControlInset<Inset, Params>::show(Params const & params)
{
if (params_) delete params_;
params_ = new Params(params);
setDaughterParams();
+ static bool isBuilt = false;
+ if (!isBuilt) {
+ isBuilt = true;
+ view().build();
+ }
bc().readOnly(isReadonly());
view().show();
}
Angus
>
> regards
> john
>
> --
> "That's just kitten-eating wrong."
> - Richard Henderson
>
>
--
Dr Angus Leeming
Dept. of Bioengineering
Imperial College
London SW7 2BX
Tel +44 (0) 20 7594 5186
Fax +44 (0) 20 7584 6897