knowing mouse position

phill%med-image.compsci.bristol.ac.uk at nsfnet-relay.ac.uk phill%med-image.compsci.bristol.ac.uk at nsfnet-relay.ac.uk
Mon May 22 23:16:49 AEST 1989


A while back I posted a message asking for help about how to make any
Sunview tool I was writing know whether the mouse was currently in it.
This message is the followup.

The most probable line of attack was to interpose a frame event handler
and look for the WIN_ENTER & WIN_EXIT event codes; however, this is
unreliable as the thinness of the frame can cause some of these events not
to be generated.  Checking for these events in event procedures for each
of the panels and canvases in the tool seems to work better, but there is
a lot of extra information generated and I'm not convinced that it's
totally reliable.

Better is to enable WIN_IN_TRANSIT_EVENTS and just use the interposed
frame handler, although as the manual states, this does significantly slow
the tool down due to the amount of events generated.

A Sun employee finally helped me out. The thing to look for is the events
KBD_USE and KBD_DONE. Avoid using the frame interposer with or without
WIN_IN_TRANSIT_EVENTS due to the slowing down problem. Set up an event
procedure for each of the panels, canvases etc and trap these events
there. Note that you need to set up a PANEL_BACKGROUND_PROC for panel
event procedures.

This seems a little odd, but it does work and has been reliable to date.
Thanks to all those people who responded.

Phill Everson
Comp Sci Dept., 
University of Bristol, UK



More information about the Comp.sys.sun mailing list