Skip to main content

Slider Command Action

  1. Navigate to HSYCO Manager

  2. Create a new project or open an existing one

  1. Go to Home page

  1. Click "add"

  1. Add a "Slider"

  1. Go back to "edit" mode

  1. You can align the object by clicking "Align" and then "Center Vertically"

  1. You can also move the object or resize it by dragging one of the corners

  1. Change the "Label"to "Slider"

  1. Change the "Action" to "command"

11. Change the "Name" to "slider". This can be any string and is the name of the command launched by the slider

Tip: Now we'll add the text object that will show the value of the slider

  1. Click "add"

  1. Add a "text" object

  1. Resize it and move it to the right of the slider like this:

  1. Click "edit"

  1. Leave the "Text" attribute blank as this will be modified later by the code

  1. Change the ID of the object to "textarea"

  1. Change the "Font Size" to 50 to have the number written large

  1. Click "Save" to save the project

Tip: Great! Now we'll write some code to modify the text showed based on the slider value

  1. Go to "File Manager"

  1. Navigate into the "events" folder

  1. Click "New File"

  1. Give it a name ("slider.txt" for example) and click "New File"

**24. Copy the following code and save the file:

function userCommand(session, userid, name, param) : {
if(name.equals("slider")){
uiSet("textarea", "text", param);
}
}

What this does is it changes the "text" attribute of the object with ID "textarea" and it sets it to the param value, which is the value passed by the slider**

  1. Now go back into the "Project Editor", click "Run" and then "Default" to launch the application

  1. The page should look like this, with the text object blank:

27. If we change the value of the slider, that value is displayed in the text area. In this case, 81