Step 3 - Create a popup-type window

In this step you create a popup-type window that opens on top of the Settings application screen. You set the popup-type window to close when the user presses a keyboard key.

Create a popup-type window

In this section you create a popup-type window that opens when the user selects a specific item in a List Box.

To create a popup-type window:

  1. In the Node Tree select the Settings > Popup node, in the Properties add the Focus Scope > Focus Scope Type property, and set it to Popup.

    Popup scope allows the popup window to lose focus when the key and touch input comes from outside of the boundaries of the popup scope node.

    ../../_images/popup.png ../../_images/popup-properties.png
  2. In the Node Components press Alt and right-click Triggers and select the Scope Brought To Front trigger.

    You use this trigger to set the active focus to the popup window when that window opens.

    ../../_images/add-scope-brought-to-front.png ../../_images/scope-brought-to-front.png
  3. In the Scope Brought To Front trigger create a Set Property action, and set:

    • Name to Set Visible

    • Target Property to Visible

    • Value From to Fixed Value

    • Fixed Value to enabled

    This way you make the Popup node visible when it receives focus.

    ../../_images/add-set-property-action.png ../../_images/set-property-visible.png
  4. In the Node Components > Triggers create a Scope Sent To Back trigger.

    With this trigger you remove the active focus from the popup window when that window closes. This way you move the focus back to the SettingsMenu node.

    ../../_images/scope-sent-to-back.png
  5. In the Scope Sent To Back trigger create a Set Property action, and set:

    • Name to Set Invisible

    • Target Property to Visible

    • Value From to Fixed Value

    • Fixed Value to disabled

    This way you make the Popup node invisible when it loses focus.

    ../../_images/set-property-invisible.png
  6. In the Node Tree select the Settings > SettingsMenu node and in the Node Components create a List Box: Item Selected trigger.

    You use this trigger to open the popup-type window when the user selects a specific item in a List Box.

    ../../_images/settingsmenu.png ../../_images/list-box-item-selected.png
  7. In the List Box: Item Selected trigger create a Bring Scope To Front action and in that action set the Target Item to Screens/Screen/RootPage/Settings/Popup.

    You set the Popup node to receive focus when the user selects an item in the List Box node SettingsMenu. In the next step, you set which list item the user must select for the popup-type window to open.

    ../../_images/list-box-item-selected-add-bring-scope-to-front.png ../../_images/bring-scope-to-front.png
  8. In the Node Components in the List Box: Item Selected trigger right-click Conditions, select Trigger Condition, and in the condition set:

    • A

      • Type of A to Message argument

      • Message Argument to Selection

    • Operation to =

    • B

      • Type of B to Fixed

      • Fixed Value to 2

    With this condition you set the popup-type window to open when the user selects the third item in the List Box node SettingsMenu. In the SettingsMenu node the third item is Car with the red warning indicator.

    ../../_images/create-trigger-condition.png ../../_images/trigger-condition.png

In the Settings application, when in the SettingsMenu you select the Car item Kanzi opens the popup-type window. To close the popup-type window click anywhere in the application.

../../_images/show-popup.gif

Close the popup-type window with a key

In this section you set the popup-type window to close when the user presses a specific keyboard key.

To close the popup-type window with a key:

  1. In the Node Tree select the Settings > Popup node, in the Node Components > Input Manipulators create a Key Manipulator, and set the Logical Key to Enter.

    This way you set the Popup node to react when the user presses the Enter key. In the next step you create a trigger that sets how the Popup node reacts.

    ../../_images/popup.png ../../_images/key-manipulator.png ../../_images/logical-key.png
  2. In the Node Components > Triggers create a Key Pressed trigger with a Send Scope To Back action.

    You set the Popup node to lose focus when the user presses the Enter key. This way you return the focus to the SettingsMenu node.

    Key Pressed trigger is set off when the user presses a specific key on their keyboard.

    ../../_images/key-pressed.png ../../_images/popup-triggers.png

Now you can use these keyboard keys to move the focus in the application:

  • Tab and Shift Tab keys to navigate between the application screens.

  • key to move focus to the Media and Settings applications.

  • In the Media screen:

    • Tab and Shift Tab keys to navigate between the List Box nodes.

    • and keys to scroll the items in the List Box nodes.

    • Esc key to move focus back to the navigation bar.

  • In the Settings screen:

    • and keys to scroll the items in the List Box node.

    • Enter key to close the popup-type window.

    • Esc key to move focus back to the navigation bar.

../../_images/focus-tutorial-complete.gif

< Previous step

See also

To learn more about focus, see Focus.

To learn more about triggers and actions, see Triggers.