Personal tools
You are here: Home Forum Extension of the platform How to get object manager items into dynamic popup menus?

How to get object manager items into dynamic popup menus?

Up to Extension of the platform

How to get object manager items into dynamic popup menus?

Posted by Timo Siltala at April 19. 2017

How can one get the object manager items included into dynamic popup menus, so that when an item is added into ObjectManager, a corresponding menu item and action is created to popup menus and removed if the OM item is removed? Problem is that popup menus are populated in module constructor early before DataObject creation when the OM is empty and I can't figure out how to add them afterwards any more. Is this possible at all or should one stick to static menus only?

Another question: how is the red color created for referenced items in OM. I tried refEntry() but couldn't get it working in a controlled way, so the solution might be another method. Studying SMESH didn't make me any wiser. Could someone give a reference where to look for an example.

Thanks again,

Timo

Re: How to get object manager items into dynamic popup menus?

Posted by Vadim SANDLER at April 20. 2017

Hello Timo,

I provided instructions about how to fill in the popup menus with custom items in this thread:
http://www.salome-platform.org/forum/forum_12/566235055

The idea is to create actions, put them into the popup mamager and assign rules.

What you only need is to write correct rule(s) for each popup menu item, so it would be shown only for specific conditions (i.e. specific type of data object).

For this purpose you can set two different rules to the same popup menu item - to control its visibility and enabled/disabled state. All this is done in a "selection" class where you are responsible for analyzing the current selection and calculation of corresponding variables which you use in your popup rules.

That's all.

Regaridng color of item. For standard data model (based on SALOMEDS obejcts) red color is automatically used for "reference" items. To do this, data item has to be specifically set up.

For data model which is not based on SALOMEDS (e.g. for "light" modules), it is much easier to manage color of an item. You just need to implement the color() method of your DataObject's class. You can also control font properties, status tip, what's this information, and other properties of the data item. See GUI_SRC/src/SUIT/SUIT_DataObject.* for more details.

Regards,
Vadim.

 

Powered by Ploneboard
Document Actions