Klipfolio Dashboard 5 API

Object Setup

Object
   |
   +--Klip
         |
         +--Setup

The Setup object lets you add and remove tabs from the Klip's Customize window, which is visible when a user right-clicks on a Klip and chooses the command 'Customize Klip...'

Use addTab() and removeTab() to add/remove Tab objects, then use the Tab objects to add custom user interface to the Klips Customize window using JavaScript.

Example

The following function creates a new tab called 'Sample UI', then adds some components to the tab.
<klip>
   <identity>
      <title>
         API: Setup
      </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[

function onLoad() {

    var tab = Setup.addTab ("Sample UI");
    tab.addText ("Convert:");
    textField = tab.addTextField( "1" );
    
    comboBox = tab.addComboBox();
    comboBox.addItem( "Canadian Dollar (CAD)" );
    comboBox.addItem( "Euro (EUR)" );
    comboBox.addItem( "U.S. Dollar (USD)" );

    tab.addText( "To the following currencies:" );
    
    listControl = tab.addListControl (true);
    listControl.addItem( "Canadian Dollar (CAD)" );
    listControl.addItem( "Euro (EUR)" );
    listControl.addItem( "U.S. Dollar (USD)" );
    
    checkBox = tab.addCheckbox( "Display full currency names in the Klip" )
} 

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

     	
You can index Setup as an array to access Tab objects you add. The function call Setup.addTab() inserts a new Tab object at Setup[0], which corresponds to the left-most tab in the Klip's Customize window.


Properties Summary
 integer length
          The number of Tab objects contained in the Setup array (read-only).
   
Function Summary
 Tab addTab( <String> name )
           Inserts a Tab object with the specified name and at Setup[0], which corresponds to the left-most tab in the Klip's Customize window.
 function close()
           Closes the Klip's Customize window.
 Tab insertTab( <integer> index, <String> name )
           Inserts a Tab object with the specified name and at Setup[index].
 function onClose()
           A handler function called by Klipfolio Dashboard when the Klip's Customize window is closed.
 function onOpen()
           A handler function called by Klipfolio Dashboard when the Klip's Customize window is opened by the user.
 function open( [ <integer> index | <String> name ] )
           Opens Klip's Customize window at the specified Tab.
 boolean removeTab( <String> name | <Tab> tab | <integer> index )
           Removes the specified Tab object from the Setup array..
 boolean renameTab( <String> name | <Tab> tab | <integer> index, <String> new_name )
           Renames the specified Tab object in the Setup array..

Properties Detail

length

integer length

Function Detail

addTab

Tab addTab( <String> name )

close

function close()

insertTab

Tab insertTab( <integer> index, <String> name )

onClose

function onClose()

onOpen

function onOpen()

open

function open( [ <integer> index | <String> name ] )

removeTab

boolean removeTab( <String> name | <Tab> tab | <integer> index )

renameTab

boolean renameTab( <String> name | <Tab> tab | <integer> index, <String> new_name )

Klipfolio Dashboard 5 API

© 2009 Klipfolio Inc. All Rights Reserved.