Skip to content
jhaynie edited this page Sep 13, 2010 · 106 revisions

The following APIs are in progress and likely to change.

The “ti” object is the main interface that the application will interact with the gain access to Titanium services.

ti.App

include(url)
include a javascript at the given URL
debug(message)
debug a message to the console
hide()
hide the app
show()
show the app
activate() – same as restore in win32
beep()
playSound(sound)
playNamedSound(soundName)
quit()

ti.Dock

setIcon(icon)
setBadge(badge)
sets the value on the badge (if supported by platform). if null is passed, no badge will be shown.
notify(severity)

ti.Filesystem

open(path, mode)
path: The absolute path of the file to open.
mode: “r” for read, “rw” for read-write, “w” for write.
Returns a TiFile object

TiFile class

read()
Returns the contents of the file as a string
write(contents)
Writes the string contents to the file

ti.Desktop

openFiles(callback)
Open a file dialog so the user can select a set of files. The callback function is called when the user is finished, and it is passed an array of objects with the following properties:

  • fullPath: the absolute path on the system of the selected file (can be passed directly to ti.Filesystem.open())
  • filename: the standalone filename

ti.Menu

createSystemMenu(iconURL, caption, callback)
Create a system menu with an Icon at iconURL, with the given caption. The callback object will be called when the user left-mouse clicks on the icon (otherwise the menu is shown). Returns an instance of the TiMenu class
createUserMenu(label)
Create an application menu on the main window, with the given label
returns an instance of the TiMenu class

TiMenu

addItem(label, callback)
add a menu item to this menu. the callback function will be called when the item is clicked
addSubMenu(label)
adds and returns a new TiUserMenu as a submenu of the current menu
addSeparator()
add a separator
get/setIcon()
get/setAction()

ti.Window

createWindow()
Returns an instance of the TiUserWindow class
mainWindow
A property for the main application window
currentWindow
A property for the current application window

TiUserWindow

The following properties (as methods) are immutable:

isUsingChrome
isUsingScrollbars
isFullscreen
getID

They cannot be changed once open is called on a window.

open()
get/setX()
get/setY()
get/setWidth()
get/setHeight()
get/setBounds()
get/setTitle()
get/setURL()
is/setResizable()
is/setMaximizable()
is/setMinimizable()
is/setCloseable()
is/setVisible()
get/setTransparency()
hide(animate) — optionally pass true to animate the hide with a fade out effect
show(animate) — optionally pass true to animate the show with a fade in effect
close()

Clone this wiki locally