I need a good 'Jiggier' for some help

Discussion in 'Jiggy Runtime Development' started by Ryan, May 16, 2008.

  1. Ryan

    Ryan Well-Known Member

    Joined:
    Jan 19, 2008
    Messages:
    4,129
    Likes Received:
    28
    Device:
    Nexus 4
    closed please look at my new thread
  2. The Ax

    The Ax Banned

    Joined:
    Mar 11, 2008
    Messages:
    647
    Likes Received:
    22
    also would like to know this,
    Maybe something like
    Plugins.load("FileManager");
    Filemanager.move("/apps/yaysad.txt" , hello.text )


    or hello.text = {include("APPS/YAYGHDF");}

    IDK my best guesses
  3. Ryan

    Ryan Well-Known Member

    Joined:
    Jan 19, 2008
    Messages:
    4,129
    Likes Received:
    28
    Device:
    Nexus 4
    EDIT: Its ok i fixed my original problem, still need help with what it says in the first post though.
  4. Ryan

    Ryan Well-Known Member

    Joined:
    Jan 19, 2008
    Messages:
    4,129
    Likes Received:
    28
    Device:
    Nexus 4
    updated to new problem
  5. jakecigar

    jakecigar New Member

    Joined:
    Mar 7, 2008
    Messages:
    83
    Likes Received:
    6
    Device:
    iPhone 4 (Black)
  6. jakecigar

    jakecigar New Member

    Joined:
    Mar 7, 2008
    Messages:
    83
    Likes Received:
    6
    Device:
    iPhone 4 (Black)
    funny!
  7. PAEz

    PAEz New Member

    Joined:
    Jan 29, 2008
    Messages:
    201
    Likes Received:
    10
    Here's a quick hack of the section list example that will show you the files (not directories) in your apps directory...
    Code:
    Plugins.load( "UIKit" );
    Plugins.load( "FileManager" );
    
    // This function will help us build the list of section titles
    // as well as the first row of each section - which we need to
    // give to the section list later.
    
    var sectionTitles = [];
    
    var sectionRows = [];
    
    ////This bit will get a directorys contents and put them in dir
    ////and then it puts the entries that are files into states (couldnt be stuffed changing the name;)    
        var states = new Array();
        var i2=0;
        var dir = FileManager.directoryContents(Bundle.bundlePath);
        for (i2 = 0; i2 < dir.length; i2++) {
         if(dir[i2]["type"]="f")states.push(dir[i2]["path"]);
    states.sort();           }
    for( var i = 0; i < states.length; i++ )
    {
      var firstLetter = states[ i ].charAt( 0 );
      
      var sectionStart = false;
      
      if ( sectionTitles.length == 0 )
        sectionStart = true;
      else 
        sectionStart = firstLetter != sectionTitles[ sectionTitles.length - 1 ];
    
      if ( sectionStart )
      {    
        sectionTitles.push( firstLetter );
        sectionRows.push( i );
      }    
    }
     
    // On to the standard set-up 
    
    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 );
    
    // Create a UISectionList
    
    var sl = new UISectionList( mainView.bounds );
    
    mainView.addSubview( sl );
    
    // Get the table from the section list so we can prepare it
    
    var table = sl.table;
    
    // Formality - we need to add a table column
    
    table.addTableColumn( new UITableColumn( "foo" , "bar" , sl.bounds[ 2 ] ) );
    
    // Customize the look a little bit
    
    table.separatorStyle = 1;
    
    table.rowHeight = 48;
    
    // Now, let's create the cells
    
    var cells = [];
    
    for( var i = 0; i < states.length; i++ )
    {
      var cell = new UIImageAndTextTableCell();
      cell.title = states[ i ];
      
      cells.push( cell );
    }
    
    // Attach all the event handlers
    
    sl.onGetNumberOfSections =  function( l ) { return sectionTitles.length; };
    
    sl.onGetSectionTitle = function( l , section ) { return sectionTitles[ section ]; };
    
    // This should return the first row for the given section - we prepared them
    // above.
    
    sl.onGetSectionRow = function( l , section ) { return sectionRows[ section ]; };
    
    sl.onGetNumberOfRows = function( l ) { return cells.length; };
    
    sl.onGetCell = function( l , column , row ) { return cells[ row ]; };
    
    sl.onRowSelected = function( l , row ) {
     log( "SELECTED:" + states[row] );
    
    
    };
    
    // Now tell the section list to load the data
    
    sl.reloadData();
    
    // We could turn off the index this way:
    sl.setIndexVisible( true );
    
    // This makes the section titles black and the current section 
    // title transparent.
    sl.setSectionListStyle( 1 );
    1 person likes this.
  8. Ryan

    Ryan Well-Known Member

    Joined:
    Jan 19, 2008
    Messages:
    4,129
    Likes Received:
    28
    Device:
    Nexus 4
    ok Thais that's a good start but do you know how I can get it to look at a folder within my app folder?
  9. jakecigar

    jakecigar New Member

    Joined:
    Mar 7, 2008
    Messages:
    83
    Likes Received:
    6
    Device:
    iPhone 4 (Black)
    var dir = FileManager.directoryContents(Bundle.bundlePath);

    gives you all files in your app

    var dir = FileManager.directoryContents(Bundle.bundlePath + '/somedir')

    should give you all files in your app's directory somedir.
    1 person likes this.
  10. Ryan

    Ryan Well-Known Member

    Joined:
    Jan 19, 2008
    Messages:
    4,129
    Likes Received:
    28
    Device:
    Nexus 4
    thanks man, any idea how I would be able to have events happen when clicked?

Share This Page