• 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. Custom IC SKILL
  3. Adding new item to already created custom menu (for all...

Stats

  • Locked Locked
  • Replies 3
  • Subscribers 143
  • Views 14908
  • Members are here 0
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

Adding new item to already created custom menu (for all Layout Editor windows)

Sheppy
Sheppy over 10 years ago

Hello,

I am working on a library that contains many macro functions to automate certain parts of the layout. Depending on the need, per project some macro's will be needed/loaded, and some won't. All these macro's must be available in a pull-down menu, which will be available in all layout editor windows. All macro's will be loaded at start-up of Virtuoso, and I want to include in that code a part that adds a menu item for that particular macro.

One menu item is always loaded, so I used that to generate the menu. I have copied the code of: http://community.cadence.com/cadence_technology_forums/f/48/p/20591/1304715#1304715 to generate the menu and this single item.

For this topic, I'd like to refer to the aforementioned topic and the code as posted by Andrew. See below:


procedure(AmitAddMenu(args)
  let( (item1 item2)
    ;; create a couple of menu items
    item1 = hiCreateMenuItem( ?name 'item1 ?itemText "My First Item"
              ?callback "AmitFunctionOne()"
            )
    item2 = hiCreateMenuItem( ?name 'item2 ?itemText "My Second Item"
              ?callback "AmitFunctionTwo()"
            )
    ;; create a menu that includes the menu items and return a list of the
    ;; pulldown menus
    list(hiCreatePulldownMenu('AmitMenu "Amit Menu" list(item1 item2)))
  );let
); procedure
;; create a userMenuTrigger trigger that automatically adds the menu
deRegUserTriggers("maskLayout" nil 'AmitAddMenu)


So lets say, I load this code and get in all layout editor windows the menu with the two options.

How do I get a third item in this pull-down menu by code loaded at start-up of Virtuoso (this code will be loaded after the code with the two options of course)?

Thank you in advance.

With kind regards,

Sjoerd

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 10 years ago

    Hi Sjoerd,

    There are several ways that this could be done, but I would probably do your second function as a userPostInstallTrigger rather than a userMenuTrigger (this is the fourth argument for deRegUserTriggers()). The code would not create and return a new pulldown menu, but instead modify the existing pulldown menu. So something like this (note this is just typed in and not tested at all):

    ;;; Procedure for the STM Macro! This is for optional macros.
    procedure( sstSTMAddLayoutEditorMacroMenuItem( _args )
         let( ( item3 )
            ; only add the new item if it is not there already
            when( boundp( 'sstMacroMenu ) && !sstMacroMenu->item3
                item3=hiCreateMenuItem(
                            ?name 'item3
                            ?itemText "My Third Item"
                            ?callback "printf( \"Option 3 clicked...\n\" )"
                        )           
                hiAddMenuItem(sstMacroMenu item3)           
            ) ;;; end of when
        ) ;;; end of let
    ) ;;; end of procedure sstSTMAddLayoutEditorMacroMenuItem

    deRegUserTriggers( "maskLayout" nil nil 'sstSTMAddLayoutEditorMacroMenuItem )

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 10 years ago

    Hi Sjoerd,

    There are several ways that this could be done, but I would probably do your second function as a userPostInstallTrigger rather than a userMenuTrigger (this is the fourth argument for deRegUserTriggers()). The code would not create and return a new pulldown menu, but instead modify the existing pulldown menu. So something like this (note this is just typed in and not tested at all):

    ;;; Procedure for the STM Macro! This is for optional macros.
    procedure( sstSTMAddLayoutEditorMacroMenuItem( _args )
         let( ( item3 )
            ; only add the new item if it is not there already
            when( boundp( 'sstMacroMenu ) && !sstMacroMenu->item3
                item3=hiCreateMenuItem(
                            ?name 'item3
                            ?itemText "My Third Item"
                            ?callback "printf( \"Option 3 clicked...\n\" )"
                        )           
                hiAddMenuItem(sstMacroMenu item3)           
            ) ;;; end of when
        ) ;;; end of let
    ) ;;; end of procedure sstSTMAddLayoutEditorMacroMenuItem

    deRegUserTriggers( "maskLayout" nil nil 'sstSTMAddLayoutEditorMacroMenuItem )

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

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