Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]

Menu and dropdown widgets
Started by StarCrunch Jan 04 2018 04:37 PM

- - - - -
1 reply to this topic
widget user interface menu dropdown
This topic has been archived. This means that you cannot reply to this topic.
[TOPIC: post.html]


[GLOBAL: userInfoPane.html]
  • Contributor

  • 842 posts
  • Corona SDK



I'm not sure if there are others of this sort of thing posted earlier, but in any case during the last week and a half or so I put together a menu-style widget and at this point it feels fairly stable. So I've attached a couple examples using it.


A "menu" would be like what you might see up top in a desktop application, where you can click on a heading and it will often unfurl into sub-entries, which you can then drag over, in addition to dropping down neighboring columns by moving among them. This is demonstrated in the menu sample.


The dropdown sample is demonstrates a different flavor of menu, a single-column one where the choice becomes the new heading; combo box is probably a more appropriate name, though I don't have text editing (yet?). It also shows how images can be included, as well as IDs.


Some of these latter features can also be used in normal menus, though they need to be explicit. There are actually quite a lot of options (so far no theming), but at the moment the code's the documentation.


Because of the dropdown this can throw off measurements of the widget, e.g. for layout or framing the widget. Because of this you can temporarily stash the dropdown part or inject it into another group entirely. You can still throw off the width with wide text and / or images... maybe I should use containers to curtail that.


Scrolling is probably feasible but not implemented.


This is fairly close to what I want, though there are a few places where the code hasn't caught up to the most recent changes. There are some things in there with dynamic sheets and shaders that isn't totally consistent (it arose out of my using this to show a dropdown of tiles but allowing the tileset to be switched out), but they're probably not what most will need anyhow.


Anyhow, there it is, in case it's useful to anybody.


EDIT: Hmm, botched the attach, so link.


P.S. This came out of code using a framework, so some of that I cherry-picked into the menu module and another two modules (layout and meta) I just included along with it.

[TOPIC: post.html]


[GLOBAL: userInfoPane.html]
  • Corona Geek

  • 7,617 posts
  • Corona SDK

Nice. I can see using this! Thanks for sharing.