Few Questions.

Discussion in 'Jiggy Runtime Development' started by Omer, Jun 18, 2008.

  1. Omer

    Omer New Member

    Joined:
    Oct 14, 2007
    Messages:
    175
    Likes Received:
    0
    Device:
    iPhone 3GS (Black)
    First of all how do i make the background white

    Please Register or Log in to view images

    it's 1,1,1,1 right?

    And second of all. i wanna make a chart. Well. a menu, that when you click each item, it opens up a link.
  2. Omer

    Omer New Member

    Joined:
    Oct 14, 2007
    Messages:
    175
    Likes Received:
    0
    Device:
    iPhone 3GS (Black)
    anyone?
  3. AngelSynth

    AngelSynth Banned

    Joined:
    Apr 26, 2008
    Messages:
    2,599
    Likes Received:
    10
    you simply make a white background in whatever program you prefer, then use it in Summerboard, and what do you mean by a "chart" you mean on your springboard?
  4. Omer

    Omer New Member

    Joined:
    Oct 14, 2007
    Messages:
    175
    Likes Received:
    0
    Device:
    iPhone 3GS (Black)
    You know This is jiggy. im talking about making a chart. where every diffrent row links to a diffrent URL. I just don't know how to make it so that There's rows that have editable options
  5. carboycam

    carboycam New Member

    Joined:
    Feb 20, 2008
    Messages:
    43
    Likes Received:
    0
    Yes, white backgrounds are 1,1,1,1. (R,G,B,A).

    As for the table, use this example. And I'm guessing you meant Website links so use:
    Code:
    cell.onTap = function()
    {
    openURL( "http://www.google.com/" );
    }
    For example:
    Code:
    cell = new UIPreferencesControlTableCell();
    cell.title = "Visit Google!";
    cell.setEnabled( true );
    cell.showSelection = false;
    
    cells[0].push( cell );
    cell.onTap = function()
    {
    openURL( "http://www.google.com/" );
    }
    I hope this helps, and good luck with your Application.

    Please Register or Log in to view images



    There may be errors in that code, if there are, let me know and I'll try and fix them.

    Please Register or Log in to view images

  6. Omer

    Omer New Member

    Joined:
    Oct 14, 2007
    Messages:
    175
    Likes Received:
    0
    Device:
    iPhone 3GS (Black)
    So in the cell[0] i would replace with 1 . 2 . 3 etc?
  7. Omer

    Omer New Member

    Joined:
    Oct 14, 2007
    Messages:
    175
    Likes Received:
    0
    Device:
    iPhone 3GS (Black)
    Do you mind giving me this with the whole table code. mine doesn't work O_O
  8. carboycam

    carboycam New Member

    Joined:
    Feb 20, 2008
    Messages:
    43
    Likes Received:
    0
    Just have a look at this:
    Code:
    Plugins.load( "UIKit" );
    
    var window = new UIWindow( UIHardware.fullScreenApplicationContentRect );
    
    window.setHidden( false );
    window.orderFront();
    window.makeKey();
    window.backgroundColor=[1 , 1 , 1 , 1];
     
    var mainView = new UIView( window.bounds );
    
    window.setContentView( mainView );
    
    // THIS IS THE HARD WAY
    
    // Create the preferences table
    
    var ptable = new UIPreferencesTable( mainView.bounds );
    
    // Return the number of groups that will be in the table
    
    ptable.onGetNumberOfGroups = function( tbl )
    {
      return 3;
    }
    
    // Return the number of rows in each group
    
    ptable.onGetNumberOfRowsInGroup = function( tbl , group )
    {
      switch( group )
      {
        case 0 : return 3;
        case 1 : return 3;
        case 2 : return 1;
      }
    }
    
    // Tell the table that the third group is a label group
    
    ptable.onIsLabelGroup = function( tbl , group )
    {
      switch( group )
      {
        case 0 : return false;
        case 1 : return false;
        case 2 : return true;
      }
    }
    
    // Now, create the title cells - we only need 2 because the third
    // group is a label
    
    var titleCells = [];
    
    var titleCell;
    
    titleCell = new UIPreferencesTableCell();
    titleCell.title = "General Settings";
    
    titleCells.push( titleCell );
    
    titleCell = new UIPreferencesTableCell();
    titleCell.title = "Advanced Settings";
    
    titleCells.push( titleCell );
    
    titleCell = new UIPreferencesTableCell();
    titleCell.title = "This is something else";
    titleCells.push( titleCell );
    
    // Add the event handler to return the title cells
    
    ptable.onGetCellForGroup = function( tbl , group )
    {
      if ( group >= 0 && group < titleCells.length )
        return titleCells[ group ];
      else
        return null;
    };
    
    // Return row heights
    
    ptable.onGetHeightForRow = function( tbl , group , row , proposedHeight )
    {
      if ( row == -1 )
      {
        // This is the height for title groups
    
        return 40;
      }
    
      if ( group == 0 && row == 2 )
      {
        // We'll make this one taller
    
        return 55;
      }
    
      // Otherwise, we return the height it wants
    
      return proposedHeight;
    };
    
    // Now we have to create the real cells
    
    // We create an array of groups - and each group
    // is an array of cells.
    
    var cells = [ [] , [] , [] ];
    
    var cell;
    var control;
    
    // group 0 , cell 0
    
    cell = new UIPreferencesControlTableCell();
    cell.title = "Music volume";
    cell.setEnabled( true );
    cell.showSelection = false;
    
    control = new UISliderControl( [ 170 , 5 , 120 , 40 ] );
    control.setMinValue( 0 );
    control.setMaxValue( 10 );
    control.setValue( 3.5 );
    
    cell.control = control;
    
    cells[0].push( cell );
    
    // group 0 , cell 1
    
    cell = new UIPreferencesTextTableCell();
    cell.title = "Cheat Code";
    cell.value = "None";
    
    // This also makes it editable
    cell.setEnabled( true );
    
    cell.showSelection = false;
    
    // We can alter the attributes of the text field,
    // because it is a UITextField
    
    var textField = cell.textField;
    
    textField.paddingLeft = 100;
    textField.textColor = [ 1 , 0 , 0 , 1 ];
    
    // This is an editable text cell, so we want to
    // hide the keyboard when the user presses return
    
    cell.onReturn = function( cl ) { ptable.setKeyboardVisible( false ); };
    
    cells[0].push( cell );
    
    // group 0 , cell 2
    
    cell = new UIPreferencesControlTableCell();
    cell.title = "Difficulty";
    cell.showSelection = false;
    cell.showDisclosure = true;
    //cell.setDisclosureStyle( 1 );
    //cell.setUsesBlueDisclosureCircle( true );
    cell.setEnabled( true );
    
    
    control = new UISegmentedControl( [ 110 , 5 , 190 , 44 ] , 0 );
    control.insertTitleSegment( 0 , "Easy" , false );
    control.insertTitleSegment( 1 , "Medium" , false );
    control.insertTitleSegment( 2 , "Hard" , false );
    
    control.setWidth( 1 , 85 );
    
    // UISegmentedControl is not really a subclass of UIControl, 
    // so it cannot be added by setting cell.control.
    // But a cell is a view, so you can add anything as a subview.
    
    cell.addSubview( control );
    
    cells[0].push( cell );
    
    // group 1 , cell 0
    
    cell = new UIPreferencesControlTableCell();
    cell.title = "Extra bad guys";
    cell.showSelection = false;
    
    control = new UISwitchControl( [ 170 , 5 , 120 , 30 ] );
    control.on = false;
    
    cell.control = control;
    
    cells[1].push( cell );
    
    // group 1 , cell 1
    
    cell = new UIPreferencesControlTableCell();
    cell.title = "Debugging";
    cell.showSelection = false;
    
    control = new UISwitchControl( [ 170 , 5 , 120 , 30 ] );
    control.on = true;
    control.setAlternateColors( true );
    
    cell.control = control;
    
    cells[ 1 ].push( cell );
    
    // group 1 , cell 2
    
    cell = new UIPreferencesTextTableCell();
    cell.title = "Version";
    cell.setEnabled( false );
    cell.value = JiggyVersion;
    cell.showSelection = false;
    
    cells[ 1 ].push( cell );
    
    // group 2 , cell 0
    
    cell = new UIPreferencesTableCell();
    cell.title = "Settings will take effect on the next restart";
    
    cells[ 2 ].push( cell );
    
    // Attach the event handler to dole out the cells
    
    ptable.onGetCell = 
      function( tbl , group , row )
      {
        return cells[ group ][ row ];
      };
    
    // And LOAD the table!
    
    ptable.reloadData();
    
    mainView.addSubview( ptable );
    You should be able to understand what everything means if you run the unedited code first to see what it does. Then edit the code bit by bit.
  9. Omer

    Omer New Member

    Joined:
    Oct 14, 2007
    Messages:
    175
    Likes Received:
    0
    Device:
    iPhone 3GS (Black)
    carbo, Got any IM Thing?
  10. carboycam

    carboycam New Member

    Joined:
    Feb 20, 2008
    Messages:
    43
    Likes Received:
    0
    MSN Messenger. That's it...

Share This Page