Angus Leeming wrote:
> > Is this correct?
>
> As JMarc says, looks Ok. Why not code it as:
>
>       setEnabled(class_->button_reset_defaults,
> !params.hasClassDefaults());

Yes, why not ;-)

> > Furthermore I need to add something to FormDocument::input (I
> > think) to enable "Reset" if I do something in the dialog which
> > changes the current settings. The question is: what?
>
> Using fdesign to edit the form_document.fd file, highlight the widget
> you're interested in, press the "attribs" button in the main dialog
> and add a "Callback" function and "Argument" to the widget.
>
> FormDocument is derived from FormBaseDeprecated, so the callback
> function you need to add is
>       C_FormBaseDeprecatedInputCB
> I usually just set the Argument to 0.

I've done this.

> Doing something to the input now ultimately results in a call to
>       FormDocument::input(ob, 0)
> where ob is the FL_OBJECT that's just been hit and the one you're
> interested in.
>
> Now you just need to shove in the code that's triggered by a change
> in ob: if (ob == the_object_im_interested in) {
>               blah blah blah
>       }
>
> if all is fine and dandy, input returns true, else false.

But params.hasDefaults() should be checked on every object-hit (it's 
changed by several objects). So it should be something like

        if (ob == any_object) {
        BufferParams params = lv_->buffer()->params;
        setEnabled(class_->button_reset_defaults, !params.hasClassDefaults());
        }

Is that possible?

Thanks,
Jürgen

> Angus

Reply via email to