Skip to content
marshall 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

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 it’s time to create the menu.
createUserMenu(label)
Create an application menu on the main window, with the given label
returns an instance of the TiUserMenu class

ti.Window

createWindow
Returns an instance of the TiUserWindow class

getMainWindow
Returns the main window object

TiUserWindow
get/setID
get/setX
get/setY
get/setWidth
get/setHeight
get/setBounds
get/setTitle
get/setURL
is/setResizable
is/setMaximizable
is/setMinimizable
is/setCloseable
is/setFullscreen
is/setVisible
is/setUsingChrome
is/setUsingScrollbars
get/setTransparency
hide
show
close

TiUserMenu

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

TiSystemMenu

addItem
addSeparator
hide
show

Clone this wiki locally