[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: selecting a pop-up menu item



>I've got a quick pop-up-menu question (the doc are very sparse).
>I've defined a pop-up-menu with several items, but I need to change the 
>selection under program control (instead of having the user click on it).
>
>Using the function (menu-select my-pop-up n) with n being some integer,
>does not seem to change the menu item as it is displayed.
>
>As an example, using the pop-up-menu.lisp file, example  I would 
>like to have:
>
>[Code elided]
>;;; What I want is to be able to use
>
>(menu-select my-pop-up 2)
>(menu-select my-pop-up 1)
>
>;; to change the menu that is displayed

What you need to say is:

(setf (pop-up-menu-default-item my-pop-up) 2)
(invalidate-view my-pop-up)

or

(setf (pop-up-menu-default-item my-pop-up) 1)
(view-focus-and-draw-contents my-pop-up)

Whether you use invalidate-view or view-focus-and-draw-contents depends
on whether you want the drawing to happen right now
(view-focus-and-draw-contents) or the next time event processing happens
(invalidate-view).