Widgets

This section includes all of the Mojo widgets. Each widget section includes a brief description repeating some of the information from Chapters 3, 4, and 5, followed by an enumeration of the widget’s attribute and model properties, relevant events, and public methods.

Button

Buttons are the most basic UI element, bounding an action to a region. When a button is pushed, it can change state but gracefully returns to the previous state, like a doorbell.

Attribute properties

Type

Description

type

String

Choices:

Mojo.Widget.defaultButton
Mojo.Widget.activityButton
disabledProperty

Boolean

Name of model property for disabled state

label

String

Displayed label

labelProperty

String

Model property name for label

Model properties

Type

Description

buttonClass
StringStyle options are primary, secondary, dismissal, affirmative, or negative
label

String

Displayed label

disabled

Boolean

Default property that when true, disables the widget

Events

Mojo.Event.tap

Methods

activate()

For an activity button, start the spinner

deactivate()

For an activity button, stop the spinner

Check Box

A Check Box widget is used to control and indicate a binary state value in one element.

Attribute properties

Type

Description

modelProperty

String

Name of model property for widget state

disabledProperty

String

Name of model property for disabled state

trueValue

String

Value to set modelProperty when widget state is true

falseValue

String

Value to set modelProperty when widget state is false

inputName

String

Identifier for the value of the check box; used when the widget is used in HTML forms

Model properties

Type

Description

value

Boolean

Current value of widget

disabled

Boolean

Default property that when true, disables the widget

Events

Mojo.Event.propertyChange

Date Picker

The date picker allows selection of month, day, and year values.

Attribute properties

Type

Description

label

String

Label displayed with the widget controls

labelPlacement

String

Choices are:

Mojo.Widget.labelPlacementLeft
Mojo.Widget.labelPlacementRight
modelProperty

String

Name of model property for date object; defaults to 'date'

month

Boolean

Set to true to display the month field in the widget

day

Boolean

Set to true to display the day field in the widget

year

Boolean

Set to true to display the year field in the widget

maxYear
IntegerSpecify maximum year in year capsule if enabled (default 2099)
minYear
IntegerSpecify minimum year in year capsule if enabled (default 1900)

Model properties

Type

Description

date

Date

Date object set to the widget value

Events

None

Drawer

Drawers are container widgets that can be open, allowing child content to be displayed normally, or closed, keeping it out of view.

Attribute properties

Type

Description

unstyled

Boolean

When set to true, prevents styles from being added, allowing the Drawer to be used just for open/close function

modelProperty

String

Name of model property for date object

Model properties

Type

Description

open

Boolean

Current state of the widget; set to true when open

Events

Mojo.Event.propertyChange

Methods

setOpenState(open)

Sets the open state to open or closed

getOpenState()

Returns current value of open state

toggleState()

Change the drawer’s open state to the opposite of what it is now

File Picker

Mojo.FilePicker.pickFile (params, stageController)

The File Picker presents a file browser that lets the user navigate the directory structure and optionally select a file. The File Picker lets users view and select files from the media partition, and allows filtering by file type (e.g., file, image, audio, or video).

Arguments

Type

Description

params

Object

Object containing information about the file to select as described below:

  onSelect

Function

Function to call after selection is made; it will return an object of the following format:

