This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

customization main menu bar

Hi,

I need to add custom pulldown menu to main menubar of microstation application.

I wrote that code which adds this menu to main menubar:

// --------------------------------- 

Bentley.MicroStation.Application.MenuBar appMenu = Bentley.Microstation.Application.MenuBar.GetApplicationMenuBar();

Bentley.Microstation.Application.PullDownMenu pdMenu = (Bentley.Microstation.Application.Pulldown)appMenu.Menu.get_Item(appMenu.Menus.Count - 1);

 appMenu.InsertPullDownMenu(pdMenu);

 pdMenu = (Bentley.Microstation.Application.PullDownMenu)appMenus.get_Item(appMenu.Menus.Count - 2);

pdMenu.Label = "MyMenu";

MenuItem itm = pdMenu.AppentItem();

itm.Label = "command1";

itm.Enabler = true;

// --------------------------------

this code adds my menu, but how can I attach event handler that will handle clicks on my menu elements?

 

  • st12:

    I wrote that code which adds this menu to main menubar:
    ...
    this code adds my menu, but how can I attach event handler that will handle clicks on my menu elements?

    You've added a Windows menu to MicroStation's main menu bar. A Windows menu generates Windows messages. When a user selects that menu, it sends an application-defined message to the owner of that Window.

    MicroStation has its own messaging system: commands. MicroStation commands are not Windows messages. An MDL application or C# add-in can have its own command table.

    You need a way to catch Windows messages from your menu and translate them into MicroStation application commands. Unfortunately, I don't know a simple way to do that.

    You might be better off using MicroStation's user customisation tools to add menus to MicroStation. You can include commands in the menu resource.

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  • What assemblies did you use to get PullDownMenu?

    Did you try to use mdlInput_setMonitorFunction to catch events?

  • I am new in microstation programming. Can you advise me some books or online sources or other where I will be able to find all information about .net programming  for microstation.

    Thanks
  • st12:

    Can you advise me some books ...

    Here's an article about MicroStation development languages. The languages that Bentley supports formally are C/C++ (with the MicroStation Development Library and MicroStationAPI) and MicroStation Visual Basic for Applications (VBA).

    If you're writing .NET applications, the simplest way is to use the MicroStationDGN COM server through an InterOp. In that case the delivered MicroStation VBA help documentation is invaluable — and it contains lots of examples. If you want to read something off-line, then you can purchase a real book: Learning MicroStation VBA

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  • There are some here on WIKI or in installation directory of MicroStation you can find MicroStationVBA.chm which is reference about functions available in MicroStationDGN Object Library that is usable in .NET as well... If you are new to programming for MicroStation, you have two ways to point to:

    1. MDL
    2. COM
    For more information, you can visit site LA Solutions - MicroStation® Development Languages
  • Jon :))) As always... You won it :))
  • Jon Summers:

     

    MicroStation has its own messaging system: commands. MicroStation commands are not Windows messages. An MDL application or C# add-in can have its own command table.

    You need a way to catch Windows messages from your menu and translate them into MicroStation application commands. Unfortunately, I don't know a simple way to do that.

    You might be better off using MicroStation's user customisation tools to add menus to MicroStation. You can include commands in the menu resource.

    Regards, Jon Summers
    LA Solutions

    I created XML file using sbm2xml.exe program. But how can I attach this file to Microstation? Maybe there are some configuration variables or something like this?

  • st12:

    I created XML file using sbm2xml.exe program. But how can I attach this file to Microstation.?

    There is some information in the SBM2XML "readme" regarding that:

    "Once the conversion is done, the resulting XML file can now be imported into a MicroStation DGNLib that is referenced by the variable MS_GUIDGNLIBLIST. To import the XML file, choose Workspace > Customize and then File > Import XML... from the Customize dialog. After the XML file is successfully imported into the DGNLib, the original SBM menu items will be added to MicroStation's main menu. For more information on this topic, see 'To import template, custom tool, and custom menu data from an XML file' in MicroStation's help file (Help > Contents). "

      

  • You should look in the MicroStation help file under customize.  If you go to the workspace -> customize it will open the tool for editing the DGNLibrary that will allow you to define  menu changes.  If in your AddIn application you have defined keyin commands you can easiliy connect the menu entries to application commands. 

    HTH,

    mark anderson [Bentley]

     

  • Hi,

    I need to add a user button in main menubar of microstation.

    How can i do this .can u help me????