unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Tim Cross <theophilusx@gmail.com>
To: "Jan Djärv" <jan.h.d@swipnet.se>
Cc: emacs-devel@gnu.org
Subject: Re: Modify menu-bar help
Date: Sat, 26 Feb 2011 01:49:29 +1100	[thread overview]
Message-ID: <AANLkTimW5CH9RaMMUtNordOETMv18q6=3C8SmzMLG5-p@mail.gmail.com> (raw)
In-Reply-To: <4D677E64.9010400@swipnet.se>

[-- Attachment #1: Type: text/plain, Size: 4039 bytes --]

On Fri, Feb 25, 2011 at 9:03 PM, Jan Djärv <jan.h.d@swipnet.se> wrote:

> 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.
>
> Thanks everyone for your input. Jan, you confirm what I suspected. I will
try to build with the old X athena libs and see if it works (which I expect
it will).

This strikes me as something that should be in the manual. Would everyone
agree it would be worth lodging a bug report to have this information added
as a footnote or reference i.e. that you cannot add menu actions/buttons to
the top level menu when using gtk_?

Tim

[-- Attachment #2: Type: text/html, Size: 4787 bytes --]

  reply	other threads:[~2011-02-25 14:49 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
2011-02-25 14:49       ` Tim Cross [this message]
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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTimW5CH9RaMMUtNordOETMv18q6=3C8SmzMLG5-p@mail.gmail.com' \
    --to=theophilusx@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=jan.h.d@swipnet.se \
    /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 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).