Making a toolbar button show a menu

Miguel Frasson <[email protected]> 29 Apr 2004 14:06:59 +0200
Newsgroups gmane.emacs.xemacs.general
Message-ID <[email protected]>
Hi.

I would line to define a toolbar button that would be able to show a popup
menu when clicked.

I can poorly fake it with the following code, but only in the second click
I get the menu to show up, so it is 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)))

(set-specifier default-toolbar
	       '([toolbar-cut-icon stupid-show-menu t
				   "Get a popup menu on 2nd click :-("])
	       (current-buffer))

Is there a nice way to do it properly?

[]'s

Miguel.

-- 
Miguel Vinicius Santini Frasson
http://www.math.leidenuniv.nl/~frasson