unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* What is the difference between down-mouse-3 and mouse-3
@ 2008-04-15  4:38 Ye Wenbin
  2008-04-15 14:45 ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Ye Wenbin @ 2008-04-15  4:38 UTC (permalink / raw)
  To: emacs-devel

I wrote try to figure out how to set up mouse menu, after spending a lot of
time to to figure out why no action preform when click submenu, I found  
that
I should bind down-mouse-3 event rather than mouse-3 event. I can't find
where is the difference mentioned in elisp manual. Is there any documents
for the reason that submenu does not work for mouse-3 binding?

Here is my test code:
(define-derived-mode foo-mode text-mode "Foo"
   "Test major mode"
   )
(easy-menu-define foo-menu foo-mode-map "My own menu"
   '("Foo"
     ["Next Line" next-line t]
     ("Sub Menu"
      ["Previous Line" previous-line t])))

(define-key foo-mode-map [mouse-3] 'mouse-popup-menubar-stuff)
;; (define-key foo-mode-map [down-mouse-3] 'mouse-popup-menubar-stuff)

-- 
Best Regards,
Ye Wenbin




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: What is the difference between down-mouse-3 and mouse-3
  2008-04-15  4:38 What is the difference between down-mouse-3 and mouse-3 Ye Wenbin
@ 2008-04-15 14:45 ` Stefan Monnier
  2008-04-15 15:06   ` Ye Wenbin
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2008-04-15 14:45 UTC (permalink / raw)
  To: Ye Wenbin; +Cc: emacs-devel

> I wrote try to figure out how to set up mouse menu, after spending a lot of
> time to to figure out why no action preform when click submenu, I found that
> I should bind down-mouse-3 event rather than mouse-3 event. I can't find
> where is the difference mentioned in elisp manual. Is there any documents
> for the reason that submenu does not work for mouse-3 binding?

Don't know, it works for me (tried both with the trunk and with 22.1).
What do you mean by "does not work"?

This said, binding it to down-mouse-3 is *much* better so you can do
"press-button, select-entry, release-button".


        Stefan




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: What is the difference between down-mouse-3 and mouse-3
  2008-04-15 14:45 ` Stefan Monnier
@ 2008-04-15 15:06   ` Ye Wenbin
  2008-04-15 17:37     ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Ye Wenbin @ 2008-04-15 15:06 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel@gnu.org

On Tue, 15 Apr 2008 22:45:52 +0800, Stefan Monnier  
<monnier@iro.umontreal.ca> wrote:

> Don't know, it works for me (tried both with the trunk and with 22.1).
> What do you mean by "does not work"?
Really, I test both emacs22 (GNU Emacs 22.1.1 (i486-pc-linux-gnu,  
GTK+ Version 2.10.11) of 2007-11-21 on vernadsky)
and emacs23(GNU Emacs 23.0.60.7 (i686-pc-linux-gnu, GTK+ Version 2.10.11)  
of 2008-03-29 on ywb-laptop),
if bind the menu to mouse-3, the command in submenu does not called. I  
test as following:
  1. `emacs -q' start emacs
  2. in *scratch* buffer, paste code:
(define-derived-mode foo-mode text-mode "Foo"
   "Test major mode"
   )
(easy-menu-define foo-menu foo-mode-map "My own menu"
   '("Foo"
     ["Next Line" next-line t]
     ("Sub Menu"
      ["Previous Line" previous-line t])))

(define-key foo-mode-map [mouse-3] 'mouse-popup-menubar-stuff)

  3. M-x eval-buffer
  4. click right mouse button, select "Sub Menu" "Previous Line", the  
cursor does not
  go to previous line, but if select "Next Line", the cursor moves.

>
> This said, binding it to down-mouse-3 is *much* better so you can do
> "press-button, select-entry, release-button".
That may be the answer. But if it is true that bind mouse menu to mouse-3  
doesn't work for submenu,
I think the elisp manual should emphasize this. After I figure out the  
problem, I only find a paragraph
metion it:

22.17.2 Menus and the Mouse

    It's often best to use a button-down event to trigger the menu.  Then
the user can select a menu item by releasing the button.

-- 
Best Regards,
Ye Wenbin




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: What is the difference between down-mouse-3 and mouse-3
  2008-04-15 15:06   ` Ye Wenbin
@ 2008-04-15 17:37     ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2008-04-15 17:37 UTC (permalink / raw)
  To: Ye Wenbin; +Cc: emacs-devel@gnu.org

>  3. M-x eval-buffer
>  4. click right mouse button, select "Sub Menu" "Previous Line", the cursor
> does not go to previous line, but if select "Next Line", the cursor moves.

Oh... so that's what you meant by "does not work"?
Please be more precise next time.  I just tried to pop up the menu and
it worked.

Now I tried your recipe and indeed the "Previous line" entry in the
submenu doesn't seem to do anything.  With a recent checkout of the CVS
trunk it works correctly, tho.  So either the problem was fixed between
the March 29 and April 8, or there's something more subtle going on.

> That may be the answer. But if it is true that bind mouse menu to mouse-3 
> doesn't work for submenu, I think the elisp manual should emphasize this.

No, it *should* work.
But bugs are part of life,


        Stefan




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-04-15 17:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-15  4:38 What is the difference between down-mouse-3 and mouse-3 Ye Wenbin
2008-04-15 14:45 ` Stefan Monnier
2008-04-15 15:06   ` Ye Wenbin
2008-04-15 17:37     ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).