08-15-2012 04:22 PM
Hi All,
I need to know the position of the control on the front panel wrt the screen and not the panel. Currently if I have a graph on a FP and I use the property "Position", it returns the top and the left poisiton of the control wrt the panel. I need the position of the control on the screen and not the panel.
How can I get that information?
Thanks,
Ritesh
Solved! Go to Solution.
08-15-2012 05:41 PM - edited 08-15-2012 05:47 PM
You need to take the position of the front panel (use the FP panel bounds) and then take the position of the control so add both the top and the left values of the positions, there you go you got the position of the control with respect to screen.
Note: While doing this keep the origin of the FP left and top exactly meeting the panel edges so that you can get the actual position.
08-16-2012 07:28 AM - edited 08-16-2012 07:29 AM
Here's a snippet of some code I had. This code was used to click a control using Windows calls. I knew where the controls were on the front panel, so those are the constants. But this should get you 90% there.
08-16-2012 09:10 AM
Ok, I believe to get the actual position of the controls, I have to set the position of the panel to (0,0) and keep the edges of the window also to (0,0). And if I don't set these positions before hand, it won't be possible to get the acutal position of the control.
Thanks!
08-16-2012 10:02 AM
You can use this. Unfortuneately it can cause a flicker when it runs because it has to briefly hide the menubar and the toolbar. If it didn't, the vertical coordinate would be off by an amount equal to the height of the menubar + toolbar.