Klipfolio Dashboard API

Object Tab

Object
   |
   +--Tab

The Tab object provides an API to add, remove, and access UI components in the Klip's Customize window. You can add/remove Tab objects using the Setup.addTab() and Setup.removeTab() functions.

The common approach is to use Setup.addTab in the onLoad() handler function to create a new Tab object and assign UI components to it.

 var tab = Setup.addTab( "New Tab" );
 
You can then use the tab object to add new UI components, as shown in the Klip below.
<klip>
   <identity>
      <title>
         API: Tab
      </title>
   </identity>
   <locations>
      <contentsource>
         http://support.klipfolio.com/files/demo/demo.xml
      </contentsource>
      <icon>
         http://www.klipfolio.com/static/klips/klipfolio/sample_icon.png
      </icon>
      <banner>
         http://www.klipfolio.com/static/klips/klipfolio/sample_banner.png   
      </banner>
   </locations>
   <style>
      alert {
         type: item;
      }

      sender {
         itemcol: 2;
         noterow: 1;

         label: 'Sender';

         emphasis: strong;
      }


      summary {
         itemcol: 3;
         noterow: 4;

         wrap: false;

         notelabel: false;
      }

      date {
         itemcol: 4;
         noterow: 2;

         label: 'Date';
      }

      category {
         noterow: 3;

         label: 'Category';
      }


      level {
         itemcol: 1;
         noterow: 5;
         notelabel: false;
         
         type: image;
      }

      url {
         type: link;
      }
            
      id {
         key: override;
      }
   </style>
   <klipscript>
   <![CDATA[

var button;

function onLoad() {

    // Create a new tab
    var tab = Setup.addTab( "New Tab" );

    //
    // tab is a Tab object that points to the first tab
    //
    
    tab.addText( "Welcome to Klipfolio Dashboard.");
    tab.addSpacer( true );				// we reference this with Setup[0][1]
    tab.addText( "Klipfolio Dashboard, the desktop dashboard for business.");
    tab.addSpacer( false );
    button = tab.addButton( "Klipfolio Inc." );
    button.url = "http://www.klipfolio.com/";
    
    trace( "URL for button: " + button.url + "\r\n" );

	// You can reference individual tab by using Setup[] as an array.
	// For example, Setup[0] is first tab and Setup[0][0] is UI component 
	// in the first tab.

    // trace( "What is the URL: " + Setup[0][4].url + "\r\n" );
}

function onRefresh()
{
	return Engines.Data.process( Prefs.contentsource );
}
  
   ]]>
   </klipscript>
</klip>

     	
Upon loading, Klipfolio Dashboard will display the following output to the Debug Window.

 URL for button: http://www.klipfolio.com/
 



Properties Summary
 integer length
          Returns the number of UI components contained in this Tab (read-only).
 String name
          Specifies name of this Tab as displayed in the user interface.
   
Function Summary
 Button addButton( <String> label )
           Adds a Button component with the specified label this tab.
 Checkbox addCheckbox( <String> label )
           Adds a Checkbox component with the specified label this tab.
 ComboBox addComboBox( [<String> item1] [, <String> item2] [, etc ...] )
           Adds a ComboBox component with the specified items to this tab.
 ListControl addListControl( [<boolean> checked [, <boolean> multiselect [, <String> item1 [, <String> item2 [, etc ...]]]]] )
           Adds a ListControl component to this tab.
 Spacer addSpacer( [<boolean> line] )
           Adds a Spacer component with the option of making it visible as a horizontal line.
 Text addText( <String> label )
           Adds a Text component with the specified label this tab.
 TextArea addTextArea( [<String> text] )
           Adds a TextArea component with the optional default text to this tab.
 TextField addTextField( <String> text [, <boolean> obscured] )
           Adds a TextField component with default text to this tab.
 boolean remove( <integer> index | <object> object )
           Removes an existing component from the Tab.

Properties Detail

length

integer length

name

String name

Function Detail

addButton

Button addButton( <String> label )

addCheckbox

Checkbox addCheckbox( <String> label )

addComboBox

ComboBox addComboBox( [<String> item1] [, <String> item2] [, etc ...] )

addListControl

ListControl addListControl( [<boolean> checked [, <boolean> multiselect [, <String> item1 [, <String> item2 [, etc ...]]]]] )

addSpacer

Spacer addSpacer( [<boolean> line] )

addText

Text addText( <String> label )

addTextArea

TextArea addTextArea( [<String> text] )

addTextField

TextField addTextField( <String> text [, <boolean> obscured] )

remove

boolean remove( <integer> index | <object> object )

Klipfolio Dashboard API

© 2011 Klipfolio Inc. All Rights Reserved.