From: Ken Cheetham

Subject: Re: [pcspr4288] Custom event handling of a widget

Date: 1997-1-16 22:27


  Thanks for your help. I followed and succeed. However, when I tried to
  do something similar for mouse-left-down, a peculiar behavior
  occured. The standard right-mouse pop-up menu and my custom message
  box appear simutaneously (seemingly). Is there any way to get rid of
  the standard right-mouse pop-up menu?

The allegro development environment implements a right-button menu for
widgets that has a subset of the menubar commands on it.  (This menu
is not there in a runtime image).  This menu is handled in an EVENT
method that is invoked on the dialog-item object (stemming from the
right-click event that comes in to the dialog for any widget on it),
while for a "windows subclassed" widget EVENT is invoked for the
dialog-item-WINDOW (stemming from the mouse event sent directly to the
widget).  So there's a bit of confusion due to handling both the
"parent notify" message that's sent to the parent dialog AND the
mouse-click message sent directly to the widget (which we receive due
to the subclassing), and this leads to the event being handled two
different ways.

At any rate, you can get rid of that pop-up menu by overriding
this built-in method that invokes it (for example, by defining
a version of it for your item-list class that does nothing).

(defmethod event ((widget dialog-item)(event (eql mouse-right-down))
                  (buttons (eql right-mouse-button))
                  data time)
   (pop-up-right-button-menu (dialog-item-window widget)))

Ken Cheetham                          <franz.com at cheetham>
Franz Inc.                            Voice: (510) 548-3600
1995 University Avenue, Suite 275     Fax:   (510) 548-8253
Berkeley, CA  94704                   http:  //www.franz.com/
ACL Windows FAQ: ftp.franz.com:/pub/acl4w-faq
ACL Unix    FAQ: ftp.franz.com:/pub/faq