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.
Asked
Active
Viewed 65 times
1
-
Can you share more details or a screenshot? – Humayun Shabbir Aug 12 '16 at 18:30
1 Answers
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.

Maurizio Ferreira
- 476
- 2
- 14