XForms: Clock cursor

Steve Lamont (spl@szechuan.ucsd.edu)
Fri, 10 Jul 98 06:21:07 PDT

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

> I'm working on a finite element preprocessor for NASTRAN. During
> import of data I want the mouse cursor to change to a clock. Does
> anyone know how to wrap my import function in xform. ...

fl_set_cursor( window, XC_clock );
fl_check_forms(); /* Necessary to flush the queue and */
/* show the clock cursor */

do_your_NASTRAN_stuff();

fl_reset_cursor( window );
fl_check_forms();

You can derive the Window parameter from an object with FL_ObjWin().

Note: There's a small glitch here. If you want to set the cursor to
a clock on a form that has child Windows, such as Canvas objects or
TabFolder objects, you need to descend the Window tree. Here are two
little routines I cobbled up recently to do this:

void spl_set_cursor( FL_FORM *form, int cursor )

{

Window w = form->window;
Window root;
Window parent;
Window *children;
int nchildren;

XQueryTree( fl_get_display(), w, &root, &parent, &children,
&nchildren );

if ( nchildren ) {

while ( --nchildren > 0 )
fl_set_cursor( children[nchildren], cursor );
XFree( children );

}
fl_set_cursor( w, cursor );

fl_check_forms();

}

void spl_reset_cursor( FL_FORM *form )

{

Window w = form->window;
Window root;
Window parent;
Window *children;
int nchildren;

XQueryTree( fl_get_display(), w, &root, &parent, &children,
&nchildren );

if ( nchildren ) {

while ( --nchildren > 0 )
fl_reset_cursor( children[nchildren] );
XFree( children );

}
fl_reset_cursor( w );

fl_check_forms();

}

spl
_________________________________________________
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/