# To subscribers of the xforms list from Steve Lamont <spl@eggshell.ucsd.edu> :
> I have a simple program with two buttons. The first one enters an
> infinite loop, and the other should exit the loop when pressed.
>
> the problem is that, once I enter the loop, I can`t get any input from
> the other button, the forms get freezed...
As somone else pointed out, you need to periodically return control to
XForms. The function fl_check_forms() is designed to do this. You
should call it at some interval -- probably not as part of your inner
loop, assuming that the loop is actually nested. If it's one long
loop, you should call fl_check_forms() only every few iterations since
calling fl_check_forms() every iteration may lead to performance
problems given the amount of overhead involved. I'd do something to
the effect of
while ( 1 ) {
if ( ( ++count % SOME_INTERVAL ) == 0 )
fl_check_forms();
[. . .]
}
Of course, this presupposes that you have some other exit mechanism in
your loop -- such as a global flag. If this is not the case or you
don't like globals, you can do
while ( 1 ) {
if ( ( ++count % SOME_INTERVAL ) == 0 )
if ( fl_check_forms() == your_fdui->exit_button )
break;
[. . .]
}
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://world.std.com/~xforms
List Archive: http://bob.usuhs.mil/mailserv/list-archives/
This archive was generated by hypermail 2b29 : Mon Feb 03 2003 - 09:32:49 EST