CONNECT Ribbon Rebuild on Element Selection?

Hi all,

Does anyone know of a way to initiate a "ribbon rebuild" command upon selection of any element?

I have some named expressions to display different ribbon tabs based on element selection, but need a way to initiate the ribbon reload.

I'm hoping to avoid a VBA running in the background monitoring clicks.

Regards,

Mark

  • Hi Mark,

    Mark Shamoun said:
    Does anyone know of a way to initiate a "ribbon rebuild" command upon selection of any element?

    To use "ribbon rebuild" should be the last option and to use it together with the element(s) selection is quite bad idea. To rebuild the ribbon is a complex process (involving e.g. processing of thousands of XML lines with ribbon defitions) and it can easily require a second or more to be finished. So every change of the selection set will consequnetly blocks MicroStation.

    Mark Shamoun said:
    I'm hoping to avoid a VBA running in the background monitoring clicks.

    Fortunately it's not required in this case, but in general VBA is not right tool to monitor anything. It provides very limited monitoring functionality, but VBA processing is not efficient (which is natural feature of VBA), so to use VBA to monitor events like "model content was changed" leads to slowing MicroStation. Native C++ code is the right solution if a tight integration is necessary.

    Mark Shamoun said:
    I have some named expressions to display different ribbon tabs based on element selection

    Using Ribbon Customization tool, you can set item (e.g. button) to be reevaluated automatically based on Sync Item Event setting. So it's possible to create ribbon with changing (show/hide) buttons accordingly to selected elements.

    It's possible to apply automatic evaluation also for other ribbon objects (like a group or the whole tab), but it cannot be done "graphically" using customization tool, but you have to create ribbon definition as XML file and to use MS_RIBBONXML configuration variable to include your customization to MicroStation ribbon definition. Using this approach you can define e.g. own workflow, where tabs are displayed acoordingly to selection set content (when a proper Named Expressions are used).

    Ribbon XML files also allows to create Contextual Tab Sets that are tabs not belonging to a specific worklfow. An example can be tab displayed when Table is selected: Layout tab is displayed regardless the current worklow is Drawing, Task Navigation or whatever else.

    Ribbon XML concepts and syntax are described in MicroStation SDK documentation (MicroStationAPI help file). There is even RibbonDefinition.xsd file available as a part of MicroStation installation, so if a proper editor is used, XML file is checked for correct formal syntax and structure. But it's still not simple task, because the whole structure (tabs, groups, buttons...) have to be defined manually. On the other hand, it can be simplified exporting existing customization to XML file, because regardless it's not exactly Ribbon XML definition, the values can be copied directly.

    With regards,

      Jan

    Answer Verified By: Mark Shamoun 

  • Thanks Jan, I'll look in to it

    Regards,

    Mark


    OpenRoads Designer 2023  |  Microstation 2023.2  |  ProjectWise 2023