Do you guys have any plans to support us adding our own menu bar items for apps?
For instance, like the Corona simulator has (see the screenshot)
Thanks
Do you guys have any plans to support us adding our own menu bar items for apps?
For instance, like the Corona simulator has (see the screenshot)
Thanks
It’s an idea that’s been kicked around.
What would you use this for? Games generally implement their own UIs for most things.
Assuming it’s doable, how would you like it to interact with your Lua code?
Hey Perry.
It would be used more for applications. Good example, writing a text editor in Corona.
File open dialogs, save, save as, editor options and so on.
Regarding using it in Lua code…
I would envision having the menus (and submenus) defined in config.lua (or similar),
local config = { menus = { mainMenu = { name = "File", subMenus = { open = { name = "open", action = "fileOpenDialog", } } } } }
Being able to interact with them via Lua like so perhaps.
local mainMenu = window.getMenuCategory("mainMenu") local fileOpenMenu = mainMenu:getMenuItem("open") -- And as for retrieving data from menu clicks and selections.. -- Per menu option listener local function fileOpenListener(event) end fileOpenMenu:addEventListener("menuEvents", fileOpenListener) -- Runtime listener local function menuListener(event) -- event.type == "menuSelection" -- event.data == table of data. Ex: event.data = {action = "openDialog", data = "filePath/handle here"} -- event.phase == "selected" end Runtime:addEventListener("menuEvents", menuListener)
That is just off the top of my head, but I hope it serves to demonstrate the idea
It’s an idea that’s been kicked around.
What would you use this for? Games generally implement their own UIs for most things.
Assuming it’s doable, how would you like it to interact with your Lua code?
Hey Perry.
It would be used more for applications. Good example, writing a text editor in Corona.
File open dialogs, save, save as, editor options and so on.
Regarding using it in Lua code…
I would envision having the menus (and submenus) defined in config.lua (or similar),
local config = { menus = { mainMenu = { name = "File", subMenus = { open = { name = "open", action = "fileOpenDialog", } } } } }
Being able to interact with them via Lua like so perhaps.
local mainMenu = window.getMenuCategory("mainMenu") local fileOpenMenu = mainMenu:getMenuItem("open") -- And as for retrieving data from menu clicks and selections.. -- Per menu option listener local function fileOpenListener(event) end fileOpenMenu:addEventListener("menuEvents", fileOpenListener) -- Runtime listener local function menuListener(event) -- event.type == "menuSelection" -- event.data == table of data. Ex: event.data = {action = "openDialog", data = "filePath/handle here"} -- event.phase == "selected" end Runtime:addEventListener("menuEvents", menuListener)
That is just off the top of my head, but I hope it serves to demonstrate the idea