Constraining cursor to a window

Tim Hall tjh at bucrf11.bu.edu
Thu Jul 19 00:07:15 AEST 1990


In article <156 at cutmcvax.OZ>, flint at cutmcvax.OZ (Danny Baldoni) writes:
|> 

|>                               What I'd like to know is whether or not
|> there's any way I can restrict the movement of the cursor so that it can
|> NEVER (unless I release it) move outside the boundaries of one of those
|> windows.
|> 

Yes, find the boundaries of your window and then use 'setvaluator' to 
constrain the cursor.  For example if the lower left of your window is
at xmin/ymin and the upper right is at xmax/ymax the following...

	setvaluator( MOUSEX, ( xmax - xmin ) / 2, xmin, xmax );
	setvaluator( MOUSEY, ( ymax - ymin ) / 2, ymin, ymax );

puts the cursor in the center of the window and constrains it within
the window boundaries.  However, if there is another window overlapping 
this window the cursor can enter it.

-Tim Hall
tjh at bu-pub.bu.edu



More information about the Comp.sys.sgi mailing list