Behaviour of WPopupMenu/WPopupWidget
Added by Cameron Angus about 10 years ago
I presume the following is largely due to design decision and implementation difficulty, but anyway...
WPopupMenu does not behave in a way I (or I think most people) would expect of such a widget. It appears to have been implemented as a 'popup' only with the context of the browser pane. It cannot display outside this pane, nor does it get closed when switching browser tabs, or clicking on another application.
If this is indeed a limitation which there is no way around, I can live with it, though it's far from ideal. However there is another issue.
It appears that the menu is cancelled only after some other control within the pane receives a mouse-down - mouse-up sequence. This causes a couple of issues:
- If I click and hold in, for example, a text edit, focus immediately moves to the edit and I can drag select text, with the popup menu remaining visible until the button is released.
- Further, if I click and hold in a control, then drag the cursor outside of the control before releasing the button, the popup menu does not cancel at all. I can, for instance, set focus to and alter the value of a spin box, without cancelling the popup. This seems highly bizarre to me.
One last minor point - I think it would be better if the menu disappeared immediately on an item being selected, rather than waiting until after any triggered slots have completed executing server side.
Any thoughts?
Cameron.
Replies (1)
RE: Behaviour of WPopupMenu/WPopupWidget - Added by Koen Deforche about 10 years ago
Hey,
Real (top-level) popup windows indeed cannot be implemented because of popup-blockers and other unwanted side-effects.
The cancelling of the popup relies on the reception of a click event on the application 'root'. The issue you are seeing is that some widgets that implement event handling but also cancel these events (which is typical for drag related things) will interfere with this.
As to the last point, I agree --- I've implemented this now.
Regards,
koen