Getting co-ordinates for low-level events when testing Custom Controls
One of the most frustrating parts of creating tests that rely on low-level events is getting the co-ordinate offsets of the objects you want to interact with. The attached small program - getMousePos - should ease this frustration considerably by getting the offsets for you. There are two caveats with this:
1. If you are trying to get co-ordinates against the desktop to action objects in the application then either the application must be full-screen or alternatively, it can be relied upon to always appear in the same place and at the same size.
2. If you are trying to get offsets from objects within the application then the application must always appear as the same size. Placement on screen does not matter in this case. This setup is illustrated below.
Mouse Position uses the top left corner of the monitor as the absolute position to work from. If you want to get the rectangle co-ordinates of a object then proceed as follows:
1. Identify the top left corner of the child container and select ctrl+tab to freeze the display
2. Select 'Copy To Offsets' to transfer the co-ordinates to the X and Y offset boxes. The X Pos and Y Pos boxes will now use these co-ordinates as the starting point
3. Select 'Start Tracking' and move to the lower right corner of the object
4. Select ctrl+tab to freeze the display again
5. The display will now give you the x and y offset and the size of the rectangle required for the SilkTest RECT parameter
6. Select 'Show Rectangle' to get the absolute co-ordinate set.
Selecting 'Move to Pos' will move the mouse cursor to X Pos and Y Pos relative to any X Offset and Y Offset.
Required: dotNet Framework 4.0 or later.
This utility is provided 'as-is' and is not supported by Micro Focus.