Subject: bug#11148: 23.3; x-popup-menu not behaving as documented

From: "Drew Adams" <[email-masked]>
Date: Sun, 1 Apr 2012 09:19:29 -0700

> (x-popup-menu
>   t
>   (list "TITLE"
>         (list "PANE" (list "menu item 1" nil)
>         (list "menu item 2" nil))))
> ...shows a menu in which both items are selectable. 
>
> This bug may be relevant to bug #11138. One of the proposed fixes for
> #11138 at the time of this report is to render a multi-line dialog box
> as a menu, with each "line" in the message displayed as an unselectable
> menu item.
> 
> But this brief test seems to indicate that the "unselectable"
> menu items are not really unselectable, at least on Windows.
> In that case the proposed fix would be unsatisfactory.

First, I don't really care how bug #11138 is fixed.

My point in suggesting splitting a message at \n chars was that the bug can be
fixed - even if in a rudimentary way by treating the message's separate lines as
separate menu lines (since the code on MS Windows currently treats a
`message-box' as a popup menu).

Here is what I mean (one way), using the bug report's multiline message:

(defun foo (event)
  (interactive "e")
  (let ((choice  (x-popup-menu
                 	 event
                   '("Message"
                     ("" "First line in a long-ish message.")
                     ("" "This is line number 2 in the message.")
                     ("" ("OK"))))))
    (and choice  (call-interactively choice))))

(global-set-key [double-mouse-2] 'foo)
(global-set-key [mouse-2] nil)

Double-click mouse-2.  The message's lines are indeed handled as unselectable
menu items (yes, on MS Windows).

Is that the best looking implementation of a message dialog box?  Not IMO.

But given the desire to implement a message box using `x-popup-menu', that shows
at least that it can be done.  Is that better than the current implementation,
which jams the multiple lines of the message together?  Maybe.

Certainly we can hope for a better implementation.  Stefan suggested using a
tooltip frame, for instance.  And maybe (?) at least some of the implementation
could be moved from C to Lisp.
	 
> I'd like to also raise a documentation bug, as well: there ought to be
> examples showing how to use x-popup-menu, on the page I cited above. 
> A few simple examples will make this method much more usable.

Agreed, especially since there are a few different ways to use `x-popup-menu':
keymap, list of keymaps, or menu of multiple panes, the last of these being
radically different from the first two and unique wrt the rest of Emacs.