Re: XForms: send data to event routine

Stephen Huyssoon (huyssoons@advancia.com)
Thu, 11 Mar 1999 14:10:49 -0600

# To subscribers of the xforms list from Stephen Huyssoon <huyssoons@advancia.com> :

Gunawan Kowani wrote:
>
> # To subscribers of the xforms list from Gunawan Kowani <kowani@cs.tu-berlin.de> :
>
> Hello ,
> how to transfer some data from the routine
> 'create_form_canvasform' to 'buttonpress_cb'
> as argument (without using global variable)? Thank you.
>
> Gunawan
>
> ...
> ...
> ...
> int buttonpress_cb( FL_OBJECT *canvas, Window win, int w, int h,
> XEvent *ev, void *data )
> {
> }
>
> FD_canvasform* create_form_canvasform(void)
> {
> fl_add_canvas_handler( obj, ButtonPress, buttonpress_cb, fdui->form );
> }
> ...
> ...
> ...

Make yerself a structure, something like

template <class T, short int l>
class xformsdatacontainer
{
public:

T * data [ l ];

xformsdatacontainer (
T * d1 = 0,
T * d2 = 0,
T * d3 = 0,
T * d4 = 0 );

~xformsdatacontainer();
};

Make an instance with

xformsdatacontainer<void> xfdc( & gosh1, & gosh2 );

Attach it to your callback with

fl_add_canvas_handler( FL_OBJECT *ob, int event,
FL_HANDLE_CANVAS handler, (void *) & xfdc );

-- 
  (Stephen Huyssoon)
>=========================================>
  (huyssoons@advancia.com)

To Infinity and Beyond! -- Me and Buzz Lightyear

Julia's Law of Software Development: Business is business and programming is not. -- Julia Burt's Principle for Programming: Less is more, and cheese is a fundamental ingredient. _________________________________________________ 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/