Problem with my code...

Discussion in 'Jiggy Runtime Development' started by coolcosmos, May 6, 2008.

  1. coolcosmos

    coolcosmos New Member

    Joined:
    Sep 27, 2007
    Messages:
    389
    Likes Received:
    4
    Device:
    iPod touch
    Ok, my code worked yesterday, but now, it doesn't. I've changed some things, and now it doesn't work. No problem, i just redo it with my backup, but now, the UIbuttonbar (LINK)
    doesn't work. When i add it, i can't click my button on the top, and it doesn't show up. When i paste it in my code, it doesn't work. The UIbuttonbar start at the line 71. 000 = Things that i don't you to see

    Please Register or Log in to view images

    .

    Here's my code :

    Code:
    var window = new UIWindow( UIHardware.fullScreenApplicationContentRect );
    window.setHidden( false );
    window.orderFront();
    window.makeKey();
    window.backgroundColor = [ 1 , 1 , 1 , 1 ];
     
    var mainView = new UIView();
     
    window.setContentView( mainView );
    
    // You have to define all the possible buttons for the bar in an array like this
    
    var buttons = 
    [
        {
            UIButtonBarButtonTag: 1,
            UIButtonBarButtonTitle: "000",
            UIButtonBarButtonInfo: "000.png",
            UIButtonBarButtonSelectedInfo: "000.png",
            UIButtonBarButtonType: 0
        },
    
        {
            UIButtonBarButtonTag: 2,
            UIButtonBarButtonTitle: "000",
            UIButtonBarButtonInfo: "000.png",
            UIButtonBarButtonSelectedInfo: "000.png",
            UIButtonBarButtonType: 0
        },
    
        {
            UIButtonBarButtonTag: 3,
            UIButtonBarButtonTitle: "000",
            UIButtonBarButtonInfo: "000.png",
            UIButtonBarButtonSelectedInfo: "000.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 , [ 0 , 420 , 320 , 60 ] , 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 = 0;
    
    // 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 ] );
    
    // 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( 3 , null );
    
    // This animates the badge - it blinks
    
    bb.setBadgeAnimated( 3 , true );
    
    // 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 , null );
    }
    
    Thank you.
  2. Winterboard

    Winterboard Well-Known Member

    Joined:
    Dec 26, 2007
    Messages:
    2,345
    Likes Received:
    53
    Device:
    iPad 2 (Black)
    nice avatar. I like fish.
  3. C0DeR_4_liFe

    C0DeR_4_liFe New Member

    Joined:
    Mar 3, 2008
    Messages:
    132
    Likes Received:
    10
    Device:
    iPod touch
    000.png... it exists? u cant have the same name for each button!

Share This Page