From: "Jan Djärv" <jan.h.d@swipnet.se>
To: Tim Cross <theophilusx@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Modify menu-bar help
Date: Fri, 25 Feb 2011 11:03:16 +0100 [thread overview]
Message-ID: <4D677E64.9010400@swipnet.se> (raw)
In-Reply-To: <AANLkTikRE+DUJXqoEJ7=_S+1YFJ_5muPuwOjEJsWVxFO@mail.gmail.com>
2011-02-25 06:14, Tim Cross skrev:
>
>
> On Fri, Feb 25, 2011 at 11:52 AM, Drew Adams <drew.adams@oracle.com
> <mailto:drew.adams@oracle.com>> wrote:
>
> (defun tx-greet ()
> (interactive)
> (message "Hello Tim!"))
>
> (defun tx-menu ()
> (interactive)
> (define-key lisp-interaction-mode-map [menu-bar tx]
> '(menu-item "TX Test" tx-greet)))
>
> I get the expected menu item at the top level, but clicking on it does
> nothing - well, it grabs focus, the item is highlighted and you have
> to click again to release focus.
>
> So, what am I doing wrong?
>
> Doing just what you said works for me. I get a `TX Test' menu at the top
> level. Clicking it shows the message `Hello Tim!'. I used a recent Windows
> build of Emacs 24 (emacs -Q).
> Did you test with `emacs -Q'?
> Did you remember to do `M-x t-menu'? ;-)
> Did you look in *Messages* for the message (in case it was too quick).
> Did you already have a *scratch* buffer (or other buffer in Lisp
> Interaction Mode).
> If so, try killing it and revisiting (recreating) it.
> (But if you see the menu `TX Test' then it should be OK.)
> You can also try running the functions on `menu-bar-update-hook'.
> Or (run-hooks 'activate-menubar-hook 'menu-bar-update-hook).
> But again if you see `TX Test' then it should be OK.
> (IOW, I don't know what's wrong, sorry.)
>
> Hi Drew,
>
> thanks for the response. It doesn't work for me with emacs -Q. I get the menu
> item right before the lisp-interaction menu, but clicking on it just
> highlights it and nothing happens, except the focus is stolen and you cannot
> do anything until you click on it a second time. There is nothing in the
> messages buffer apart from the tx-greet and tx-menu lines that are added when
> you evaluate the functions. I can run tx-greet and it does what it should and
> running the tx-menu adds the entry which does nothing. There is no other
> scratch buffer.
>
> I'm running a recent (last couple of days) version of emacs 24 from bzr. I'll
> update and try again. Sems odd it will work for you but not me when we are
> running similar versions, but a windows build v linux 64bit build. I'll also
> try with latest emacs 23 and see if I get the same issue.
>
> It would be good if someone else can try on Linux (especially 64bit) and it
> would be interesting to know if it works with a build using the old X11 libs
> rather than gtk, just to rule that out as the difference.
>
> If nobody can see a problem with the code I'm using, I'm suspecting it is
> either a bug or an undocumented feature (i.e. cannot have menu acitons at the
> top level, only sub-menus since the same code appears to work fine if it is in
> a sub-menu).
It is a Gtk+ thing. Menubars are only supposed to have menus, not buttons.
Buttons should go in tool bars. You can't even put in buttons in a Gtk+ menu
bar, you can only put in menu items, and they tend to "steal" all mouse
presses before Emacs sees them. Maybe there is a way around this, but it is
not worth it. Besides, we always create an empty sub menu if there isn't one
because some themes assume a submenu and draws things incorrectly if there
isn't one.
Jan D.
Jan D.
next prev parent reply other threads:[~2011-02-25 10:03 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-24 23:16 Modify menu-bar help Tim Cross
2011-02-25 0:52 ` Drew Adams
2011-02-25 5:14 ` Tim Cross
2011-02-25 7:15 ` Drew Adams
2011-02-25 9:31 ` Eli Zaretskii
2011-02-25 9:30 ` Eli Zaretskii
2011-02-25 10:03 ` Jan Djärv [this message]
2011-02-25 14:49 ` Tim Cross
2011-02-25 15:29 ` Drew Adams
2011-02-25 15:31 ` Eli Zaretskii
2011-02-25 15:38 ` Drew Adams
2011-02-25 15:54 ` Eli Zaretskii
2011-02-25 17:08 ` Jan Djärv
2011-02-25 17:22 ` Drew Adams
2011-02-25 9:27 ` Eli Zaretskii
-- strict thread matches above, loose matches on Subject: below --
2011-02-25 20:33 Ben Key
2011-02-25 23:58 ` Tim Cross
2011-02-26 1:04 ` Tim Cross
2011-02-26 10:21 ` Jan Djärv
2011-02-26 10:22 ` Jan Djärv
2011-02-26 22:27 ` Tim Cross
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D677E64.9010400@swipnet.se \
--to=jan.h.d@swipnet.se \
--cc=emacs-devel@gnu.org \
--cc=theophilusx@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.