Re: XForms: Spurious callback call

Steve Lamont (spl@szechuan.ucsd.edu)
Mon, 18 Oct 99 07:00:18 PDT

# To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> See the attached file. Note that the call is done as part of a hide
> on a group. Waht TC said seems to make sense, but I can't see how I
> should check from within my callback. Or am I missing something
> somewhere?

You're probably not missing anything.

The problem is that when an object is hidden it is checked to see if
it has "focus" and if it does, the callback is called. The reason I
didn't see the problem is that I used a button which triggered a
callback to hide the objects. Since the button had focus and wasn't
being hidden, the callback for the Input object wasn't called.

Fortunately, there is a workaround -- a bit of a hack but it does seem
to work.

The trick is to set the focus somewhere other than your input object.

> int main (int argc, char *argv[])
> {
> [...]
> fl_end_form ();
> fl_show_form (form, FL_PLACE_FREE, FL_FULLBORDER, argv[0]);

fl_set_focus_object( form, this->group ); /* <--- Add this */

> fl_hide_object (this->group); /* this is the offending call */
> fl_do_forms ();
> [...]

The fl_set_focus_object() changes the focus to the head of the group,
which has no callback, therefore nothing is called. Nothing untoward
appears to happen.

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