Need some help with menus

Hi,

I am doing my first steps with menus and can't get it running. As soon as I call:
var randomDrawMenu = new Rez.Menus.RandomDrawMenu();
randomDrawMenu.addItem("Random", random);
Ui.pushView(randomDrawMenu, new RandomDrawMenuDeleagte(), Ui.SLIDE_UP);


I get the failure message:
Symbol not found error in the first line (beginning with 'var').

I have stored a RandomDrawMenu.xml file in the resources/menus folder with following content:
<menu id="RandomDrawMenu">
<menu-item id="item_1">Item 1</menu-item>
</menu>


What am I doing wrong?
  • Try
    randomDrawMenu.addItem("Random", :random);

    You need a symbol and not a var (note the : )
  • Hi Jim,

    thanks for clarifying this. Nevertheless, I still get this:
    Could not find symbol RandomDrawMenu.
    Symbol Not Found Error


    I got the failure message regarding this line:
    var randomDrawMenu = new Rez.Menus.RandomDrawMenu();
  • It might be something with your xml as it deson't seem to know about your menu. Do you have more than one menu defined?

    When I do that I surround them with:

    <menus>

    </menus>

    Seems if you don't, things get confused.... I forget the details though.
  • Got it running now. The title was missing (facepalm). Nevertheless, I personally find this way much more convenient as defining a menu in the Rez module:

    var randomDrawMenu = new Ui.Menu();
    randomDrawMenu.addItem("Random", :random);
    randomDrawMenu.addItem(player1, :player1);
    randomDrawMenu.addItem(player2, :player2);
    randomDrawMenu.setTitle("Who is serving?");

    Ui.pushView(randomDrawMenu, new TischtennisMenuDelegate(), Ui.SLIDE_UP);



    Is there some improvement in this code snippet?

    BTW: by defining upper lines I get this:



    One has to know that the middle item is selected. Is it possible to visualize which item the user has currently selected?
  • Menus look different in the sim than on the device, and then too, they differ by device. For example, you won't see the title on some devices. Some have line seperators, etc..

    I'm looking at a fr230 right now. The selected item is in the middle and is large, and the item before is on the top, the next item on the bottom, in a smaller font, with lines seperating them and no title.
  • Hi Jim,

    thanks for clarifying this. No title? You are joking. How can I guide my user through that menu if there is no title? This does not make sense. Do you have a workaround for that? E. g. using an item as title?
  • No work around I know of (unless you want to build your own menu system)... The va-hr also doesn't show the title, and I suspect none of the semi-rounds. The va and edge devices do show a title, and no idea about the fenix devices.