[CONNECT][C++][.NET] Custom Ribbon Programmatically?

Has anyone created a custom ribbon in CONNECT programmatically yet? If so are you willing to share the code?

Parents
  • Unknown said:
    Has anyone created a custom ribbon in CONNECT programmatically yet?

    Bentley tell us that the user customisation tools, which create a UI in a DGNLib, should be our first port of call.

    If you look in the \MicroStation\Telerik folder, you will see a heap of DLLs in the Telerik namespace.  Visit Telerik to find more about that.  I think their stuff is .NET rather than C++.

     
    Regards, Jon Summers
    LA Solutions

  • Unknown said:
    Bentley tell us that the user customisation tools, which create a UI in a DGNLib, should be our first port of call.

    Correct

    Unknown said:
    If you look in the \MicroStation\Telerik folder, you will see a heap of DLLs in the Telerik namespace.  Visit Telerik to find more about that.  I think their stuff is .NET rather than C++.

    Caution. Bentley licenses Telerik controls for use within our products.  We do not provide Bentley API wrappers for those controls due to our licensing agreement. Direct referencing and linking is discouraged unless a 3rd party developer has an active development license to consume and distribute Telerik controls - for their own applications.



Reply
  • Unknown said:
    Bentley tell us that the user customisation tools, which create a UI in a DGNLib, should be our first port of call.

    Correct

    Unknown said:
    If you look in the \MicroStation\Telerik folder, you will see a heap of DLLs in the Telerik namespace.  Visit Telerik to find more about that.  I think their stuff is .NET rather than C++.

    Caution. Bentley licenses Telerik controls for use within our products.  We do not provide Bentley API wrappers for those controls due to our licensing agreement. Direct referencing and linking is discouraged unless a 3rd party developer has an active development license to consume and distribute Telerik controls - for their own applications.



