UIButtonBar Navigates, please help me

Discussion in 'Jiggy Runtime Development' started by Mithumann, Jul 2, 2008.

  1. Mithumann

    Mithumann New Member

    Joined:
    Jul 2, 2008
    Messages:
    7
    Likes Received:
    0
    I have a problem... When I click on the submenu's buttons. The button changes well but the page (center ofcourse) wont change?! Whats wrong:

    --- NOTE --- This is only the code of the UIButtonBar. The rest is fine, here is a problem? I dont know what!---

    var buttons =
    [
    {
    UIButtonBarButtonTag: 1,
    UIButtonBarButtonTitle: "Main",
    UIButtonBarButtonInfo: "Featured.png",
    UIButtonBarButtonSelectedInfo: "Featured_Sel.png",
    UIButtonBarButtonType: 0



    },


    {
    UIButtonBarButtonTag: 2,
    UIButtonBarButtonTitle: "New",
    UIButtonBarButtonInfo: "New.png",
    UIButtonBarButtonSelectedInfo: "New_Sel.png",
    UIButtonBarButtonType: 0


    },


    {
    UIButtonBarButtonTag: 3,
    UIButtonBarButtonTitle: "Popular",
    UIButtonBarButtonInfo: "Popular.png",
    UIButtonBarButtonSelectedInfo: "Popular_Sel.png",
    UIButtonBarButtonType: 0


    },


    {
    UIButtonBarButtonTag: 4,
    UIButtonBarButtonTitle: "All",
    UIButtonBarButtonInfo: "All.png",
    UIButtonBarButtonSelectedInfo: "All_Sel.png",
    UIButtonBarButtonType: 0


    },


    {
    UIButtonBarButtonTag: 5,
    UIButtonBarButtonTitle: "Web",
    UIButtonBarButtonInfo: "Web.png",
    UIButtonBarButtonSelectedInfo: "Web_Sel.png",
    UIButtonBarButtonType: 0


    },


    {
    UIButtonBarButtonTag: 6,
    UIButtonBarButtonTitle: "Coding",
    UIButtonBarButtonInfo: "Coding.png",
    UIButtonBarButtonSelectedInfo: "Coding_Sel.png",
    UIButtonBarButtonType: 0


    },


    {
    UIButtonBarButtonTag: 7,
    UIButtonBarButtonTitle: "Request",
    UIButtonBarButtonInfo: "Request.png",
    UIButtonBarButtonSelectedInfo: "Request_Sel.png",
    UIButtonBarButtonType: 0


    },


    ];

    // The button bar is created a bit differently - you pass in its
    // superview, its frame and the button definition.
    // You do not need to do mainView.addSubview( bb )


    var bb = new UIButtonBar( mainView , [ -10 , 420 , 330 , 40 ] ,
    buttons );


    // Style 1 is the cool black one used in the iPod app. 0 is blue -
    like a
    // navigation bar and 2 is gray.


    bb.barStyle = 1;


    // Now, you register a group of buttons - you give it a group number
    // and an array of button tags. This lets you show entire groups
    easily


    bb.registerButtonGroup( 1 , [ 1 , 2 , 3 , 4 , 5 , 6 , 7 ] );


    // Show that group. The second parameter is a duration for a fading
    the
    // group in.


    bb.showButtonGroup( 1 , 1.0 );


    // This selects a button


    bb.showSelectionForButton( 1 );


    // This adds a "badge" to the button ( a red circle with the string
    you pass in)


    bb.setBadgeValue( null , null );


    // This animates the badge - it blinks


    bb.setBadgeAnimated( null , null );


    // The event when a button is pressed


    bb.onButtonPressed = function( bar , button )
    {
    // We select the button that was pressed


    bb.showSelectionForButton( button );


    log( "PRESSED BUTTON:" + button );


    log( "SELECTED BUTTON:" + bb.selectedButton );


    /*
    // This automatically brings up a customize sheet that
    // the user can use to re-arrange and add buttons.


    if ( button == 3 )
    bb.customize( [ 1 , 2 , 3 ] );
    */


    // This gives you an array of the currently visible buttons


    log( "VISIBLE BUTTONS:" + bb.getVisibleButtonTags().toSource() );


    // This is how you can remove the badge


    if ( button == 3 )
    bb.setBadgeValue( 3 , null );
    else
    bb.setBadgeValue( 3 , "25" );






    ---END CODE--- Please someone help me, I am desperate!
  2. hockeypanda32

    hockeypanda32 Well-Known Member

    Joined:
    Dec 18, 2007
    Messages:
    2,183
    Likes Received:
    89
    Device:
    iPhone 4 (Black)
    You dont even have the button linking code in there... Or I do not see it.
  3. godogshomie

    godogshomie New Member

    Joined:
    Nov 19, 2007
    Messages:
    558
    Likes Received:
    3
    nope you sure dont add this before you recall the bar

    Code:
    if (button==0){
    include"page1.js";
    }
    if (button==1){
    include"page2.js";
    etc.
    
  4. Mithumann

    Mithumann New Member

    Joined:
    Jul 2, 2008
    Messages:
    7
    Likes Received:
    0
    Thanks

    I knew there was some cient of script that should make them navigate.

    Thankyou

    Please Register or Log in to view images

    I ll give u +rep if possible xD

    Works fine now!

Share This Page