I have a few custom ribbon buttons i've added but need them to "see" changes in the results of Named Expressions to do things like change buttons from displaying "Enabled" to "Disabled", etc. eg. I click a button to load AutoTurn and the button changes to "Unload Autoturn" or i want to toggle a setting and want it to tell me the state of that setting. I can get all this info in Named Expressions, but can't get a "Sync Item Event" to be triggered on demand outside of the Model, Selection Set, View or Primitive tool changed options that are there in the Customize Ribbon Dialog.
For toolbars i can do this easily by adding the command "TASK RELOAD" to the button command, but the only equivalent i can find for ribbons is "RIBBON REBUILD".
The problem with this is that a ribbon rebuild naturally takes 2 seconds to complete, but i was looking for something lighter that just triggers a reload of ribbon visibility/enable expressions.
OpenRoads Designer 2021 R2 (10.10) | Microstation CE Update 16.2 | ProjectWise CE 3.4
I guess you use standard "user level" ribbon customization through Customize ribbon dialog?
Mark Shamoun said: like change buttons from displaying "Enabled" to "Disabled"
In ribbon definition, enable/disable state of ribbon controls is defined by so called Feature aspect settings.
Mark Shamoun said:eg. I click a button to load AutoTurn and the button changes to "Unload Autoturn"
I guess there is (maybe) some way how to change button caption (text) using API, but more straightforward way is to swap buttons (using Show Expression configuration), first to hide and second to show ;-)
Mark Shamoun said:or i want to toggle a setting and want it to tell me the state of that setting.
What ribbon control do you use? There is Toggle button available in ribbon definition, but I think it is not available in GUI customization and (unfortunately) I did not use it yet, so I have no experience how it works.
Mark Shamoun said:but can't get a "Sync Item Event" to be triggered on demand outside of the Model, Selection Set, View or Primitive tool changed options that are there in the Customize Ribbon Dialog.
There are pre-defined set of sync events that can be received by ribbon controls. There are much more available (I think about 140), when ribbon is defined through xml/rsc definition, but often what is needed, is missing ;-)
When application is well-written for CE, it may raise of sync item, and it is also possible to implement own one.
Mark Shamoun said:Any ideas?
There is no simple solution available in my opinion. When you want to implement complex customization, you must use xml definition (using SDK documentation and plenty of testing) with properly defined FeatureAspect and ShowExpression. Unfortunately, when it's not clear what and if particular sync item can be used, it requires lengthy testing or to implement own one.
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Looks like I have done the best i can do using the "Customize Ribbon" interface and would need to go down the API route. I'll add an Idea to the Ideas page and see if it ever makes it way in.
FYI here's what i'm trying to accomplish. Although its for ORD, base PowerPlatform functionality is the same. Just looking for a more seamless implementation (noting the instant Toolbar upldate, but the lagged Ribbon one as it needs to rebuild the entire ribbon).
OpenRoads Designer 2022 R3 (10.12) | Microstation 2023.1 | ProjectWise CE 3.4
Mark Shamoun said:Looks like I have done the best i can do using the "Customize Ribbon" interface
I think you are right. Customize Ribbon tool is good for basic customization (so it covers the most of standard requirements).
In my opinion it's good that there are 2 different ways available: One simple for users, and the second, more complex, allowing complete definition.
Mark Shamoun said:and would need to go down the API route
Maybe "API route" is misleading term a bit, because the definition itself does not depend on API at all. It's just xml file, that must be created manually (and compiled to .rsc optionally). The biggest issue here is is to create xml in the right way, on the other hand xsd is delivered with MicroStation installation.
Until own sync event is needed, no coding is required.
Mark Shamoun said:FYI here's what i'm trying to accomplish.
AccuSnap switch is good example: When you want to visualize a state (e.g. using ToggleButton), you always need two "inputs":
From MicroStation SDK documentation, AccuSnap toggle button looks like this (I did not test whether it is correct ;-)
<ToggleButton Name="Mstn.DawingAids.Snaps.ToggleAccuSnap" Priority="100">
As you mentioned already, to obtain state is not problem, but to find the right sync even can be a problem, and in certain situations, to implement own "sync event(s) provider" is necessary.
Jan Šlegr said:From MicroStation SDK documentation, AccuSnap toggle button looks like this
Just to be clear, what Jan has shown you is a data file example. It's written using XML. The XML conforms to the rules specified in an XML Schema (.xsd) file. The XSD file (and several others) is delivered with MicroStation: RibbonDefinitions.xsd.
You don't do anything with the XSD other than reference it in your favourite XML editor (XML Spy, Notepad++, etc) while authoring your Ribbon Customisation XML file. The editor checks the XSD rules to verify your XML syntax.
Some people misinterpret XML and HTML as code, and think they have to be a programmer to write them. Granted, they look as if a cat just walked across the keyboard, but that doesn't mean you need to be a coder to understand or write them. Bentley Systems don't help by putting the best documentation about Ribbon Customisation in the MicroStationAPI help file.
Probably the best place to post questions about Ribbon customisation is the Administration Forum.
Regards, Jon Summers LA Solutions