Widgetry MenuItem Action

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Widgetry MenuItem Action

Runar Jordahl
Throughout the history of Pollock I have always struggled getting
popup-menus raised in my application. With 8.4.0 my old hack getting
this to work does no longer work.

Below is a snippet showing what I want to do. Basically I want to
programmatically create and open a menu. In the snippet, object
"receiver" should be sent the message #halt. As you can see I have
added an actionID, but obviously this is not enough. Maybe the use of
actionID is not needed as far as I know.

receiver := Object new.
menu := (Panda.Menu new addMenuItem: (Panda.MenuItem new
        label: 'Do halt on receiver object';
        actionID: #doHalt)).
menu open

Does anyone know how to do this simple thing?

Reply | Threaded
Open this post in threaded view
|

Re: Widgetry MenuItem Action

Samuel S. Shuster <sames@interaccess.com>
Runar,

>menu := (Panda.Menu new addMenuItem: (Panda.MenuItem new
> label: 'Do halt on receiver object';
> actionID: #doHalt)).
>menu open

The new menu open methods answer the selected menu item when a menu item is
selected. They also announce the selected menu item. In terms of anonymous
popups (which is what these are considered), the do not attach themselves to a
pane, and thus do no action lookup.

With this new API, it is up to you to either attach an announcement to the menu
items, or react to the answered menu item when it returns from the open.

                                And So It Goes
                                     Sames
______________________________________________________________________

Samuel S. Shuster [|]
VisualWorks Engineering, GUI Project
Smalltalk Enables Success -- What Are YOU Using?