I have a multi-zone conveyor displayed on my perspective view where a user can click to bring up a popup giving them control over that conveyor as a whole. Alternatively, they can right-click to show a context menu which allows them to select whether they want to bring up the popup for that whole conveyor, or a detail popup on the individual zone that was clicked. The context menu is working but there's a couple of fine detail things I can't seem to get working exactly how I want.
How it works so far:
- The conveyor is a flex repeater with multiple instances of "zones"
- Each zone has an
onContextMenu
script which calls a popup. Into the popup I pass an array of strings, representing the options that I want on shown on the context menu, as well as an "identifier" parameter so that I know which zone triggered the popup - The popup contains a flex repeater, showing multiple instances of a label (populated by the array of strings from #2)
- The labels embedded in the flex repeater send a message called contextMenuClick, with a payload consisting of the context menu item that was clicked, and the identifier
- Each zone listens for the contextMenuClick message, and when it is received, compares the payload against it's own identifier to see if it needs to trigger a popup. If so, it checks the payload to determine which popup to show
What doesn't work:
-
I want the context menu to look like a regular context menu in that when I hover the mouse over an item it should be highlighted. To achieve this I've added
onMouseOver
andonMouseOut
scripts to the root container of the label view that's embedded in the flex repeater, which changes the style class of the label. It kind of works but it's not reliable - sometimes it doesn't highlight, sometimes it does but then un-highlights well before the cursor moves down to the next option. How can I fine tune this? -
Clicking on an option in the context menu also calls
system.perspective.closePopup()
so that the context menu disappears when you click on it, just like a regular context menu. However, I'd also like the popup to close if the user clicks anywhere else on the screen, again, like a regular context menu. I can do this by making the popup modal and settingoverlayDismiss
toTrue
, but making the popup modal is a bit of a hack and isn't a great user experience. Is there a way to get the popup to be background dismissible without it having to be modal?