Hello,I migrate an application (native code) from V8 2004 to V8i. In the application I have a function synchronising the cursor position in a master view with a slave view. This is done using mdlView_setFunction(VIEW_DRAWCURSOR,...). When the function is set, each times the mouse is moved in the master, the function received the position and we draw a cross representing the mouse position in the slave view.Since VIEW_DRAWCURSOR is deprecated, how can I do the same thing in V8i. I have take a look to the sample called Viewdeco but I cant found my happyness in this code...Many thanks in advance.Philippe HALET
Hi,
You may try your luck with
mdlView_setFunction ( VIEW_MOTION, watchCursorInView );
where:
Private void watchCursorInView
(
MSWindow *windowP, /* window in which motion occurred */
int xCoord, /* current x screen coordinate of cursor */
int yCoord /* current y screen coordinate of cursor */
);
Also you can poll cursor with
mdlSystem_getCursorPosition ( )
HTH
Cheers,
/Chris Z.
Answer Verified By: Philippe HALET
Hi Chris,
I think this is a good way, but I cannot retrieve the "realworld" coordinates using mdlSystem_getCursorPosition(position, ..., dpUorsP).
position is correct but in screen coordinates and dpUorsP comes with strange values...
Do you have another idea to retrieve de coordinates of the mouse in world coordinates ?
Many thanks in advance.
Philippe
Philippe HALET
CEO at beCAD a Gold Channel Partner
It seems the function mdlSystem_getCursorPosition() has a strange behaviour. The coordinates returned in dpUorsP are wrong.
I have found a workaround using "statedata.current.dpUors" to get directly the current world coordinates and this works perfectly for me.
Do you think using directly "statedata" is a good thing ?
Many thanks in advance...
Unknown said:Do you think using directly "statedata" is a good thing ?
In the long term, no: any public global variable is likely to disappear in a future version of MicroStation.
Unknown said:I have found a workaround using "statedata.current.dpUors"
If that works for you in the current version of MicroStation, then go ahead. Put a comment in your code noting the likely demise (fr. disparition) of public global variables.
Regards, Jon Summers LA Solutions
> It seems the function mdlSystem_getCursorPosition() has a strange behaviour. The coordinates returned in dpUorsP are wrong.
Well, I haven't played with this particular function recently, but looking at the sheer amount of workarounds I have for the cursor coordinates in some places I found following alternate hints:
1. Get raw cursor coordinates from Windows Win32 API: GetCursorPos()
2. Obtain the MicroStation position via mdlWindow_globalOffsetGet().
3. Shift the raw coordinates accordingly in order to land within MicroStation's global coordinates space.
4. Use mdlWindow_pointTo...() as necessary
5. Finally use mdlView_screenToPoint () to get into UORs
I think this might be a definition of pain ;)