Lisp Knowledgebase

Title: How to program a pop-up menu in a CAPI pinboard-layout

ID: 10046


Product: All
Version: All
OS: All

Description:

I want to be able to right click in a capi:pinboard-layout and have
a pop-up menu appear.  I notice things like capi:listeners and other
panes have this functionality.  How do you do it?



Use: capi:display-popup-menu (menu &key owner x y)

For 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 '(((:button-3 :release)  popup-test-menu))))

Even better, also use :post-menu to make it portable)

(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))))

See Also:
Workaround:
Patch:

Hardware:N/A
Summary:
Bug#:
Patch Enhancement#:
Reported:LSC #6389

Company     Contact     Privacy Policy     Terms of Use