Expand Minimize Picture-in-picture Power Device Status Voice Recognition Skip Back Skip Forward Minus Plus Play Search
Internet Explorer alert
This browser is not recommended for use with smartdevicelink.com, and may not function properly. Upgrade to a different browser to guarantee support of all features.
close alert
To Top Created with Sketch. To Top
To Bottom Created with Sketch. To Bottom
JavaScript Suite Guides
Template Text

Template Text

You can easily display text, images, and buttons using the ScreenManager. To update the UI, simply give the manager your new data and (optionally) sandwich the update between the manager's beginTransaction() and commit() methods.

Text Fields

ScreenManager Parameter Name Description
textField1 The text displayed in a single-line display, or in the upper display line of a multi-line display
textField2 The text displayed on the second display line of a multi-line display
textField3 The text displayed on the third display line of a multi-line display
textField4 The text displayed on the bottom display line of a multi-line display
mediaTrackTextField The text displayed in the in the track field; this field is only valid for media applications
textAlignment The text justification for the text fields; the text alignment can be left, center, or right
textField1Type The type of data provided in textField1
textField2Type The type of data provided in textField2
textField3Type The type of data provided in textField3
textField4Type The type of data provided in textField4
title The title of the displayed template

Showing Text

sdlManager.getScreenManager().beginTransaction();
sdlManager.getScreenManager().setTextField1('Line 1 of Text');
sdlManager.getScreenManager().setTextField2('Line 2 of Text');
// Commit the updates and catch any errors
const success = await sdlManager.getScreenManager().commit().catch(function (error) {
    // Handle Error
});
console.log('ScreenManager update complete:', success);
if (success === true) {
    // Update complete
} else {
    // Something went wrong
}

Removing Text

To remove text from the screen simply set the screen manager property to .

sdlManager.getScreenManager().setTextField1(null);
sdlManager.getScreenManager().setTextField2(null);
View on GitHub.com
Previous Section Next Section