General XMetaL Discussion

XMetaL Community Forum General XMetaL Discussion How to control where a new top level menu item lands

  • dcramer

    How to control where a new top level menu item lands

    Participants 0
    Replies 1
    Last Activity 12 years, 8 months ago

    Hi there,
    I'm adding a new top level menu from a script:

    [code]
    var cmdBars = Application.CommandBars;
    var menuBar = cmdBars.item(“Menu bar”);
    var newTopMenu = menuBar.Controls.Add(5,,8); // Syntax error
    newTopMenu.Caption = “&BroadBook”;
    // add more items here.
    [/code]

    How can I make it land after the Windows menu and before the Help menu? When I add 8 as the third param, I get a syntax error.  I must not understand the reference docs:

    “CommandBarControls_object.Add([intControlType], [variantCmdId], [variantBefore], [variantParam]);”

    “variantBefore is a number that indicates the position of the new control in the collection; the new control is inserted before the control at this position. If this argument is omitted, the control is added at the end of the specified command bar. “

    Thanks,
    David

    Reply

    dcramer

    Reply to: How to control where a new top level menu item lands

    Nevermind. I found that if I add any number as the second param, then it works:

    [code]
    var newTopMenu = menuBar.Controls.Add(5,1,8);
    [/code]

    The docs say “variantCmdId is an integer that specifies a built-in command to clone; if this argument is omitted, a blank custom control of the specified type is added to the command bar. “

    It appears that you cannot omit this param. I'm not clear on what it does if I make the second param a 1 versus a 3.

    Thanks,
    David

    Reply

  • You must be logged in to reply to this topic.

Lost Your Password?

Products
Downloads
Support