1

In Dolphin Smalltalk I've set a context menu on a treeview, but this menu appears whenever I right click everywere on the tree, even if I click on an empty space. How can I limit the popup to only existing rows of the tree ? Best regards. Maurizio.

1 Answers1

1

Finally I've found it.

For those interested :

In the CreateSchematicWiring method :

treePresenter
    when: #rightButtonPressed:
    send: #onRightButtonPressed:
    to: self

and this is the "onRightButtonPressed" method:

onRightButtonPressed: aMouseEvent
    | treeView item |
    treeView := treePresenter view.
    item := treeView itemFromPoint: aMouseEvent position.
    item
        ifNil: [treeView contextMenu: nil]
        ifNotNil: [:elem | treeView contextMenu: (treeView objectFromHandle: elem) getMenu]

where the getMenu method returns a menu depending on the kind of object on which I've clicked.