[Integration Kit Contents] [Integration Kit What's New] [Integration Kit Function Index] [More Documentation] [PTC]

Command Specific Context Menu

sd-set-cmd-specific-context-menu-entries
sd-set-curr-cmd-additional-context-menu-entries

Function Index Top of Page

SD-SET-CMD-SPECIFIC-CONTEXT-MENU-ENTRIES  [function]

(sd-set-cmd-specific-context-menu-entries command contents)
Description:
Defines a set of buttons to be shown in the command specific context menu if the user clicks the right mouse button while the command is active. If there are any commands defined for the current active command, you'll notice this by a special mouse cursor.

Note: If you call this function while the command specified as command is not active or suspended, you'll define the set of command specific context menu entries in a static way, i.e. every instance of the command will have these command specific context menu entries.
If you call this function while command is active or suspended, you'll assign the command specific context menu entries just for this one (if more, then the most recent) instance of the command, i.e. if you call the same command a second time without calling this function for this command, no command specific context menu entries will be specified.

Note 2: If there are some context menu entries defined for a command and this command employs a subaction like SELECT or MEASURE DIRECTION 3D which itself has context menu entries defined, the resulting command specific context menu is a composition of all these commands starting with the most recent subaction commands at the top followed by further subaction or calling action commands separated by a separator.

Parameters:
command {STRING}
Name of the command for which you set command specific context menu entries. The command must exist at the call time of this function.
contents {LIST of lists}
Specification of the command specific context menu entries.
It is a list of any of the following entries in any number or order:
  (:pushbutton :title        title 
               :pushAction   action
               :image        image 
               :description  description
               :enable       enable-form
               :isVisible    visible-form)
title {STRING} - Button label to be displayed
pushAction {STRING or LISP form}
Executed if the users hits the button. If this parameter is a string, the string is passed to the enter command line and executed. This is the same as if you would type in that string. If you specify a LISP form, this form is executed immediately when you click this button.
image {STRING}
Basename of an icon file (BMP) including a relative path. The image will be looked up in the following directories:
'user/site/corp/sd-dirs'/bitmaps/bmp/commands
description {STRING}
An optional additional text which will appear in the status line if you hover over the button with the mouse cursor. If not given the button title will appear in the status line.
enable {LISP form [t]}
A LISP expression which should evaluate to T or NIL. The result of this form determines whether the button in the context menu is enabled (enable form returns T) or disabled (greyed out).
isVisible {LISP form [t]}
A LISP expression which should evaluate to T or NIL. The result of this form determines whether the button in the context menu is visible (isVisible form returns T) or invisible.
  (:togglebutton :title          title
                 :pushAction     push-action
                 :releaseAction  release-action
                 :image          image
                 :description    description
                 :enable         enable-form
                 :isSet          is-set-form
                 :isVisible      is-visible-form)
title {STRING} - Button label to be displayed
pushAction {STRING or LISP form} - Same as above
releaseAction {STRING or LISP form}
Same as pushAction but executed on release of the button. If not given, pushAction is executed if you release the togglebutton.
image {STRING}
Same as above. Please note, if you specify an image for a tooglebutton, no check mark will appear in front of the button label if the button is set. Instead the icon will look pressed in.
description {STRING} - Same as above
enable {LISP form [t]} - Same as above
isSet {LISP form}
A LISP expression which should evaluate to T or NIL. The result of this form determines whether the button in the context menu is set (isSet form returns T), i.e. has a check mark, or has no check mark.
isVisible {LISP form [t]}
A LISP expression which should evaluate to T or NIL. The result of this form determines whether the button in the context menu is visible (isVisible form returns T) or invisible.
  (:separator :isVisible is-visible-form)
A horizontal line (separator) to group commands visually.
isVisible {LISP form [t]}
A LISP expression which should evaluate to T or NIL. The result of this form determines whether the separator in the context menu is visible (isVisible form returns T) or invisible.
  (:submenu :title     title
            :contents  contents
            :isVisible is-visbile-form)
Creates a cascading submenu entry where the submenu itself can contain the same type of entries as described for this function.
title {STRING} - Label to be displayed on the button which opens the submenu
contents {LIST of lists}
Specification of the submenu entries. This again can be a list of any entries possible for contents as described above.
isVisible {LISP form [t]}
A LISP expression which should evaluate to T or NIL. The result of this form determines whether the button in the context menu is visible (isVisible form returns T) or invisible.

Return Value:
t - success
nil - failure

Example:
(sd-set-cmd-specific-context-menu-entries 
   "extrude"
   '((:pushButton :title "Part" :pushAction ":sel_part"
                  :image "SolidDesigner/Part_Assy/new_part")
     (:pushButton :title "Workplane" :pushAction ":wp"
                  :description "Specify workplane with valid profile to extrude."
                  :image "SolidDesigner/Workplane/wp_new")
     (:pushButton :title "Distance" :pushAction ":distance")
     (:separator)
     (:submenu :title "Options"
               :contents ((:togglebutton :title         "Keep WP"
                                         :pushAction    ":keep_wp :yes"
                                         :releaseAction ":keep_wp :no"
                                         :isSet         *extrude-keep-wp*)
                          (:togglebutton :title         "Keep Profile"
                                         :pushAction    ":keep_profile :yes"
                                         :releaseAction ":keep_profile :no"
                                         :enable        *extrude-keep-profile-enabled*
                                         :isSet         *extrude-keep-profile*)))))

Function Index Top of Page

SD-SET-CURR-CMD-ADDITIONAL-CONTEXT-MENU-ENTRIES  [function]

(sd-set-curr-cmd-additional-context-menu-entries contents :change-cursor change-cursor)
Description:
Allows you to dynamically add additional command specific context menu entries for the current command. If the current command had no command specific context menu yet, it will have one after this call.

Parameters:
contents {LIST of lists}
Specification of additional command specific context menu entries which should appear at the top and/or bottom of the existing context menu of the current command.
The specification is a property list of the following form:
   (:top     top-contents-list
    :bottom  bottom-contents-list)
top-contents-list and bottom-contents-list are of the same form as described in sd-set-cmd-specific-context-menu-entries parameter contents.
To get rid of the additional commands again, call this function again and pass nil as top and/or bottom contents list.
:change-cursor {BOOLEAN [t]}
Flag to indicate whether the mouse cursor should change to see that there exists a command specific context menu or not.

Return Value:
t - success
nil - failure

Example:
(sd-set-curr-cmd-additional-context-menu-entries 
   '(:bottom 
     ((:pushButton :title "Modeling Settings"
                   :pushAction (elan-ui::show-modeling-settings-ui)))))
[Integration Kit Contents] [Integration Kit What's New] [Integration Kit Function Index] [More Documentation] [PTC]
© 2019 Parametric Technology GmbH
(a subsidiary of PTC Inc.), All Rights Reserved