[CONNECT C++] mdlWindow_globalPointToScreen(). Is there an C++ API equivalent?

Is there a method on a DgnButtonEvent to accomplish the same thing?

UpdatePosition(DgnButtonEventCR ev)
	DPoint3d		screenPt3D = { 0 };
	ev.GetViewport()->ViewToScreen(&screenPt3D, ev.GetViewPoint(), 1);	// Transfrom an array of points in DgnCoordSystem::View into DgnCoordSystem::Screen.
	Point2d			globalPt = { (int)screenPt3D.x, (int)screenPt3D.y };
	Point2d			screenPt2d = { 0 };

    // Can I do this somehow directly without calling mdlWindow_globalPointToScreen() ?
	mdlWindow_globalPointToScreen(&screenPt2d, mdlWindow_viewWindowGet(ev.GetViewNum()), &globalPt);	// Converts a point in global coordinates to a point in screen coordinates for the screen number specified by windowP.


  • // note: you can use the following corrected code piece to get pure windows screen point for the button event.

           // both pointInMDLclient and globlePoint are in a window coordinates which is relative to a window rect.

           // as you said, Viewport::ViewToScreen don't return screen point in fact.

           // please focus on the using of mdlWindow_globalPointConversionIncrease which is the key point here.

           // other changes just rename the variable names to make it's meaning more accurate.






           // ev.GetViewPoint returns the mouse position of client area of the view window,

           // Viewport::ViewToScreen returns the point which is relative to left-up corner of a special client window which

           // is the gray area to contain the 8 view windows. The special client window is like the Win32

           // MDClient for multi-document program.


           DPoint3d            pointInMDLclient3D = { 0 };

           ev.GetViewport ()->ViewToScreen (&pointInMDLclient3D, ev.GetViewPoint (), 1);

           Point2d                    pointInMDLclient = { (int)pointInMDLclient3D.x, (int)pointInMDLclient3D.y };


           // in CE, because there is ribbon bar, we must convert the pointInMDLclient to global point which is relative to

           // the left-up corner of the main frame window.


           Point2d         globlePoint = { 0 };

           MSDialogP viewWindow = mdlWindow_viewWindowGet (ev.GetViewNum ());

           if (mdlWindow_isGlobalPointConversionRequired (viewWindow->GetScreenNumber ()))

               mdlWindow_globalPointConversionIncrease (&globlePoint, viewWindow, &pointInMDLclient);


               globlePoint = pointInMDLclient;


           // now use mdlWindow_globalPointToScreen to convert the global point to screen point which is pure windows concept

           // but not the Microstation concept, and I don't think there is equivalent C++ method in DgnButtonEvent or other class


           Point2d                    screenPt2d = { 0 };

           mdlWindow_globalPointToScreen (&screenPt2d, mdlWindow_viewWindowGet (ev.GetViewNum ()), &globlePoint);

  • That is what I'm currently doing. You have confirmed my suspicions:

    I don't think there is equivalent C++ method in DgnButtonEvent or other class

    Thanks !!

    Answer Verified By: Bruce Reeves SRNS 

Reply Children
No Data