Results 1 to 7 of 7

Thread: [RESOLVED] Submenu Items

  1. #1

    Thread Starter
    Frenzied Member Andrew G's Avatar
    Join Date
    Nov 2005
    Location
    Sydney
    Posts
    1,587

    Resolved [RESOLVED] Submenu Items

    Hi all
    This is probably a really easy question, and i can solve it using APIs but i hope for a simplier way.

    Normally when creating new menu items you can make an array then load new menu items as you need. Now what i need to do is add submenus to menus. I'm adding plugins to one of the programs, and so i create a new menuitem for the plugin. But i'd also like to create submenu items for the menu item.

    Plugins
    ...Plugin1
    ......item 1 < Loaded (no problems)
    ......item 2 < Loaded (no problems)
    ...Plugin2 < Loaded (no problems)
    ......item 1 < Loaded (problem)

    So simply. How do i set the parent of a menu item

    Thanks

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Submenu Items

    If you want to use control array of menus then each member must be part of the same group - think of a group as of items/subitems. So, in your sample Item1 from Plugin2 is different from Item1 that's part of Plugin1.
    In short, each group of control array must have unique name. Try doing that in design so you will see how it actually works.

  3. #3

    Thread Starter
    Frenzied Member Andrew G's Avatar
    Join Date
    Nov 2005
    Location
    Sydney
    Posts
    1,587

    Re: Submenu Items

    I understand that its best if they have different names, except since i do not know the number of plugins that could be loaded, i was going to differentiate between each submenu using the index. By using "Item 1" i just meant the position as the first menu item, sorry for the confusion. So is there a way to ceate a new submenu items in a newly created menu item? Or should i just use another method?

  4. #4
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Submenu Items

    I'm afraid I didn't explain it clearly:

    - Plugin1 and Plugin2 are two menu items withing the same menu level (despite they both are members of some control array)
    - menu subitems under different menu items cannot part of the same control array so they have unique names (not captions)

    Having said that here is how it works:
    Code:
    mnuFile
        |_ mnuItem1(0)
                |_ mnuSubItem1(0)
                |_ mnuSubItem1(1)
                |_ mnuSubItem1(2)
        |_ mnuItem1(1)
                |_ mnuSubItem2(0)
                |_ mnuSubItem2(1)
                |_ mnuSubItem2(2)
    Again, in short: you cannot have mnuSubItem1(3) under mnuItem1(1) - as shown above there is a new name - mnuSubItem2. And this goes for each level of menus - control array is allowed within the same level only.

  5. #5

    Thread Starter
    Frenzied Member Andrew G's Avatar
    Join Date
    Nov 2005
    Location
    Sydney
    Posts
    1,587

    Re: Submenu Items

    Ah i misunderstood you before, but i've got it now. So that complicates the problem a bit further though. So i suppose there is no way to add the new menu items/subitems at runtime, without using components or APIs.

  6. #6
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Submenu Items

    Well, if number of items is known then you may create them in design and hide, also for each item you may create one subitem with index zero - but again, that is only if you know how many items you will need or at least approximately (say between 10 and 15 or so).
    If you, however, cannot even guess then APIs is the way to go.

  7. #7

    Thread Starter
    Frenzied Member Andrew G's Avatar
    Join Date
    Nov 2005
    Location
    Sydney
    Posts
    1,587

    Re: Submenu Items

    Yeah, i guess i'll just have to settle for APIs. Thanks for your help and the info on the menus

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width