On Tuesday 18 September 2001 09:32, Juergen Spitzmueller wrote:
> I need some help.
> I added to FormDocument::class_update
>
> if (params.hasClassDefaults())
> setEnabled(class_->button_reset_defaults, false);
> else
> setEnabled(class_->button_reset_defaults, true);
>
> Is this correct?
As JMarc says, looks Ok. Why not code it as:
setEnabled(class_->button_reset_defaults, !params.hasClassDefaults());
> 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.
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.
If your object is a text input widget, you may need to add a line
fl_set_input_return(your_widget, FL_RETURN_CHANGED);
to FormDocument::build()
Angus