{ fullPath: /full/path/of/selected/file' }
  onCancel

Function

Function to call after selection is made; when picker is canceled.

  kinds

Array

Array of strings to allow (image, audio, video, file); default is support for all kinds; if only one kind is needed, kind: mytype can be used and override kinds

  defaultKind

String

String; the view to go to; one of image, audio, video or file

  actionType

String

attach and open are the only supported options; open is the default

  actionName

String

Overrides the default string defined by actionType

  extensions

Array

File extensions to filter in the files view

stageController

Object

The calling application’s stage assistant

Events

None

Filter Field

The Filter Field can be applied to any case where you want to process the field contents and update on-screen elements based on the entered string.

Attribute properties

Type

Description

delay

Integer

Delay between key strokes for a filter event, in milliseconds

disabledProperty

String

Name of model property for disabled state

Model properties

Type

Description

disabled

Boolean

Default property that, when true, disables the widget

Events

Mojo.Event.filter

Methods

open()

Open the widget

close()

Close the widget

setCount(integer)

Set the number to be shown in the results bubble in the Filter Field

Filter List

The Filter List combines a Filter Field and a List. It is intended to display a variable length list of objects, built by a special callback function that filters the list based on the contents of the filter field.

Attribute properties

Type

Description

delay

Integer

Delay between key strokes for a filter event, in milliseconds

filterFunction

Function

Function called to load items into the list as it is scrolled or filter changes; function definition is:

filterFunction(filterString, listWidget,
    offset, count)

where:

filterString: set to the input string

listWidget: this Filter Listwidget object

offset: index of first displayed entry in listfs

count; number of entries required from the function

listTemplate

String

File path relative to app folder for container template

itemTemplate

String

File path relative to app folder for item template

addItemLabel

String

If defined, a special “add” item will be appended to the list and taps on this will generate a Mojo.Event.listTap

formatters

Function

Object functions to format list entries based on model properties

itemsProperty

String

Model property for items list

swipeToDelete

Boolean

If true, list entries can be deleted with a swipe

autoconfirmDelete

String

If false, delete swipes will post a delete/undo button pair, otherwise deletes will be made immediately after swiping

uniquenessProperty
StringName of an item model property which can be used to uniquely identify items; if specified, List will maintain a hash of swiped items instead of setting a deleted property
preventDeleteProperty

String

If specified, the item models will be checked for this property, and swipeToDelete will be ignored on that item if the item model’s property is true

reorderable

Boolean

If true, list entries can be reordered by drag and drop

dividerFunction

Function

Function to create divider elements

dividerTemplate

Function

Function to format divider

fixedHeightItems

Boolean

If false, list widget will not apply optimizations for fixed height lists

initialAverageRowHeight

Integer

Initial value used for average height estimation

renderLimit

Integer

Max number of items to render at once; increase this if the UI overruns the list boundaries

lookahead

Integer

Number of items to fetch ahead when loading new items

dragDatatype

String

Used for drag-and-drop reordering; if specified, will enable dragging of items from one list to another of the same data type

deletedProperty

String

Name of the item object property in which to store the deleted status of an item

nullItemTemplate

String

File path relative to app folder for template for items that are rendered before loading

emptyTemplate

String

File path relative to application folder for template for empty list

onItemRendered

Function

Called each time an item is rendered into the DOM with these arguments

Model properties

Type

Description

disabled

Boolean

Default property that, when true, disables the widget

Events

Mojo.Event.listChange
Mojo.Event.listTap
Mojo.Event.listAdd
Mojo.Event.listDelete
Mojo.Event.listReorder
Mojo.Event.filter

Methods

getList()

Get the List widget associated with this filter list

open()

Open the filter field associated with this filter list

close()

Close the filter field associated with this filter list

setCount(integer)

Set the number to be shown in the results bubble in the filter field

Image View

You can use an ImageView for displaying single images, but it is intended as a scrolling viewer, flicking left and right through a series of images.

Attribute properties

Type

Description

highResolutionLoad

Integer

Time to wait before switching photo to high res

noExtractFS

Boolean

Flag to prevent looking up a high res version

fslimitZoom

Boolean

Flag to prevent or limit zooming

Model properties

Type

Description

onLeftFunction

Function

Called after a left scroll and transition

onRightFunction

Function

Called after a right scroll and transition

Events

Mojo.Event.imageViewChanged

Methods

getCurrentParams()

Return the current zoom level and focus [0,1]

manualSize(width, height)

Manually size the widget

leftUrlProvided(url)

Set the image for the left scroll

rightUrlProvided(url)

Set the image for the right scroll

centerUrlProvided(url)

Set the image for the center

Integer Picker

The Integer Picker offers a selection between minimum and maximum integer values, both of which are specified as properties.

Attribute properties

Type

Description

label

String

Label displayed with the widget controls

labelPlacement

String

Choices are:

Mojo.Widget.labelPlacementLeft
Mojo.Widget.labelPlacementRight
modelProperty

String

Name of model property for integer value; defaults to 'value'

min

Integer

Minimum value of the widget

max

Integer

Maximum value of the widget

padNumbers

Boolean

Add padding to single digit numbers or not

Model properties

Type

Description

value

Integer

Current value of the widget

Events

Mojo.Event.propertyChange

List

List is the most common and possibly the most powerful Mojo widget. Objects are rendered into list items using provided HTML templates, and may be variable height and/or include other widgets.

Attribute properties

Type

Description

listTemplate

String

File path relative to app folder for container template

itemTemplate

String

File path relative to app folder for item template

addItemLabel

String

If defined, a special “add” item will be appended to the list and taps on this will generate a Mojo.Event.listTap

formatters

Function

Object functions to format list entries based on model properties

itemsProperty

String

Model property for items list

itemsCallback

Function

Items will be loaded as needed by calling this function

swipeToDelete

Boolean

If true, list entries can be deleted with a swipe

autoconfirmDelete

String

If false, delete swipes will post a delete/undo button pair, otherwise deletes will be made immediately after swiping

uniquenessProperty
StringName of an item model property which can be used to uniquely identify items; if specified, List will maintain a hash of swiped items instead of setting a deleted property
preventDeleteProperty

String

If specified, the item models will be checked for this property, and swipeToDelete will be ignored on that item if the item model’s property is true

reorderable

Boolean

If true, list entries can be reordered by drag and drop

dividerFunction

Function

Function to create divider elements

dividerTemplate

Function

Function to format divider

fixedHeightItems

Boolean

If false, list widget will not apply optimizations for fixed height lists

initialAverageRowHeight

Integer

Initial value used for average height estimation

renderLimit

Integer

Max number of items to render at once; increase this if the UI overruns the list boundaries

lookahead

Integer

Number of items to fetch ahead when loading new items

dragDatatype

String

Used for drag-and-drop reordering; if specified, will enable dragging of items from one list to another of the same data type

deletedProperty

String

Name of the item object property in which to store the deleted status of an item

nullItemTemplate

String

File path relative to app folder for template for items that are rendered before loading

emptyTemplate

String

File path relative to application folder for template for empty list

onItemRendered

Function

Called each time an item is rendered into the DOM with these arguments

Model properties

Type

Description

items

Array

An array of objects to display in the list; required unless itemsCallback property is set as an attributes property

Events

Mojo.Event.listChange
Mojo.Event.listTap
Mojo.Event.listAdd
Mojo.Event.listDelete
Mojo.Event.listReorder

Methods

focusItem(itemModel, focusSelector)

Focus the item designated by the item model; optionally pass in the focusSelector to focus a specific element within the item

showAddItem(enable)

Show the “add item” in the list

noticeUpdatedItems(offset, items)

Causes the given items to be replaced and rerendered; items provided past the current end of the list will cause the length to grow; must pass an array

noticeAddedItems(offset, items)

Inserts the given array of items into the list at the given offset; if list items are dynamically loaded, this may cause some to be kicked out of the cache; calling this API will not cause a property-change event to be fired

noticeRemovedItems(offset, items)

Removes items from the list beginning at the given offset, and continuing for limit items; if list items are dynamically loaded, this may cause new ones to be requested; calling this API will not cause a property-change event to be fired

getNodeByIndex(index)

Return top level node for the list item of the given index; returns undefined if the item does not exist or is not currently rendered

invalidateItems(offset, limit)

Causes the given items to be reloaded (if currently loaded); if limit is unspecified, causes all items after offset to be invalidated

getLoadedItemRange()

Returns a hash with offset and limit properties indicating the range of currently loaded item models (or items that have been requested); this is sometimes used on the service side to optimize subscription data

getMaxLoadedItems()

Returns the maximum number of loaded items the list will maintain in its local cache

setInitialSize(length)

Call to set the initial size of the list, or after resetting the list state by calling modelChanged(); this function will set the limit on what range of items may be requested, but subsequent changes to the list size should be made through noticeAddedItems() and fsnoticeRemovedItems(); this function has no affect when the list size != 0

setLength(length)

Call to set the overall length of the list; this function will set the range of items that may be requested, but will generally not invalidate any existing items or request any new ones; it may request new items when the currently loaded items window is either not full, or the length change causes the items window to move (the latter case can occur if the length change causes the window to be “out of bounds”, or if it would ideally be positioned past the end of the list)

setLengthAndInvalidate(length)

Behaves like setLength(), except that all currently loaded items are invalidated; for lazily loaded lists, this API will result in a request for a whole window of items

getLength()

Returns the current length of the list

revealItem(index, animate)

Attempts to scroll the scene to reveal the item with the given index; may behave poorly when working with variable height list items that are not currently loaded, since you can’t accurately predict the height of the final rendered content

getItemByNode(node)

Returns the item model associated with the list item containing the given node, if any; otherwise, returns undefined

List Selector

The List Selector enables the selection of one of many options, presented in a pop-up list in which there is no practical limit to the number of options presented. This is similar to the Submenu widget behavior.

Attribute properties

Type

Description

modelProperty

String

Name of model property for widget state

disabledProperty

String

Name of model property for disabled state

multi-line

Boolean

If true, long labels will wrap to the next line instead of being truncated

label

String

Display label

labelPlacement

String

Mojo.Widget.labelPlacementRight places label on right, value on left (default);

Mojo.Widget.labelPlacementLeft places label on left, value on right

choices

Array

Array of selector descriptions, which must be in either the attributes or model object; each entry is required to be:

{label: 'string', value: value}

There must be at least two entries, and the number of entries defines the number of options presented in the widget

Model properties

Type

Description

value

Boolean

Current value of widget

disabled

Boolean

Default property that, when true, disables the widget

choices

Array

Array of selector descriptions, which must be in either the attributes or model object; each entry is required to be:

{label: 'string', value: value}

There must be at least two entries, and the number of entries defines the number of options presented in the widget

Events

Mojo.Event.propertyChange

Password Field

A text field used for passwords or some other type of confidential information, the Password Field provides many of the Text Field features, but masks the display. Any entered text is displayed as a bullet or “•” character.

Attribute properties

Type

Description

modelProperty

Boolean

Name of model property for widget value

hintText

String

Initially displayed string; supplanted by model value if supplied

inputName

String

If supplied, the text area will have this DOM name so that when it is serialized, the property can be easily pulled out

charsAllow

Function

Function must return true to allow input character, or false if not allowed

autoFocus

Boolean

If true, field has focus on scene push

modifierState

String

Initial state of modifier keys for this field; can be: Mojo.Widget.numLock or Mojo.Widget.capsLock

growWidth

Boolean

Automatically grow field horizontally

autoResizeMax

String

Maximum width of field

enterSubmits

Boolean

If set, the Enter key will submit rather than newline; must be used with multi-line

limitResize

Boolean

Limit height resize (scrolls text rather than grow field)

preventResize

Boolean

There will be no resizing in any dimension

holdToEnable

Boolean

If the text field is disabled, tapping and holding and releasing will enable it; if disabled is not set, this is ignored

focusMode

String

Replace or Insert Mode; choices are:

Mojo.Widget.focusSelectMode
Mojo.Widget.focusInsertMode
Mojo.Widget.focusAppendMode
changeOnKeyPress

Boolean

If true, sends a property change event on every character change to a field; otherwise only when field loses focus

maxLength

Integer

Maximum character length of field; does not apply to multi-line fields, where it will be ignored

requiresEnterKey

Boolean

Required Enter key to submit; other navigation will not submit contents of field

holdToEdit

Boolean

Tap and hold to focus/edit; tap only will be ignored

Model properties

Type

Description

value

Boolean

Plain-text value of the widget

Events

Mojo.Event.propertyChange

Methods

focus()

Put focus on the input field

blur()

Remove focus from the input field

getValue()

Get the plaintext value of the widget

setValue()

Set the plaintext value of the widget

getCursorPosition()

Returns an option with:

{selectionStart: int, selectionEnd: int}

that describe the position of the cursor; if start is not equal to end, there is text selected

setCursorPosition(start, end)

Sets the cursor position in the input portion of the text field

Progress Bar

Progress Bar displays a narrow horizontal bar with an incremental internal bar to show progress. Use a Progress Bar or Pill to show download progress, when loading from a database, or anytime you initiate a long-running operation and have a sense of the duration.

Attribute properties

Type

Description

modelProperty

String

Name of model property for widget value

icon

String

CSS class for icon to display on the bar

iconPath

String

File path relative to application folder for icon

Model properties

Type

Description

value

Integer

Value of the widget

title

String

Dynamic title to show on bar

image

String

File path relative to application folder for dynamic image to show on bar

Events

Mojo.Event.progressComplete

Methods

reset()

Reset progress to 0

cancelProgress()

Stop the progress and freeze bar display in current state

Progress Pill

Progress Pill displays a broad horizontal bar with an incremental pill to show progress. Use a Progress Bar or Pill to show download progress, when loading from a database, or anytime you initiate a long-running operation and have a sense of the duration.

Attribute properties

Type

Description

modelProperty

String

Name of model property for widget value

title

String

Title to show on bar

image

String

File path relative to application folder for image to show on bar

icon

String

CSS class for icon to display on the bar

iconPath

String

File path relative to application folder for icon

Model properties

Type

Description

value

Integer

Value of the widget

title

String

Dynamic title to show on bar

image

String

File path relative to application folder for dynamic image to show on bar

Events

Mojo.Event.progressIconTap
Mojo.Event.progressComplete

Methods

reset()

Reset progress to 0

cancelProgress()

Stop the progress and freeze bar display in current state

Progress Slider

For media or other applications in which you want to show progress as part of a tracking slider, the Progress Slider is an ideal choice. Combining the Slider widget with the Progress Pill, the behavior is fully integrated, but not all of the configuration options are represented.

Attribute properties

Type

Description

sliderProperty

String

Name of model property for slider position value

progressProperty

String

Name of model property for progress position value

progressStartProperty

Integer

Starting position of progress bar

minValue

Integer

Starting value, or leftmost value on the slider

maxValue

Integer

Ending value, or rightmost value on the slider

round

Boolean

If true, will round the value to the nearest integer

updateInterval

Integer

If set >0, the widget will send events every updateInterval seconds

Model properties

Type

Description

value

Integer

Value of the widget

Events

Mojo.Event.propertyChange
Mojo.Event.progressComplete

Methods

reset()

Reset progress to 0

Radio Button

The Radio Button presents each button as a labeled selection option in a horizontal array, where only one option can be selected at a time.

Attribute properties

Type

Description

modelProperty

String

Name of model property for widget state

disabledProperty

String

Name of model property for disabled state

choices

Array

Array of button descriptions; each entry is required to be:

{label: 'string', value: value}

The number of entries defines the number of buttons presented in the widget

Model properties

Type

Description

value

Boolean

Current value of widget

disabled

Boolean

Default property that, when true, disables the widget

Events

Mojo.Event.propertyChange

Rich Text Edit

There is a simple Rich Text Edit widget that behaves similar to a multi-line text field, but in addition supports applying Bold, Italic, and Underline styles to arbitrary runs of text within the field. To enable the styling, set the Application menu’s RichTextEditItems property to true.

Attribute properties

Type

Description

None

  

Model properties

Type

Description

value

Boolean

Current value of widget

Events

None

Scroller

The Scroller widget provides the scrolling behavior in Mojo. Scrollers can be applied to any div content and set to one of six scrolling modes.

Attribute properties

Type

Description

mode

String

Scrolling mode; one of free, vertical, horizontal, dominant, vertical-snap, or horizontal-snap

Model properties

Type

Description

snapElements

Array

Array of DOM elements used as snap points for horizontal or vertical scrolling

Events

Mojo.Event.propertyChange

Methods

revealTop(newTop)

Jumps the scroll to reveal the top of the specified object at the top of the scroll area

revealBottom()

Jumps the scroll to reveal the bottom of the content being scrolled

revealElement(Element)

Jumps the scroll to reveal a specific DOM element

scrollTo(x-coord, y-coord, animated, 
suppressNotification)

Jumps the scroll to the specified x- and y-coordinates; set animated to true to animate the scroll, or if animated is false, set suppressNotification to true to prevent notifications to event listeners

getState()

Returns the current scroll state for use in a future call to setState()

setState(scrollState, animate)

Jumps the scroll to the value specified in scrollState; pass true to animate the scroll

adjustBy(deltaX, deltaY)

Adjusts the current scroll position by the given amount; safe to call from scroll listeners while animating; does not cause listeners to be notified of any changes

scrollerSize

Returns the size of the scroller’s view port in pixels:

{height:nnn, width:nnn}
setMode(newMode)

Set the mode of the scroller, which controls which drag directions causes scrolling; choices are free, dominant, horizontal, horizontal-snap, vertical, and vertical-snap

getScrollPosition()

Get the current position of the scroller; returns:

{left: nnn px, top: nnn px}
setSnapIndex(snapIndex, animate)

Sets the snap index for a snap scroller and scrolls to the new position; pass true to animate

Slider

The Slider presents a range of selection options in the form of a horizontal slider with a control knob that can be dragged to the desired location.

Attribute properties

Type

Description

modelProperty

String

Name of model property for widget value

minValue

Integer

Starting value, or leftmost value on the slider

maxValue

Integer

Ending value, or rightmost value on the slider

round

Boolean

If true, will round the value to the nearest integer

updateInterval

Integer

If set >0, the widget will send events every updateInterval seconds

Model properties

Type

Description

value

Integer

Value of the widget

Events

Mojo.Event.propertyChange

Spinner

Use a Spinner to show that an activity is taking place. The framework uses a Spinner as part of any activity button, and you’ll see it used in the core applications. There are two sizes: the large Spinner is 128 × 128 pixels, and the small Spinner is 32 × 32.

Attribute properties

Type

Description

modelProperty

String

Name of model property for widget state

spinnerSize

String

Choices are:

Mojo.Widget.spinnerLarge
Mojo.Widget.spinnerSmall
superClass

String

Specifies the CSS class name for the background image with a custom spinner

startFrameCount

Integer

With a custom spinner, this is set to the number of frames for the preloop animation

mainFrameCount

Integer

With a custom spinner, this is set to the number of frames for the main loop animation

finalFrameCount

Integer

With a custom spinner, this is set to the number of frames for the post-loop animation

frameHeight

Integer

Explicitly sets the height of the animation

fps

Integer

Frames per second of the main loop animation

Model properties

Type

Description

spinning

Boolean

Spinner state; set to true if spinning

Events

Mojo.Event.propertyChange

Methods

start()

Start the spinner

stop()

Stop the spinner

toggle()

Change the spinner from start to stop or from stop to start

Text Field

The basic text widget that supports all general text requirements: single or multi-line text entry, with common styles for labels, titles, headings, body text, line items, and item details. The editing tools include basic entry and deletion, symbol and alternate character sets, cursor movement, selection, cut/copy/paste, and auto text correction.

Attribute properties

Type

Description

modelProperty

Boolean

Name of model property for widget value

disabledProperty

String

Name of model property for disabled state

hintText

String

Initially displayed string; supplanted by model value if supplied

inputName

String

If supplied, the text area will have this DOM name so that when it is serialized, the property can easily be pulled out

charsAllow

Function

Function must return true to allow input character, or false if not allowed

autoFocus

Boolean

If true, field has focus on scene push

modifierState

String

Initial state of modifier keys for this field; can be: Mojo.Widget.numLock or Mojo.Widget.capsLock

growWidth

Boolean

Automatically grow field horizontally

autoResizeMax

String

Maximum width of field

enterSubmits

Boolean

If set, the Enter key will submit rather than newline; must be used with multi-line

limitResize

Boolean

Limit height resize (scrolls text rather than grow field)

preventResize

Boolean

There will be no resizing in any dimension

holdToEnable

Boolean

if the text field is disabled, tapping and holding and releasing will enable it; if disabled is not set, this is ignored

focusMode

String

Replace or Insert Mode; choices are:

Mojo.Widget.focusSelectMode
Mojo.Widget.focusInsertMode
Mojo.Widget.focusAppendMode
changeOnKeyPress

Boolean

If true, sends a property change event on every character change to a field; otherwise only when field loses focus

maxLength

Integer

Maximum character length of field; does not apply to multi-line fields, where it will be ignored

requiresEnterKey

Boolean

Requires Enter key to submit; other navigation will not submit contents of field

holdToEdit

Boolean

Tap and hold to focus/edit; tap only will be ignored

emoticons

Boolean

Enable emoticons on this field

autoReplace

Boolean

Whether to enable the Smart Text Engine services

textCase

String

Options are:

Mojo.Widget.steModeSentenceCase
Mojo.Widget.steModeTitleCase
Mojo.Widget.steModeLowerCase

Model properties

Type

Description

value

Boolean

Value of the widget

disabled

Boolean

Default property that when true, disables the widget

Events

Mojo.Event.propertyChange

Methods

focus()

Put focus on the input field

blur()

Remove focus from the input field

getValue()

Get the plain-text value of the widget

setValue(String)

Set the plain-text value of the widget

getCursorPosition()

Returns an option with:

{selectionStart: int, selectionEnd: int}

that describe the position of the cursor; if start is not equal to end, there is text selected

setCursorPosition(start, end)

Sets the cursor position in the input portion of the text field

Time Picker

The Time Picker enables selection of hours, minutes, and either A.M. or P.M. for time selection. The picker will suppress the A.M./P.M. capsule if the 24-hour time format is selected in the user preferences or by the locale.

Attribute properties

Type

Description

label

String

Label displayed with the widget controls

labelPlacement

String

Choices are:

Mojo.Widget.labelPlacementLeft
Mojo.Widget.labelPlacementRight
modelProperty

String

Name of model property for date object; defaults to 'time'

minuteInterval

Integer

Interval between minute selections

Model properties

Type

Description

time

Date

Date object set to the widget value

Events

Mojo.Event.propertyChange

Toggle Button

The Toggle Button is another widget for displaying and controlling a binary state value. As with the Check Box, the Toggle Button will switch between two states each time it is tapped.

Attribute properties

Type

Description

modelProperty

String

Name of model property for widget state

disabledProperty

String

Name of model property for disabled state

trueValue

String

Value to set modelProperty when widget state is true

trueLabel

String

Label when widget state is true

falseValue

String

Value to set modelProperty when widget state is false

falseLabel

String

Label when widget state is false

inputName

String

Identifier for the value of the check box; used when the widget is used in HTML forms

Model properties

Type

Description

value

Boolean

Current value of widget

disabled

Boolean

Default property that, when true, disables the widget

Events

Mojo.Event.propertyChange

Web View

To embed a contained web object, declare and instantiate a WebView widget. You can use it render local markup or to load an external URL; as long as you can define the source as a reachable URL, you can use a WebView to render that resource.

Attribute properties

Type

Description

virtualpageheight

Integer

The browser’s virtual page height

virtualpagewidth

Integer

The browser’s virtual page width

url

String

The initial URL to display

pageIdentifier

Function

The BrowserServer page identifier; this is used when the Browser Server instructs an application to open a new URL

minFontSize

Integer

The minimum font size that the browser will display

topMargin

Integer

The margin above the web view that is scrolled off the screen when a new page is loaded

cacheAdapter

Boolean

If true, cache this adapter, false if not, or undefined to not specify and use the browser-adapter default; default is undefined

interrogateClicks

Boolean

Use to call the host application for every hyperlink click via Mojo.Event.webViewLinkClicked

showClickedLink

Boolean

Styles clicked links with grey background and border

Model properties

Type

Description

None

  

Events

Mojo.Event.webViewLoadStarted
Mojo.Event.webViewLoadProgress
Mojo.Event.webViewLoadStopped
Mojo.Event.webViewDownloadFinished
Mojo.Event.webViewLinkClicked
Mojo.Event.webViewTitleUrlChanged
Mojo.Event.webViewTitleChanged
Mojo.Event.webViewUrlChanged
Mojo.Event.webViewCreatePage
Mojo.Event.webViewTapRejected
Mojo.Event.webViewScrollAndScaleChanged
Mojo.Event.webViewEditorFocused
Mojo.Event.webViewUpdateHistory
Mojo.Event.webViewSetMainDocumentError
Mojo.Event.webViewServerConnect
Mojo.Event.webViewServerDisconnect
Mojo.Event.webViewResourceHandoff
Mojo.Event.webViewFirstPaintComplete
Mojo.Event.webViewUrlRedirect
Mojo.Event.webViewModifierTap
Mojo.Event.webViewMimeNotSupported
Mojo.Event.webViewMimeHandoff

Methods

setTopMargin(margin)

Set the top margin (in pixels)

clearCache()

Clear browser cache

clearCookies()

Clear browser cookies

deleteImage(image)

Delete the image file specified by the argument

generateIconFromFile(src, dst, left, 
top, right, bottom)

Generate a 64 × 64 pixel icon from a portion of a source file; the output icon will be given a drop shadow and sheen consistent with other launcher icons

goBack()

Go to the previous page in the user’s browsing history

goForward()

Go to the next page in the user’s browsing history

openURL(url)

Open the specified URL in the WebView

reloadPage()

Reload the currently loaded page

resizeImage(src, dst, width, height)

Resize the input file to the specified width/height and write the new image to the specified output file

getHistoryState(onSuccess)

Asynchronous; retrieves the current history state from the Browser server; will call onSuccess with results

setBlockPopups(enable)

Set to true to block pop-ups

setAcceptCookies(enable)

Set to false to disable cookies

addUrlRedirect(urlRe, redirect, 
userData, type)

Add a URL redirect; when the browser server navigates to a URL matching urlRe and redirect is true, it will not navigate to that URL, and will instead send a Mojo.Event.webViewUrlRedirect event

addSystemRedirects(skippAppId)

Read the command resource handler table and send down redirect handler commands to the browser server

saveViewToFile(fname, left, top, 
width, height)

Save the specified view frame (in pixels) to the specified file

setEnableJavaScript(enable)

Set to false to disable JavaScript

stopLoad()

Stop loading the current page

clearHistory()

Clear browser history

setShowClickedLink(enable)

Set to true to enable launch of clicked links

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.70.113