Re: XForms: XEvent question ( I think?)

Ivan Powis (pczip@chemistry.nottingham.ac.uk)
Sat, 15 Nov 1997 9:56:33 GMT

To subscribers of the xforms list from Ivan Powis <pczip@chemistry.nottingham.ac.uk> :

>
> To subscribers of the xforms list from "John Prinos" <t47851@perf2.dehavilland.ca> :
>
>
> Let's say that I have a form with an arbitrary number of xyplots. If I wanted
> to detect a mouse click and determine which xyplot was clicked on, would I use:
>
> Or, is there some way to determine which xyplot on the form was clicked on and
> then act?
>

I have a number of applications with the same requirement. When I want
complex interaction (cursor readout, click to set cursors, shift click
for postscript dump ....) I use a pre/posthandler to do this. See the
DEMOS for an example xyplot posthandler.

However if you simply want to click to select a plot I use a hidden
button over the xyplot, which returns a code identifying the xyplot to
a common callback routine . This is easy to set up and works perfectly
well. I name the xyplots xyp[0], xyp[1] ... and set the argument to
the button callback to the corresponding index. The button callback
then looks like:

void hb_cb(FL_OBJECT *ob, long i)
{
FD_gui *fd = ob->form->fdui;

if(fd->xyp[i] == NULL) return;
... do whats needed to fd->xyp[i] ..
}

Ivan

--
-------------------------------------------------------------------------+
    ___  ___/   _  __ /  Ivan Powis                TEL: +44-115-951-3467 |
        /         /   /  Department of Chemistry   FAX: +44-115-951-3562 |
       /         /  _/   University of Nottingham                        |
      /         ___/     Nottingham NG7 2RD                              |
     /         /         UK                                              |
    /         /                      pczip@chem.nott.ac.uk               | 
_______/  ____/                      http://www.chem.nott.ac.uk/IP.html  |
-------------------------------------------------------------------------+

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