Text Overview
-
Navigate to HSYCO Manager
-
Create a new project or open an existing one
- Go to Home page
- Click "add"
- Add a "Text" object
- Go back to "edit" mode
- You can align the button in the middle of the page by clicking "Align" and then "Center Vertically" and "Center Horizontally"
- Give the text area an ID ("textarea" for example)
- Change the "Text" to "Text to be changed"
10. Check the "Selectable" checkbox. This makes the text selectable with the mouse
11. Check the "Auto Links" checkbox. This detect URLs, Emails and Phone numbers and displays them as hyperlinks
Tip: Now we'll add a button that, when pressed, changes the text displayed
- Click "add"
- Add a "Button"
- Click "edit"
- You can align the button like we did before with the text object by clicking "Align"
- Change the "Label" to "Press to change the text"
17. Change the "Action" to "command". We'll capture this command and set the new text in the text object
- Change the "Name" to "changetext"
19. Change also the "Parameter" to "changetext". Note that this two values could be any string, also different from each other
- Click "Save" to save the project
Tip: Now we'll write some code to capture the command and change the text displayed
- Go to "File Manager"
- Navigate into the "events" folder
- Click "New File"
- Give it a name ("text.txt" for example) and click "New File"
**25. Now copy the following code into the file and save it:
function userCommand(session, userid, name, param) : {
if(name.equals("changetext")){
uiSet("textarea", "text", "Text Changed<br>Example URL: www.example.com");
}
}
What this does is it changes the text displayed of the text object with ID "textarea" only if the name of the command is "changetext", which we set earlier**
- Now go back into the "Project Editor" and click "Run" then "Default" to launch the application
- The page should look like this:
- Press the button
29. As you can see, the text displayed changes. Also, the URL has been recognized and shown as a hyperlink, because we set the "Auto Links" attribute to true