Re: Popup menus
It also needs to be called within the same process!! This was
totally my bad. The sequence of events that led to the popup
was started by a timer expiration. EXECUTE-WITH-INTERFACE fixed
things nicely.
Thanks,
Greg
Quoting davef@xanalys.com:
>
> Could someone clue me into how to create a popup menu, ala the right
> click menu in the Lispworks windows. I've tried
>
> (capi:display-popup-menu
> (make-instance 'capi:menu :items '("one" "two" "three" "four" "five")
> :x x :y y :width 50 :height 100)
> :owner my-pane)
>
> without success. I've tried with 'my-pane' set to an output-pane and
> interface.
>
> I've put the new manual page for CAPI:DISPLAY-POPUP-MENU below. The
> point is that it needs to be called from a user input gesture.
>
>
> Dave Fox
> Xanalys
> Barrington Hall
> Barrington
> Cambridge
> CB2 5RG
> England
>
> Email: davef@xanalys.com
> Tel: +44 1223 873879
> Fax: +44 1223 874378
> These opinions are not necessarily those of Xanalys.
>
>
> ----------------------------------------------------------------------
> display-popup-menu Function
>
> Summary
> Displays a popup menu.
>
> Signature
> display-popup-menu menu &key owner x y button => result
>
> Arguments
> menu A menu.
> owner A pane.
> x The horizontal coordinate of menu's position relative to owner.
> y The vertical coordinate of menu's position relative to owner.
> button The mouse button that raises the menu.
>
> Description
> The function display-popup-menu displays the menu menu at position
> x,y. display-popup-menu should be used in response to the user
> clicking a mouse button, and is typically used to implement
> right-button menus.
>
> The user may select an item in the menu, in which case the item's
> selection-callback is invoked, and display-popup-menu returns t.
>
> Alternatively the user may cancel the menu, by clicking elsewhere or
> pressing the Escape key. In this case, display-popup-menu returns nil.
>
> owner specifies the owner of the menu, that is, a pane that the menu
> is associated with. If owner is not supplied the system trys to find
> the appropriate owner, which usually suffices.
>
> x and y default to the horizontal and vertical coordinates, relative
> to owner, of the location of the mouse pointer. button defaults to
> :button-3.
>
> Example
>
> (defun popup-test-menu (pinboard x y &optional gspec)
> (capi:display-popup-menu
> (make-instance 'capi:menu :items '(1 2 3))
> :owner pinboard :x x :y y))
>
> (capi:contain
> (make-instance 'capi:pinboard-layout
> :input-model
> '((:post-menu popup-test-menu))
> :visible-min-width 100
> :visible-min-height 100))
>
> See also
> menu
> pinboard-layout
>
--
Greg DuPertuis
President & CEO
The Adrenaline Group, Inc.
~ Innovation at the Edge ~
http://www.adrenaline.com
greg@adrenaline.com