• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. PCB Design
  3. Help to add a menu item before a separator

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 163
  • Views 14059
  • Members are here 0
More Content
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Help to add a menu item before a separator

EvanShultz
EvanShultz over 12 years ago

I used to use a simple SKILL program that reads in the default allegro.men file from each base release, performs my company customizations, and then reads out the modified file. It worked pretty well and just needed tweaking after each base release was pushed.

With the new release, err, cadence starting with 16.6, the menus are changing fast. When the axlUIMenu* functions were first released they seemed to be borked pretty hard, but I hope they're mature since that seems to be the only reasonable way to go to. (Admittedly, it is far more powerful and I'm anxious to get this working for future maintainability.)

OK, to get started so I wrote a regular prodcedure and called it in allegro.ilint using axlUIMenuRegister commands. Easy as pie. I can get new menu items to pop in above (and only above!) existing menu items.

For example, note that axlUIMenuRegister("save_as" '((Write "write"))) adds "Write" before "Save As...". 

However, I want to add some items before a separator. I don't see any way to uniquely identify a separator in a particular menu, so what to do? Well, since axlUIMenuFind() seems to return an integer, maybe I can just call that and then increment the return value. Nope. Wrapping wrapping axlUIMenuFind() with add1() makes the resulting axlUIMenuInsert() do nothing. 

I see that axlUIMenuInsert(axlUIMenuFind(nil "save_as") "Write" "write") also adds "Write" before "Save As..." if I use axlTrigger() to modify the menu. This also gives me the power to delete menu items, which was easy enough to get working. But I still can't figure out how to add a new item before a menu separator. To take the above example to the next level, how can I add "Write" *after* "Save As..."? There must be a way, right?

  • Cancel
  • eDave
    eDave over 12 years ago

    Hi Evan,

    I have raised this with Cadence so, hopefully, we will see some additional functionality soon. In the meantime here are a couple of routines that might help: 

     defun( DE_UIMenuChangeDisplay (cmdStr, displayStr, "tt")

     let((result, menuId)

    and(

    result = list(nil, sprintf(nil, "Menu item '%s' not found.", cmdStr))

    menuId = axlUIMenuFind(nil, cmdStr)

    result = list(nil, sprintf(nil, "Menu item '%s' not deleted.", cmdStr))

    axlUIMenuDelete(menuId)

    result = list(nil, sprintf(nil, "Menu insert command failed for '%s'.", cmdStr))

    axlUIMenuInsert(menuId, displayStr, cmdStr)

    result = list(t, sprintf(nil, "Menu display change for '%s' succeeded.", cmdStr))

    )

    result

    )) 

    defun( DE_UIMenuInsertBefore (curCmdStr, cmdStr, displayStr, "ttt")

     let((result, menuId)

    and(

    result = list(nil, sprintf(nil, "Menu item '%s' not found.", curCmdStr))

    menuId = axlUIMenuFind(nil, curCmdStr)

    result = list(nil, sprintf(nil, "Menu insert command failed for '%s'.", cmdStr))

    axlUIMenuInsert(menuId, displayStr, cmdStr)

    result = list(t, sprintf(nil, "Menu insertion for '%s' succeeded.", cmdStr))

    )

    result

    ))

     

    defun( DE_UIMenuInsertAfter (curCmdStr, curDisplayStr, cmdStr, displayStr, "tttt")

     let((result, menuId)

    and(

    result = list(nil, sprintf(nil, "Menu item '%s' not found.", curCmdStr))

    menuId = axlUIMenuFind(nil, curCmdStr)

    result = list(nil, sprintf(nil, "Menu insert command failed for '%s'.", cmdStr))

    axlUIMenuInsert(menuId, "temp", "temp")

    menuId = axlUIMenuFind(nil, curCmdStr)

    axlUIMenuInsert(menuId, displayStr, cmdStr)

    result = list(nil, "Menu delete command failed.")

    axlUIMenuDelete(menuId)

    menuId = axlUIMenuFind(nil, cmdStr)

    axlUIMenuInsert(menuId, curDisplayStr, curCmdStr)

    menuId = axlUIMenuFind(nil, "temp")

    axlUIMenuDelete(menuId)

    result = list(t, sprintf(nil, "Menu insertion for '%s' succeeded.", cmdStr))

    )

    result

    )) 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • EvanShultz
    EvanShultz over 12 years ago

    Hi Dave. Thank you! The last function does what it says on the tin. :)

     

    Here's some items I noted after using the last function you posted above:

    1. Typing in both the new and old command name along with each command's displayed name is a lot of work. I don't see another solution, though...

    2. It doesn't work for lists, which makes creating a sub-menu just above a separator difficult or impossible. 

    3. By deleting and re-creating the menu item, the hot key (when pressing Alt in the menu stack) must also be included in the argument. But it's quite painful to do anything but have the user manually handle this.

     

    And more thoughts, which are intended to point out the limitations present in the current menu modification functions provided by Cadence (and to which you partially addressed with your code):

    4. What if I wanted to add a new command around an existing submenu? I only see a way to target inserting menus above a unique command (or below it, with Dave's code). For example, how could I insert a new menu item above or below Setup > Application Mode?

    5. How can I add control over a menu item based on license tier with these SKILL functions? I could do that when I wrote my own menu file, but I don't see how to do that here. I don't need to do it now, but I don't see how it's currently possible.

    6. How can a new menu be added to the very end (right side) of the menu strip? Solution ID 11272754 is interesting, but I don't see how it can be done with SKILL. Combining it with page 529 of algroskill.pdf from v16.6, one might think axlUIMenuInsert(axlUIMenuFind(nil -1) 'popup axlVersion('fullVersion)) could work. But it doesn't. The SPB version is pasted to the left of the Help menu, not the right.

     

    Also, if someone wants to move this thread to the PCB SKILL forum it would be great. I started out involving SKILL, although menu modification is portrayed as being easy and mainstream, but it's moved squarely into the realm (abyss?) of SKILL.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Cadence Guidelines

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information