0 Replies Latest reply on Feb 12, 2008 8:38 AM by Newsgroup_User

    Using Buddy Menu

    Level 7
      I was struggling with using some of the more 'advanced' functions of
      Buddy Menu. Specifically I was trying to use bmCheckItem to check an
      item in a sub menu. I search the archives and didn't find answer. I did
      finally get it to work, so I thought I might post the solution I found.

      Here is what seems like it should work, but does not. The menu is
      created, but Item 1-1 is not checked as desired. It appears that you can
      not directly check an item in a sub menu, although I didn't see anything
      to that effect in the documentation.

      menu = bmCreateMenu()
      bmAppendItems( menu, ["Item 1",["Item 1-1","Item 1-2"],"Item 2"])
      bmCheckItem(menu, "Item 1-1")
      ItemSelected = bmShowMenu( menu, 16)
      bmDestroyMenu( menu )

      What does work is to create the sub menu as another menu instance, and
      attach it to the main menu. A bit more coding is required.

      menu = bmCreateMenu()
      bmAppendItems(menu, ["Item 1","Item 2"])
      item1submenu = bmCreateMenu()
      bmAppendItems(item1submenu, ["Item 1-1","Item 1-2"])
      bmCheckItem(item1submenu, "Item 1-1")
      bmAttachSubMenu(menu, "Item 1", item1submenu)
      ItemSelected = bmShowMenu(menu, 16)
      bmDestroyMenu(menu)
      bmDestroyMenu(item1submenu)