Entity-aware Menus

In this Lesson

You will learn how menu items can be hidden until an entity appears in the session.

Concepts

Sometimes you may have items on a menu which only apply to the the ‘current item’ they are working with. Consider the following example.

The entries for Menu Items and Guest List should only appear after a party has been selected because they are designed to operate on the currently selected party.



In Soiree terms a party is an entity as described in the Entity Definitions lesson. When the user selects an entity its keys are placed into the session context. The Soiree menu manager has the ability to filter menu items by the presence or absence of an entity’s keys.

Try it out

In this exercise you will learn how to control the visibility of a scene menu item by using session context.

Before we begin let’s prepare the Party Definition scene so that it can be closed.

  1. Open the PartyDefinition scene



  2. Add a Close button to the scene



  3. Right-click the button and modify its properties to Close All layers



  4. Save the scene

Now let’s create a menu that is controlled by the presence of an entity’s keys in the session.

  1. Open the PartyPool solution
  2. The Primary Menu should look like this



  3. Drag the PartySplash to create a new scene item in the Party Pool main menu



    Provide the following values for the item



    The menu should now look like this

  4. Notice the menu item shows an E indicating it has an entity assigned to it.



  5. Save the solution definition

When an entity is assigned to a scene menu item it will only be displayed if the entity’s keys exist in the session.

Let’s test that now.

  1. Start Derby and the Server if they are not already running.
  2. Start the PartyPool solution.
  3. Sign on with user=editor pw=editor



  4. Notice the newly added Party Splash – With Entity sub-menu is not on the main menu because a party has not been selected yet.



  5. Select the Party Scenes sub-menu



  6. Select the Party Definitions scene



  7. Select one of the parties



  8. Close the scene



  9. Navigate back up to the main menu



  10. The new item is now displayed because a party has been selected



That’s all for this lesson.