question

Steven Chen avatar image
0 Likes"
Steven Chen asked Matthew Gillespie answered

Conditional disable context menu button

Hello,

I am working on custom context menu. How do you disable context menu button wihle no object selected?

right-click-on-nowhere.png


FlexSim 22.1.1
custom gui
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

·
Matthew Gillespie avatar image
0 Likes"
Matthew Gillespie answered

The Perspective view has an OnMenuPopup node (VIEW:/standardviews/documentwindows/Perspective>eventfunctions/OnMenuPopup)

that uses code like this:

var popupMenu = getviewmenu(c, 4);
treenode selObj = selectedobject(c);
int validSelObj = objectexists(selObj) && selObj.dataType == DATATYPE_OBJECT;
int editMenuIndex = menupopup(c).subnodes["Edit"]?.rank - 1;
menugray(popupMenu, editMenuIndex, !validSelObj);
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.