K2BTools Tutorial - Exercise 14.1 - Creating a Menu Object

In this exercise we will create a new Menu Object, that we will use to configure the application’s menu. After the menu is created, we will initialize the menu’s content using information extracted from the KB.

To do this, follow these steps:

  1. Open the “New Object” dialog in GeneXus (Ctrl + N), and select “K2BMenu” object type. Name this object K2BMainMenu.
    K2BMenuCreateObject1
    K2BMenu object creation

  2. We now have an empty menu. To initialize it, use the “Scan Menu” located in the specification tree’s root node.
    ScanMenuActionTutorial2
    Scan Menu action


    This action will scan the contents of the KB, and will include all the web panels generated with K2BTools that have the “Include In Menu” property set to True. After the action is executed, the tree should look like this.
    ScanMenuActionResult3
    Scan Menu action result

  3. Save and apply the pattern instance.
    ApplyingK2BMenuPattern
    Applying K2BMenu Pattern

  4. See how the pattern generates a new procedure, called K2BMainMenuStaticMenuLoader.
    GeneratedObjectsK2BMenu
    Generated Static Menu Load Procedure

  5. Open K2BGetUserMenu procedure and add the following code:
    MenuItems2
    Menu Items