Actions - UNC-Project-Open-AAC/OS-DPI GitHub Wiki

Actions

An Action is an event that occurs when changes to the State match any programmed Conditions. An Action can be as simple as clicking on a button to clear the display window. Or, an Action can activate word prediction. Actions are determined by the UI designer to make the UI respond how ever they decide. A growing list of Actions can be assigned to buttons through declarative programming.

Screenshot 2023-04-14 at 11 48 33 AM

Example

In the design pictured below there are two Actions defined.

  1. If the Action originates in the grid, selecting an icon will add the label text to the display window. As seen in the grid screenshot, selecting the icon "I" has added "I" to the display window.

  2. If the Action originates in the CLEAR button, selecting CLEAR will result in the display window contents being cleared.

image

image.

How to Create an Action

  1. Click on Add > Action

  2. Fill in the Origin box. Origin refers to where the action originates in the design (e.g., layout, grid, homepage) and the Name that you have given that component.

Example: If you want the Action to originate in a grid that you have named "Core". Then in the box for Origin, you would type core.

image
  1. Fill in the State box. State refers to shared variables (i.e., a variable that is shared among controls. State variables start with $ symbol (e.g., $Display). A single Action can have multiple States. To add more States, click Add > Update.

  2. Fill in the New Value box. New Value refers to the updated Condition for the Action.

Example: If you want to design a grid-based UI where icons with text are treated as words and added to the display window when selected, then the **New Value **box would need to be filled with "add_word(#fill_display). This will tell the OS-DPI system to treat the data in your spreadsheet as a word. When the word is added to the display window a space will automatically be placed after the word. In this example, #fill_display is the name of a column in the spreadsheet that lists all of the words that could be added to the display window.

  1. If there is a Condition, fill that box in. Condition refers to the comparison between States and Fields that determines whether the Action gets triggered. If the Condition box is left blank, the Action will occur anytime the button is selected. A single Action can have multiple Conditions. To add more Conditions, click Add > Condition.

Example: If you want to design a UI where words in the display window are spoken when the Speak button is selected, then add you have to specify the Condition. For Condition insert #label='Speak'. The Condition here is that we only want this Action to occur when the Condition is met that the button #label = Speak.

Note: The rule is the first Action in the list always wins. In the screenshot below, the Action that uses #pronounce must be listed first, otherwise the first action of speaking the label (i.e., โ€œitโ€) will be triggered.

Screenshot 2023-05-01 at 2 18 19 PM

For more detail on creating Actions, check out this tutorial for creating a simple grid.

Example Declarative Programming for Common Actions


Origin Condition State New Value
grid #label = 'Speak' $Speak $Display
space   $Display add_letter('')
keyboard   $prefix add_letter(#label)
  $Display add_letter(#label)
predict $prefix $Display$prefix replace_last(#label + ' ')''

Backlinks

  • Response
    • emit: emit the low-level event so that it can be processed by Actions
โš ๏ธ **GitHub.com Fallback** โš ๏ธ