Dashcode -- How to use a static list as a menu

Discussion in 'Mac Apps and Mac App Store' started by adam8797, Jun 1, 2010.

  1. adam8797 macrumors newbie

    Joined:
    Jun 13, 2009
    #1
    I am writing a iphone website and for a navigation menu i want to use a static list. I have searched EVERYWHERE and cant find anything on the topic. I have attached the outline of the website.

    to recap:

    (1) I want to use a static menu as the navigation menu.
    (2) each entry should link to another view of the stack layout.

    I dont care if its dynamic or static but static seemed like the obvious choice.


    Thanks in advance,
    Adam
     

    Attached Files:

  2. felizago macrumors newbie

    Joined:
    Jul 29, 2010
    #2
    just found a way

    Hello Adam!

    I'm a newcomer to dashcode, and had the same problem just today.
    Well, I did a little hit and miss job through the debug, ended up with the following code:

    Code:
    function showOption(event){
        // Menu points to the static list that comprises the menu.
        var menu  = dashcode.getDataSource("listMenu");  
        // idx points to the current rowIndex (disabled multi selection).
        var idx     = menu.__selectionIndexes[0];
        // The "theOption" object is an array that holds the key/value pair (label/value).
        // Value is set to the name of the layer.
        var theOption = menu.__content[idx][1];
        
        newTransition = new Transition(Transition.NONE, 0.0, Transition.EASE_TIMING);
        //change foreground of the stack according to theOption
        document.getElementById("stackLayout").object.setCurrentViewWithTransition(theOption, newTransition, false);
    }
    
    For the uglyness of this code, I feel its not the correct/best solution, but had not the time to investigate a "valueForKey' approach but, nonetheless, it worked. Set it for the "onClick" method on your listRowTemplate1 object.



    Hope it helps!

    Best regards,

    Zago
     

Share This Page