Re: XForms: Sorry to be dumb!

Steve Lamont (spl@szechuan.ucsd.edu)
Tue, 5 Oct 99 09:03:43 PDT

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

> Can someone please tell me the best way how to get the offset of an object
> on a form?

> e.g. I have a glcanvas on a form, the offset is say 10,45 (as set up
> in fdesign) and the call to fl_add_glcanvas().
>
> To test for a mouse ONLY inside the glcanvas, I need to know these
> offset values ... (I would rather not code them in as "magic").

I'm not completely sure what you're up to but the `x' and `y' members
of the FL_OBJECT structre provide the offset of any object from the
origin of the form:

canvas_obj->x
canvas_obj->y

give the location of `canvas_obj'.

Bear in mind that you can also get the cursor position relative to the
origin of a Canvas object by using

fl_get_win_mouse( FL_ObjWin( canvas ), &x, &y, &keymask );

No magic required (other than the standard sacrifice of a goat to the
compiler gods).

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/