make a dropdown object to stand in for [tof/pmenu]
Since we're not shipping
[tof/pmenu], we need some kind of GUI object that acts as a dropdown menu.
The problem with using a native html dropdown is the following:
- it's difficult to sync with Pd's widget behavior. A user might want to click-drag it in editmode, but the HTML5 menu will want to pop up the options on a click. One could disable the button in editmode, but then
<ctrl-click>becomes a problem, etc.
- html5 inputs either have to be put on top of the patch's svg (in which case bring to front/send to back won't work), or included inside the svg as a foreignObject. The foreignObject part of the svg spec isn't particularly detailed and probably doesn't work consistently across browsers (or even browser versions...)
<select>sizes the button widget to fit the containing text. That's obviously the right behavior, but it conflicts with Pd's absolute positioning system. Users won't be able to know how wide the widget will be on other people's systems and collisions are therefore likely to occur.
One solution would be to add a t_text behavior for a dropdown box. It could be drawn to look like an atom box (or maybe slightly different border), but a click would bring up the options. To display it, we could use a
<select> object with the button's visibility set to 'hidden'. Then when we get a click we invoke the click method to bring up the options list. That way we leverage the browser's ability to place the options properly (handling the literal corner cases correctly), and get Pd's text sizing/positioning for the button.