Updating menu item in menu

Updating menu item in menu
0.0 0



I have two burning questions:

  1. I am currently maintaining a Menu where a price list is stored. How do I go about
    * a) retrieving the correct menu item - i ask this in view of the different types of menu items such as labels, sprites, etc. I am currently using LabelTTF
    * b) updating the figures - what methods to call?
    * c) rendering it - is it a correct practice to render updates to the menu using scheduledupdates()?

  2. I have a 3 column 5 row price list.
    id name property
    x x x
    x x x
    x x x
    x x x
    x x x

I know I would come across silly but what is the proper way to create such a table? I am currently using Menu for each column. Really need some guidance. With the web, all I do is div and floats lol.



Hi, Decki

You can try cc.TableView, it’s located in extensions/GUI/CCScrollView, and it’s a child class of CCScrollView which permit the scroll behavior.
It may be a little bit more complicated than HTML version table but if you are familiar with iOS development, it will be very easy to use also, because we use the same design principles like “data source” and “event delegate”.

a) If you mean retrieve an item by click, in the delegate functions, there is tableCellTouched. It will be invoked when a cell been touched, and the cell itself will be passed as a parameter to this callback function.

b) Update everything can be done by using updateCellAtIndex function of cc.TableView after you have updated the cell’s content.

c) You don’t need to update it manually, when you change something, just update the cell itself and call updateCellAtIndex, otherwise, the system will keep it properly rendered to your scene.

Hope I have made things more clear for you



whoa cool~ didn’t know about tableview. will take a look and try your approach out.

I have managed to make it work by calling getChildByTag with menu item and using setString() to replace the text. Not sure what is the performance impact between such an approach versus that of tableview.

s. on the side, can you help with the messageBox thread pertaining to touch propogation? I am really stuck with touches penetrating though the uppermost layer to layers beneath it. Tried every possible ways incl. manipulating touchpriority (am aware menu is –128), setTouchEnabled (false) and what not.

Again, thanks for the tableview advice