Navigating the Screens
The ‘Actions’ Property
The actions property encloses a set functions with names that can be used as parameters of navigate and go methods.
Example:
'actions': {
'main': function(hs) {
hs.data.option = "01";
hs.send.enter();
},
'logout': function(hs) {
hs.send.pf1();
}
}
In the example shown above, the main action has associated a function that takes the application HostSurfer instance as parameter and executes the following methods:
- Sets ‘hs.data.option’ to “01”, as if the user would have typed “01” in the menu option field in the terminal emulator screen.
- Sends an ENTER key, as if the user would accepted the selected option.
NOTE: The
optionfield is retrieved from thedataproperty of the HostSurfer instance because it was explicitly defined in thefieldsproperty of the corresponding rule, as shown in the following code snippet:
'fields': [
{ ... },
{ 'name': 'option', 'row': 18, 'col': 63, 'len': 2 },
{ ... }
}
Actions can be chained with a single “navigate” call.