• 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. Allegro X Scripting - Skill
  3. How can I build a popup menu and add a separator line in...

Stats

  • Replies 0
  • Subscribers 17
  • Views 138
  • Members are here 0
More Content

How can I build a popup menu and add a separator line in Allegro SKILL?

JuanCR
JuanCR 2 days ago

This article focuses on a specific code snippet (provided below) that demonstrates adding a menu and separator using the Allegro SKILL program.

(procedure myShowElement ()

      mypopup = axlUIPopupDefine(nil

            (list (list "Done" 'axlFinishEnterFun)

                  (list "Cancel" 'axlCancelEnterFun)

                  (list "MENU_SEPARATOR" nil)

                  (list "Hello" 'hello))

)

      axlUIPopupSet(mypopup)

      axlSetFindFilter(?enabled list("NOALL" "ALLTYPES" "NAMEFORM") ?onButtons "ALLTYPES")

      while(axlSelect()

      axlShowObject(axlGetSelSet())

))

In Allegro SKILL, the axlUIPopupDefine() function is used to create and configure popup menus. It specifies name-value pairs to define the menu name and associated actions within the menu.

For example, the menu item “Done” is tied with the Allegro SKILL function “axlFinishEnterFun” and the menu name “Hello” with the user-defined procedure "hello", which prints “hello”.

mypopup = axlUIPopupDefine(nil

            (list (list "Done" 'axlFinishEnterFun)

                  (list "Cancel" 'axlCancelEnterFun)

                  (list "MENU_SEPARATOR" nil)

                  (list "Hello" 'hello))

           )


Action for the Menu items
 

The axlFinishEnterFun() function terminates the waiting process for a user-selected point. It returns either t or nil depending on the success or failure of the user selection. It is like clicking “Done”.

The axlCancelEnterFun() function serves a similar purpose to axlFinishEnterFun() in terminating the waiting process for a user-selected point. It functions as a cancelation action, like clicking the "Cancel" option.

(procedure hello()

  printf("hello")

)


Showing the Context Menu

 

To make a specific popup menu active, the returned identifier from axlUIPopupDefine() is passed to the axlUIPopupSet() function. This ensures that the menu is displayed and ready for user interaction.
 

Adding a Separator in the Context-Sensitive Menu
 

A separator in GUI visually divides menu items and improves the overall readability and organization of the menu.

To add a separator to the popup menu, you must include a particular menu item called "MENU_SEPARATOR" in the list of menu items in the axlUIPopupDefine function, as shown below.

In the axlUIPopupDefine() function, a sublist is created with the label "MENU_SEPARATOR" and a `nil` value. This label is recognized to add a separator in the popup menu. The `nil` value is used as a placeholder since no action is associated with the separator.

mypopup = axlUIPopupDefine(nil

            (list (list "Done" 'axlFinishEnterFun)

                  (list "Cancel" 'axlCancelEnterFun)

                  (list "MENU_SEPARATOR" nil)

                  (list "Hello" 'hello))

            )

When the popup menu is displayed, Allegro SKILL interprets the "MENU_SEPARATOR" item and visually separates it from the other menu items with a horizontal line.

The provided code demonstrates creating the menu item and including a separator in a popup menu using the Allegro SKILL language. By understanding this concept, developers can enhance the user experience of their GUI applications by making menus more intuitive and visually appealing.

  • Sign in to reply
  • 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