[Pharo-project] How to get item under a menu?
How can I get the item under a menu? TestRunner is built with the ToolBuilder. The lists are specified with the pluggableListSpec and I can provide a selector that builds the menu. When building the menu I can add selector for the menu entries. As it seems, the item unter the menu is never known to me. Neither when building the menu nor when performing a menu item action. So what I did is the following (an obvious hack) buildMenu: aMenu | morph index | morph := thisContext sender receiver; index := morph rowAtLocation: Sensor currentPoint. itemUnderMenu := list at: index ifAbsent: nil. itemUnderMenu ifNil: [ ^ aMenu ]. ^ aMenu title: itemUnderMenu; add: 'action' action: #action; yourself action self performActionWith: itemUnderMenu Can I get this done without a thisContext hack? --AA
participants (1)
-
Adrian Kuhn