Home > Community > Forums > PCB Design > Help to add a menu item before a separator

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 Help to add a menu item before a separator 

Last post Mon, Aug 19 2013 7:31 PM by EvanShultz. 2 replies.
Started by EvanShultz 17 Aug 2013 08:01 PM. Topic has 2 replies and 642 views
Page 1 of 1 (3 items)
Sort Posts:
  • Sat, Aug 17 2013 8:01 PM

    Help to add a menu item before a separator Reply

    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?

    • Post Points: 20
  • Sun, Aug 18 2013 1:14 PM

    • eDave
    • Top 10 Contributor
    • Joined on Sun, Jul 13 2008
    • Christchurch, 00-NZ
    • Posts 744
    • Points 16,115
    Re: Help to add a menu item before a separator Reply

    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

    )) 

    Dave Elder, Tait Communications
    • Post Points: 20
  • Mon, Aug 19 2013 7:31 PM

    Re: Help to add a menu item before a separator Reply

    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.

    • Post Points: 5
Page 1 of 1 (3 items)
Sort Posts:
Started by EvanShultz at 17 Aug 2013 08:01 PM. Topic has 2 replies.