Children
  • Hi, I'm struggling to find anyone that has successfully implemented their own ribbon in CONNECT. Code examples/samples are non-existent. Has anyone tried this? Has anyone succeeded? Having come from Autodesk APIs I'm used to a vibrant community of developers sharing code and insights. By contrast this forum seems to have a few veterans who know how things should be done in principle, but either haven't got some working code together, or aren't willing to share it. 

  • Unknown said:
    I'm struggling to find anyone that has successfully implemented their own ribbon in CONNECT.

    I did, no problem. It was not complicated application (basically more extension), so I used XML definition plus a couple of Named Expressions in DGNLIB. No problem at all, just followed documentation in MicroStationAPI. Cannot tell anything about to create own sync group or component provider, because I have had not such requirement yet (but I am pretty sure it will come ;-)

    Unknown said:
    Code examples/samples are non-existent.

    Not true, check MicroStationAPI help file.

    Unknown said:
    Has anyone tried this?

    Of course, to try things (and to fail often) is required to learn product(s) and API(s) in detail.

    Unknown said:
    or aren't willing to share it. 

    Please, don't be rude!

    Some people share code snippets, some not. Sometime it's not possible because it's too integrated into other code. And my feeling is that when anybody asks and provides enough information, he receives answer. Especially when it's not in a "give me" style, but "I did this and that, it does not work, what I missed / did wrong?".

    With regards,

      Jan

  • Hi Jan,

    Thank you for the information. I am sorry for my frustration. Now looking at the MicroStationAPI.chm files to attempt it.

  • Unknown said:
    I'm struggling to find anyone that has successfully implemented their own ribbon in CONNECT

    Follow Jan's advice and specify your ribbon tools in an XML data file.  Take a look at MicroStation's built-in customisation tools; they're aimed at MicroStation admins but are equally usable by us developers.

    Unknown said:
    Code examples/samples are non-existent

    Because (a) if you specify a UI with an XML configuration file then you need write no code and (b) customisation in code requires the Telerik API, which is neither licensed (to third parties) nor provided by Bentley Systems. 

    The built-in tools allow you to design a UI that responds to events through the publish symbol sets and expressions that act in response to those symbols.  That's the closest to UI coding that you need approach.  There are a few folks, including Jan, on the MicroStation Forum who have answered questions on that topic.

     
    Regards, Jon Summers
    LA Solutions

  • Unknown said:
    Now looking at the MicroStationAPI.chm files to attempt it.

    Fingers crossed! :-)

    I remember when I played a bit with ribbon xml definition, I was able to create to extend the standard ribbon quite easily with own groups and buttons including context sensitive tabs (displayed when an element is selected).

    Relevant .xsd file is delivered with MicroStation (RibbonDefinitins.xsd), so to create xml file is simpler when xml-capable editors like Visual Studio (or Visual Studio Code).

    With regards,

      Jan

  • Hi Alan,

    We struggled to get the same working but eventually did. so for the benefit of others I'm going to share here.

    1. create a sample xml file (see attached) and save it to eg "C:\TEMP\custom.xml"
    2. create a cfg file (custom.cfg for example) in "%programdata%\Bentley\MicroStation CONNECT Edition\Configuration\Organization" and add the line that points to the created xml. like: MS_RIBBONXML    > C:/TEMP/custom.xml

    thats it

    <?xml version="1.0" encoding="utf-8" ?>
    <RibbonItems xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="RibbonDefinitions.xsd">
      <Workflows>
        <Workflow Name="MyCustomTab" Priority="10000">
          <Label>My Custom Tab</Label>
          <Ribbon>
            <TabCollectionRef>MyCustomTab.TabsCollectionRef</TabCollectionRef>
          </Ribbon>
        </Workflow>
      </Workflows>
      <TabCollections>
        <TabCollection Name="MyCustomTab.TabsCollectionRef">
          <TabRef Name="MyCustomTab.Home" Priority="10000">
          </TabRef>
        </TabCollection>
      </TabCollections>
      <Tabs>
        <Tab Name="MyCustomTab.Home" Priority="100">
          <Label>Custom Tab Home</Label>
          <TabItems>
            <GroupRef Name="MyCustomTab.AttributeGroup" Priority="-10000">
              <GroupParams>
                <GroupLauncherAccessText>1</GroupLauncherAccessText>
                <AccessText>1</AccessText>
              </GroupParams>
            </GroupRef>
            <GroupRef Name="MyCustomTab.ToolsGroup" Priority="-10000">
            </GroupRef>
          </TabItems>
        </Tab>
      </Tabs>
      <Groups>
        <Group GroupZone="Primary" Name="MyCustomTab.AttributeGroup" PanelType="Collapsible" Priority="100">
          <Label>Custom Tab Group</Label>
          <Icon Type="NamedIcon">
            <NamedIcon>RibbonGroupPrimary</NamedIcon>
          </Icon>
          <GroupParams>
            <AccessText>PP</AccessText>
          </GroupParams>
          <GroupItems>
            <ButtonRef Name="MyCustomTab.SomeAction" Priority="10000">
              <ButtonParams CollapseToSmall="WhenGroupIsSmall" Size="Large">
                <AccessText>RE</AccessText>
                <PopupAccessText>E</PopupAccessText>
              </ButtonParams>
            </ButtonRef>
          </GroupItems>
        </Group>
      </Groups>
      <Buttons>
        <Button Name="MyCustomTab.SomeAction" Priority="100">
          <Label>Some Action</Label>
          <Description>Do Some Action</Description>
          <ButtonParams CollapseToSmall="WhenGroupIsSmall" Size="Large">
          </ButtonParams>
          <ButtonData>
            <CommandData Type="UserKeyinCommand">
              <UserKeyinCommand>
                <Keyin>somekeyin</Keyin>
                <Icon Type="NamedIcon">
                  <NamedIcon>Application</NamedIcon>
                </Icon>
              </UserKeyinCommand>
            </CommandData>
          </ButtonData>
        </Button>
      </Buttons>
    </RibbonItems>

  • I had no idea you could use xml to create the ribbons, so thanks for that.

    Why not just do it in the dgnlib though?

  • Hi Maury,

    I had no idea you could use xml to create the ribbons

    it's described in MicroStationAPI documentation from very early beginning ;-)

    Why not just do it in the dgnlib though?

    Because there are better and wider functionality available when ribbon is defined using xml.

    With regards,

      Jan

  • Hi Maury,

    Why not just do it in the dgnlib though?

    to extend my brief former answer, why I prefer to use xml instead of dgnlib to define ribbon:

    • It's exact and pure: There is xsd available, so it's quite simple to write correct xml using a proper editor with automatic offer of possible xml elements and attributes (e.g. Visual Studio support it) . Disadvantage of this approach is: It's pure ;-)
    • Full control what and how is defined.
    • Access to more types of GUI objects (I have not done exact comparison, but I guess there are more object types available than in ribbon customization tool).
    • Possibility to define merging rules (what to do when the same object is defined already).
    • Possibility to consume sync events (in many scenarios it remove requirement to use awfully slow ribbon rebuild).
    • Possibility to create ContextualTabSet without a line of code (tab displayed when a specific event is raised like a table is selected).

    There are more option, but I have had not enough time to test things like compilation xml to rsc (the format how MicroStation default ribbon is delivered), define own XCommand etc.

    Regards,

      Jan