Re: XForms: drawing on my canvas with the mouse

Steve Lamont (spl@szechuan.ucsd.edu)
Tue, 17 Feb 98 17:23:52 PST

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

> My second is a motion notify handler.. and what I would like to do is
> this: Print out the current position of the mouse somewhere on my form
> itself.. not to stdout, (and not to the canvas either). I can accomplish
> this by printing to stdout.. but I'd rather print to the program window. I
> can't seem to get fl_draw_text to work..

My favorite thing is to just use a text object. Here's a little
generic routine I use:

#include <stdarg.h>

[...]

void readout( FL_OBJECT *obj, char *fmt, ... )

{

va_list list;
char buffer[80];

va_start( list, fmt );

vsprintf( buffer, fmt, list );

va_end( list );

fl_set_object_label( obj, buffer );

}

So, I'd call it with from my motion handler as:

readout( some_object, "%d,%d", x, y );

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://bloch.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/