K2BTools Tutorial - Exercise 11.2 - Using the generated menu

In the previous exercise we introduced the K2BMenu pattern, and used it to create a menu structure. Now we need to use it in our application so that it appears in runtime.

The K2BMenu pattern, as mentioned before, creates a procedure that loads all the menu’s data into an SDT. This SDT is used by an User Control (K2BAccordionMenu) to load the menu options. That user control is already used in the KB’s Master Page. The SDT is loaded from a procedure K2BGetUserMenu. K2BGetUserMenu by default loads the SDT from K2BListPrograms procedure.

We will now update the Master Page so that is uses our newly created menu. Follow these steps:

  1. Open the K2BGetUserMenu procedure
  2. Go to the Source part.
  3. Replace the code shown on the left, with the code shown on the right. By doing this, you will change how the User Control loads the menu options.


    &MenuItems = K2BListProgramsToMultiLevelMenuSDT(&ListPrograms)

    &MenuItems = K2BMainMenuStaticMenuLoad.Udp()
    Old Code New Code
  4. Run the application, and see the result.