11-23-2010 11:57 PM
Hello,
Hope by the "NewCtrl()" function to generate a picture ring control on a canvas when clicking the canvas control.
Using the "GetRelativeMouseState(panelHandle, CANVAS_ID, &xCoor, &yCoor, NULL, NULL, NULL); " to get the mouse click coordinate, then using NewCtrl() to generate the control, but the picture ring cannot be placed on the click position. How to get the right position?
David
11-24-2010 06:12 AM
This is the expected behaviour: GetRelativeMouseState gives coordinates referred to the canvas (command help clarifies it: "xCoordinate and yCoordinate return the position of the mouse relative to the top and left coordinates of a specific control"), while you must set the control in absolute panel coordinates.
If you are handling a click event, you can use eventData parameters that holds mouse coordinates, this way:
controlID = NewCtrl (panel, CTRL_NUMERIC_LS, 0, eventData1, eventData2);