I develop plugins for the OpenCities Map PowerView CONNECT Edition application with C++.
From one of my plugin I use the mdlInput_sendKeyin() function to trigger a feature in another plugin developed by me also. I want to log every keyin commands which was sent in the plugins.
In the MdlMain() function of each plugins I tried to use the StateCallback::SetKeyinFunction( onKeyInEvent ) function to set my callback function where I implemented the logic which do the logging related stuff.
Unfortunately my onKeyInEvent() function is never called.
How can I make this callback functionality working?
Please ask in the Microstation Programming Forum.
What version (e.g. v10.x.y.z) of MicroStation, and Bentley Map, are you using?
Ferenc Bolla said:In the MdlMain() function of each plugins I tried to use the StateCallback::SetKeyinFunction( onKeyInEvent ) function
Post your code! Show us your MdlMain and your onKeyInEvent.
MdlMain
Regards, Jon Summers LA Solutions
Hi Ferenc,
isn't simpler to use command table at receiver side, and e.g. to parse key-in content inside the application?
In my opinion a general rule (not only in MicroStation) is "callback is always wrong", in another words "use callbacks only when it's really necessary and no another solution is available".
To use callback means that MicroStation has to add extra step for every key-in entered, whereas command tables are core MicroStation functionality.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
HI Ferenc,
onKeyInEvent is called only for "unhandled" keyins.
This is what you are looking for: InputFilterReturnValue preprocessKeyinFunction( WCharP keyinP ) { // write your logger code here
return INPUT_ACCEPT; }
And call SetPreprocessKeyinFunction from MdlMain function:
InputCallback::SetPreprocessKeyinFunction( preprocessKeyinFunction );
source: www.bimsdks.com/.../group__InputHandling.html
Attila