[comp.sys.sun] Canvas popup menus in suntools

mephdbo%prism@gatech.edu (d. majumder) (08/05/89)

I had a question about using popup menus while processing button events
for a canvas. I have to popup certain menus when buttons are clicked on
certain locations of canvas.  Now I have scrollbars with the canvas. If
the canvas is unscrolled then menu pops up right where the mouse button is
pressed. But if the canvas has been scolled away from zero position then
the menu pops at weird places, like one corner of the entire screen. Any
idea about how to prevent that. Is there any MENU_ attributes to
explicitly specify the menu's location. 

ThankYou

deeptendu

chuck@trantor.harris-atd.com (Chuck Musciano) (08/22/89)

> Now I have scrollbars with the canvas. If
> the canvas is unscrolled then menu pops up right where the mouse button is
> pressed. But if the canvas has been scolled away from zero position then
> the menu pops at weird places, like one corner of the entire screen.

When you call menu_show(), it needs the event which initiated the request
and the window it occured in.  I believe the menu package uses this event
to determine where the menu will be displayed, and which button up event
signifies a selection in the menu.  If you have a scrolling canvas, the
event coordinate space has been translated by your scrolling, and this
probably confuses the menu package.  I believe there is a routine which
translates from canvas to world coordinates, which you might want to use
to adjust the event location before calling menu_show().

Chuck Musciano				ARPA  : chuck@trantor.harris-atd.com
Harris Corporation 			Usenet: ...!uunet!x102a!trantor!chuck
PO Box 37, MS 3A/1912			AT&T  : (407) 727-6131
Melbourne, FL 32902			FAX   : (407) 727-{5118,5227,4004}

Gee, Beaver, everything's that fun can get you in trouble.  Haven't you
learned that yet? --Gilbert