Skip to main content

Registry Fields with Persistent Variables

  1. Navigate to HSYCO Manager

  2. Create a new project or open an existing one

  1. Go into the Home page

  1. Click "add"

  1. Add a "Field" object

  1. Go back to "edit" mode

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

  1. Change the "ID" to "namefield"

9. Change the "Name" attribute to "$namefield!". "$namefield!" is a persistent variable that will contain the value of this field, so what the user enters as text Note that this variable is different from the ID as this two are two completely different things

10. Change the "Placeholder" to "Name". The Placeholder is a short hint that describes the expected value of the field

  1. Click "add"

  1. Add a second "Field"

  1. Click "edit"

  1. Move this field under the previous one

  1. Change the "ID" to "surnamefield"

  1. Change the "Name" attribute to "$surnamefield!"

  1. Change the "Placeholder" to "Surname"

  1. Click "add"

  1. Add the third "Field"

  1. Click "edit"

  1. Move it under the other two fields

  2. Change the "ID" to "datefield"

  1. Change the "Name" attribute to "$datefield!"

  1. Change the "Placeholder" to "Date of Birth"

  1. Change the "Type" to "date"

  1. The page should look like this:

  1. Click "Save" to save the project

Tip: Good! Now we need some code to retrieve the values in the three persistent values and show them in their respective fields every time we visit this page

  1. Go into the File Manager

  1. Navigate into the "events" folder

  1. Click "New File"

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

**32. Copy the following EVENTS code and save the file:

INIT or $namefield! : UISET namefield.value = $namefield!
INIT or $surnamefield! : UISET surnamefield.value = $surnamefield!
INIT or $datefield! : UISET datefield.value = $datefield!

What this does is it sets the value of each of the field objects to the content of their corresponding persistent variable every time this changes**

  1. Go back to the Project Editor, click "Run" and "Default" to launch the application

  1. The page, at first, lets you insert some text

  1. Insert a Name in the first field

  1. Insert a Surname in the second field

  1. Select a date from the third field

  1. If you now try to reload the page or move to another page if your project has more pages, you should see that the fields will autocompile to the last value immetted, which is the value in the persistent variables