creating dynamic menus loaded from json/xml

Questions and information about Crank Software's Storyboard Designer

Moderator: jamiev

creating dynamic menus loaded from json/xml

Postby strangeloop » Fri Jun 12, 2015 8:20 am

I want to create dynamic menus that configured via json/xml. Can anyone point out a sample for doing this?

Here is a brief outline for what i am trying to achieve:

i have my menus configured in json as follows:

Code: Select all
{
           "menu" : {
                 "menuitem" : {
                          "name" : "Menu Item1",
                          "index" : 1
                 }
                  "menuitem" : {
                          "name" : "Menu Item2",
                          "index" : 2
                 }
                .....
          }
}


This should result in a menu like this:
menus.PNG
menus
menus.PNG (4.64 KiB) Viewed 11491 times


Right now, i have created this menu by manually adding the four buttons and I manage the state of each menu item individually each time a menu item is selected. While it is a quick and easy way to implement this, I find it very cumbersome and error-prone to maintain. I would like to see this implemented with dynamic loading and generic event listeners that take the index value as input and change the menu item state accordingly.

The obvious question then is - how do i add the index values to each button and use them as menu_index[index] to access my buttons?
strangeloop
 
Posts: 3
Joined: Fri Jun 12, 2015 7:24 am

Re: creating dynamic menus loaded from json/xml

Postby jdouglas » Fri Jun 12, 2015 9:51 am

Hi,

I suggest you try creating the menu as a table. I have attached a sample project to show how to create the menu as a table from the json data. I hope this helps!

Jill
Attachments
DynamicMenu.zip
(86.52 KiB) Downloaded 696 times
jdouglas
 
Posts: 2
Joined: Fri Jun 12, 2015 9:43 am

Re: creating dynamic menus loaded from json/xml

Postby strangeloop » Fri Jun 12, 2015 10:44 am

Thanks, I will give it a shot.
strangeloop
 
Posts: 3
Joined: Fri Jun 12, 2015 7:24 am

Re: creating dynamic menus loaded from json/xml

Postby strangeloop » Fri Jun 12, 2015 10:55 am

Thanks, this is a really good example.
strangeloop
 
Posts: 3
Joined: Fri Jun 12, 2015 7:24 am


Return to Storyboard Designer

Who is online

Users browsing this forum: No registered users and 2 guests

cron