Re: ?updating fields

Richard Kent (kent@hydra.dra.hmg.gb)
Thu, 13 Feb 1997 12:29:21 -0000

To subscribers of the xforms list from "Richard Kent" <kent@hydra.dra.hmg.gb> :

> Steve Lamont wrote:
> >
> > >Frank Stefani wrote:
> > >
> > > I built a form with about 15 fields (some input fields, some others).
> > > A second form is provided as a "control panel" for the major one.
> > > Now I want to add some buttons to this control panel for updating,
> > > cleaning, ... the major form. Buttons are labeled "Update", "Clean"
> > > and so on.
> > >
> > > If e.g. pressing "Clean" in the control panel, how can I wipe out
> > > all the fields contents of my major form (resetting with default
> > > values)?

I think others may have misunderstood your question (or maybe I have) but as
long as your top level forms are declared globally and you have assigned names
to all sliders / input fields etc that you want control over then it is
relatively straightforward.

For example, if your main form is called "mainForm" and your control form is
called "controlForm" (both globally visible), when you click the "Clear" button
on your control form the callback for the "Clear" button will be called. In
this callback put all your default reset commands such as :-

fl_set_object_label (mainForm->textbox, "Default Text");
fl_set_slider_value (mainForm->slider,0.0);
(apologies if format not quite correct - check the manual for these calls !!)

and similar for sliders, dials, xyplots and all the other objects.

If the "Update" button is clicked the callback for the "Update" button will be
called. In this callback simply copy from the control form to the main form
such as :-

fl_set_object_label (mainForm->textbox,
fl_get_object_label (controlForm->textbox));
fl_set_slider_value (mainform->slider,
fl_get_slider_value (controlForm->slider));

and similar for sliders, dials, xyplots and all the other object.

Hope this helps - I had to do a similar thing for a parameter page with lots of
sliders and check boxes.

Cheers,

TicH

------------------------------------------------------------------------
| Name - Richard Kent |
| EMail - kent@hydra.dra.hmg.gb |
| Plan - All work and no play.....hi ho, hi ho |
------------------------------------------------------------------------

_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/xforms-archive/