We have customized the ribbon by adding a new button into the ribbon tab. Now we want to connect our custom dialog created using MFC to it.
Is there any API for getting the event while clicking that button ?
In the above screenshot the status and About are the buttons which were added and we need event while clicking the same..
Thanks,
Rama. Shrinivasan
Hi Rama,
Rama Shrinivasan said:We have customized the ribbon by adding a new button into the ribbon tab.
How did you customize the ribbon? Using user "ribbon customization" tool or you add own ribbon definition in xml / rsc?
Rama Shrinivasan said:Is there any API for getting the event while clicking that button ?
I recommend to study available documentation, especially Ribbon chapters in MicroStation API help.
Rama Shrinivasan said:and we need event while clicking the same..
I think no such event is necessary. Standard approach, used also by MicroStation, is to use key-ins. So e.g. "About MicroStation" button would be equal (to call) "dialog aboutustn" key-in.
Alternatively, as described in documentation, button can be defined not as UserKeyinCommand, but also as NamedCommand (XCommand) or ApplicationRefCommand, but there is not too much information about these options. And to use key-in is convenient and follows MicroStation best practices and style.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Hi Jan,
Thanks for the response.
Jan Šlegr said:How did you customize the ribbon? Using user "ribbon customization" tool or you add own ribbon definition in xml / rsc?
Yes. We customized using the user ribbon customization tool.
Could you give any sample on how to use key-in & NamedCommand ?
Any specific chapter in documentation where I can refer for those topics in detail.
in addition to Jan, it could also help to add your app to your configuration like: "MS_CMDTABLE_LOAD > [NameOfYourAppWithoutExtension]"
Mit freundlichen Grüßen / Best regards Volker Hüfner
| AB_DATE Engineering Software | ab-date.de |
void Open (WCharCP unparsedP) { AfxMessageBox("Open Status"); } MdlCommandNumber commandNumbers[] = { {Open, CMD_OPEN}, 0 }; if (SUCCESS != mdlSystem_registerCommandNumbers(commandNumbers)) { AfxMessageBox("Fail to register command numbers"); } if (NULL == mdlParse_loadCommandTable(NULL)) { AfxMessageBox("Fail to load command table"); }
We have added the above code.
Hi Volker,
Volker Hüfner said:in addition to Jan, it could also help to add your app to your configuration like: "MS_CMDTABLE_LOAD > [NameOfYourAppWithoutExtension]"
Added this configuration still unable to get the key-in command.
Rama Shrinivasan said:We have added the above code
Where? mdlSystem_registerCommandNumbers and mdlParse_loadCommandTable(nullptr) should be in your MdlMain() function.
mdlSystem_registerCommandNumbers
mdlParse_loadCommandTable(nullptr)
MdlMain()
Rama Shrinivasan said:we don't see any key-in command in the MSTN UI after loading the application
Where are you looking for your app's key-in commands?
Regards, Jon Summers LA Solutions
Rama Shrinivasan said:We have added the above code.
And what is your command table definition in .r file?
Regards,
Jon Summers said:Where? mdlSystem_registerCommandNumbers and mdlParse_loadCommandTable(nullptr) should be in your MdlMain() function.
Yes, it is inside the MdlMain() .
Jon Summers said:Where are you looking for your app's key-in commands?
After loading the application in the key-in dialog
Regards.
Jan Šlegr said:And what is your command table definition in .r file?
//------------------------------------------------------------------------------------- // Register Application and DLL //------------------------------------------------------------------------------------- #define DLLAPP_hc_microstation 1 DllMdlApp DLLAPP_hc_microstation = { L"hc_microstation", L"hc_microstation" // taskid, dllName } /*----------------------------------------------------------------------+ | | | Local Defines | | | +----------------------------------------------------------------------*/ #define CT_NONE 0 #define CT_STATUS 1 #define CT_OPEN 2 /*----------------------------------------------------------------------+ | | | Main (Root) command word table | | | +----------------------------------------------------------------------*/ CommandTable CT_STATUS = { { 1, CT_OPEN, DIALOGOPEN, REQ | HID, "Open" } }; /*----------------------------------------------------------------------+ | | | CT_OPEN subtable | | | +----------------------------------------------------------------------*/ CommandTable CT_OPEN = { { 1, CT_NONE, INHERIT, NONE, "status" } };
When you tell, that your root key-in "open" should be hidden, I guess it is not a big surprise it is not displayed as available key-in. It seems MicroStation does exactly what you ask it to do ;-)
regards,
Answer Verified By: Robert Hook
Rama Shrinivasan said:Jon Summers said:Where are you looking for your app's key-in commands? After loading the application in the key-in dialog
The key-in dialog is where you enter commands. If you key-in a valid command, it will be recorded in the history shown in that dialog.
MDL application key-ins are shown when you click the Key-Ins button on the Applications dialog.
Hi Jon & Jan,
It works now. As suggested by Jan removed the HID.
Thanks & Regards,
Rama.Shrinivasan