XtEventHandler man page on HP-UX

Man page or keyword search:  
man Server   10987 pages
apropos Keyword Search (all sections)
Output format
HP-UX logo
[printable version]

XtEventHandler()					      XtEventHandler()

Name
  XtEventHandler - interface definition for event handler procedure.

Synopsis
  typedef void (*XtEventHandler)(Widget, XtPointer, XEvent *, Boolean *);
	 Widget w;
	 XtPointer client_data;
	 XEvent *event;
	 Boolean *continue_to_dispatch_return

Inputs
  w	    Specifies the widget for which the handler was registered.

  client_data
	    Specifies data registered with this event handler.

  event	    Specifies the event that triggered this call.

Outputs
  continue_to_dispatch_return
	    Returns  a	Boolean	 indicating whether to call the remaining
	    event handlers that are registered for the current event.

Description
  An XtEventHandler is registered with XtAddEventHandler(), XtAddRawEven‐
  tHandler(),  XtInsertEventHandler(),	or XtInsertRawEventHandler().  It
  is called when one of the events  that  it  was  registered  to  handle
  occurs on the widget it was registered for.

  An  XtEventHandler  should  do whatever processing is necessary for the
  widget or application to handle the event event that occurred on widget
  w.   The client_data argument can be arbitrary data registered with the
  event handler procedure.  It is cast to an  XtPointer	 when  registered
  and  should  be cast back to the appropriate type within the event han‐
  dler.

  The continue_to_dispatch_return is the address of  a	Boolean	 variable
  which	 is intialized to True by the Intrinsics before the event handler
  is called.  If a handler sets this variable to False, then no more han‐
  dlers	 will be dispatched for the event.  Doing this may lead to porta‐
  bility problems because implementations of the Intrinsics  are  allowed
  to add event handlers for any widget at any time.  If you prevent these
  potential "invisible" event handlers from receiving events, the Intrin‐
  sics are not guaranteed to behave as expected.

Usage
  Most widgets and applications do not need to use event handlers explic‐
  itly.	 Instead they can use translation tables and action procedures.

Example
  The procedure below is an event handler from the xmag client.	 It is	a
  special  handler  that  follows  the	location of the mouse while it is
  dragged with the button down and a pointer grab is  in  effect.    When
  the button is released, it magnifies a new area of the screen, releases
  the pointer grab, and calls XtRemoveEventHandler() on itself.

     /*
      * ResizeEH() -- Event Handler for resize of selection box.
      */
     static void
     ResizeEH(w, closure, event, continue_to_dispatch)	     /* ARGSUSED */
	  Widget w; XtPointer closure; XEvent *event; Boolean *continue_to_dispatch;
     {
       hlPtr data = (hlPtr)closure;
       switch (event->type) {
       case MotionNotify:
	 data->x = event->xmotion.x_root;
	 data->y = event->xmotion.y_root;
	 break;
       case ButtonRelease:
	 GetImageAndAttributes(FindWindow(event->xmotion.x_root,
			     event->xmotion.y_root),
		  min(data->homeX,event->xbutton.x_root),
		  min(data->homeY,event->xbutton.y_root),
		  abs(data->homeX - event->xbutton.x_root),
		  abs(data->homeY - event->xbutton.y_root),
		  data);
	 if (data->newScale)
	   PopupNewScale(data);
	 else
	   SWSetImage(data->scaleInstance, data->image);
	 XtUngrabPointer(w, CurrentTime);
	 XtRemoveEventHandler(w, PointerMotionMask ButtonReleaseMask,
			      True, ResizeEH, (XtPointer)data);
	 data->selectMode = done;
	 break;
       }
     }

  This event handler is registered with the following code, invoked  when
  the user presses mouse button 2.

	 XtAddEventHandler(w, PointerMotionMask ButtonReleaseMask,
			   True, ResizeEH, (XtPointer)data);

See Also
  XtAddEventHandler(1), XtAddRawEventHandler(1), XtAppAddActions(1),
  XtRemoveEventHandler(1), XtRemoveRawEventHandler(1).

Xt - Event Handling					      XtEventHandler()
[top]

List of man pages available for HP-UX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net