Re: Making a toolbar button show a menu
"Stephen J. Turnbull" <[email protected]> Tue, 04 May 2004 15:31:49 +0900
| Newsgroups | gmane.emacs.xemacs.general |
|---|---|
| Organization | The XEmacs Project |
| Message-ID | <[email protected]> |
>>>>> "Miguel" == Miguel Frasson <[email protected]> writes: Miguel> I would line to define a toolbar button that would be able Miguel> to show a popup menu when clicked. This is bad design; it's exactly what the menubar is for. Of course it's up to you if you want to follow this path, but that is my advice. Note that the menubar can have buttons; see the menubar used by VM, and also the main menubar for "xemacs -vanilla", which has a "load init file" button (lisp/menubar-items.el, `init-menubar-at-startup'). Miguel> I can poorly fake it with the following code, but only in Miguel> the second click I get the menu to show up, so it is Miguel> unusable. (defun stupid-show-menu () (interactive) (popup-menu '("Options" [ "Save As..." write-file t ] [ "Revert Buffer" revert-buffer (buffer-modified-p) ] [ "Read Only" toggle-read-only :style toggle :selected buffer-read-only ]) (next-command-event))) Aren't you working too hard? The EVENT argument of popup-menu is optional, and is used in case the menu is generic and the popup might be a _response_ to several different events. It is _not_ the _selection_ event; that is processed by the menu itself. Since this menu is only going to be used by `stupid-show-menu', I think you just want to omit the EVENT argument. -- Institute of Policy and Planning Sciences http://turnbull.sk.tsukuba.ac.jp University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN Ask not how you can "do" free software business; ask what your business can "do for" free software.