From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim Cross Newsgroups: gmane.emacs.devel Subject: Re: Modify menu-bar help Date: Sat, 26 Feb 2011 01:49:29 +1100 Message-ID: References: <22CD3A4D8F6B4B5A8F20A4FBE74BAD10@us.oracle.com> <4D677E64.9010400@swipnet.se> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=00221532ca38ec34bf049d1c6f13 X-Trace: dough.gmane.org 1298645455 11615 80.91.229.12 (25 Feb 2011 14:50:55 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 25 Feb 2011 14:50:55 +0000 (UTC) Cc: emacs-devel@gnu.org To: =?ISO-8859-1?Q?Jan_Dj=E4rv?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 25 15:50:51 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Psz0L-0006P3-W2 for ged-emacs-devel@m.gmane.org; Fri, 25 Feb 2011 15:50:50 +0100 Original-Received: from localhost ([127.0.0.1]:57790 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Psz0L-00005W-BO for ged-emacs-devel@m.gmane.org; Fri, 25 Feb 2011 09:50:49 -0500 Original-Received: from [140.186.70.92] (port=39257 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Psz0C-00005G-7u for emacs-devel@gnu.org; Fri, 25 Feb 2011 09:50:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Psz09-0001hb-8H for emacs-devel@gnu.org; Fri, 25 Feb 2011 09:50:40 -0500 Original-Received: from mail-iy0-f169.google.com ([209.85.210.169]:49713) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Psz09-0001hI-0v for emacs-devel@gnu.org; Fri, 25 Feb 2011 09:50:37 -0500 Original-Received: by iyf13 with SMTP id 13so1216167iyf.0 for ; Fri, 25 Feb 2011 06:50:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=F07yZv9lJva0LNlPbcNghdayKwev+WcmfJ/Z2Hkh3i4=; b=jN7ntAJLKHPt7elMBAaqxJfZdKFJj+CW7ZCPFuP0ZAS1ApBs//kFiumCV/PyvR3K0i OdDBqriWe1GX+g7Epzc7XHPBiKUBrWoqtuzGYWw/gczVr/AWMWJ67h1x1uYShD9xniU5 iU6qE+f7T+7hl1dJuo+/hnunEGHHP+aCf4hVM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=dYXet+/VlaEQ10zA+6eVOTBWU9/7JkTQkkbeoOcc0tLit8aiXuqUxSbxvhl6sK5VJn 3fMROJMZNiA8ni/Pmb6MRLmCoreSFgkyQFoYwiaBTn00/PIIAZFFX+kePDUscwIeTevb 1jCKZnBK6QCCZahI/H8tBolbj3lt3MVlv8W3g= Original-Received: by 10.231.11.2 with SMTP id r2mr2740246ibr.174.1298645369238; Fri, 25 Feb 2011 06:49:29 -0800 (PST) Original-Received: by 10.231.37.198 with HTTP; Fri, 25 Feb 2011 06:49:29 -0800 (PST) In-Reply-To: <4D677E64.9010400@swipnet.se> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.210.169 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:136509 Archived-At: --00221532ca38ec34bf049d1c6f13 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Fri, Feb 25, 2011 at 9:03 PM, Jan Dj=E4rv wrote: > 2011-02-25 06:14, Tim Cross skrev: > >> >> >> On Fri, Feb 25, 2011 at 11:52 AM, Drew Adams > > 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 shoul= d >> 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 i= s >> either a bug or an undocumented feature (i.e. cannot have menu acitons a= t >> 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 button= s. > 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 mo= use > 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 --00221532ca38ec34bf049d1c6f13 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

On Fri, Feb 25, 2011 at 9:03 PM, Jan Dj= =E4rv <jan.h.d@s= wipnet.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:

=A0 =A0 =A0 =A0(defun tx-greet ()
=A0 =A0 =A0 =A0 =A0 (interactive)
=A0 =A0 =A0 =A0 =A0 (message "Hello Tim!"))

=A0 =A0 =A0 =A0(defun tx-menu ()
=A0 =A0 =A0 =A0 =A0 (interactive)
=A0 =A0 =A0 =A0 =A0 (define-key lisp-interaction-mode-map [menu-bar tx] =A0 =A0 =A0 =A0'(menu-item "TX Test" tx-greet)))

=A0 =A0 =A0 =A0I get the expected menu item at the top level, but clicking= on it does
=A0 =A0 =A0 =A0nothing - well, it grabs focus, the item is highlighted and= you have
=A0 =A0 =A0 =A0to click again to release focus.

=A0 =A0 =A0 =A0So, what am I doing wrong?

=A0 =A0Doing just what you said works for me. =A0I get a `TX Test' men= u at the top
=A0 =A0level. Clicking it shows the message `Hello Tim!'. I used a rec= ent Windows
=A0 =A0build of Emacs 24 (emacs -Q).
=A0 =A0Did you test with `emacs -Q'?
=A0 =A0Did you remember to do `M-x t-menu'? ;-)
=A0 =A0Did you look in *Messages* for the message (in case it was too quic= k).
=A0 =A0Did you already have a *scratch* buffer (or other buffer in Lisp =A0 =A0Interaction Mode).
=A0 =A0If so, try killing it and revisiting (recreating) it.
=A0 =A0(But if you see the menu `TX Test' then it should be OK.)
=A0 =A0You can also try running the functions on `menu-bar-update-hook'= ;.
=A0 =A0Or (run-hooks 'activate-menubar-hook 'menu-bar-update-hook)= .
=A0 =A0But again if you see `TX Test' then it should be OK.
=A0 =A0(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 th= e 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 canno= t
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 wh= en
you evaluate the functions. I can run tx-greet and it does what it should a= nd
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. =A0Sems odd it will work for you but not me when we a= re
running similar versions, but a windows build v linux 64bit build. =A0I'= ;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 lib= s
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 t= he
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. =A0Menubars are only supposed to have menus, not button= s. Buttons should go in tool bars. =A0You can't even put in buttons in = a Gtk+ menu bar, you can only put in menu items, and they tend to "ste= al" all mouse presses before Emacs sees them. =A0Maybe there is a way = around this, but it is not worth it. =A0Besides, we always create an empty = sub menu if there isn't one because some themes assume a submenu and dr= aws things incorrectly if there isn't one.

=A0 =A0 =A0 =A0Jan D.


=A0 =A0 =A0 =A0Jan 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 wor= ks (which I expect it will).=A0

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

Tim

--00221532ca38ec34bf049d1c6f13--