Position of field on screen

Michael Monschau michael at brainydata.co.uk
Thu Aug 28 03:01:38 EDT 2014

Hi Bas,

You may be able to calculate it via ref.$framehwnd.$left and ref.$framehwnd.$top. But again these are the co-ordinates local to the parent container. So you will need to use ref.$container to traverse to the window and add the windows $framehwnd.$left or $framehwnd.$top. This should give you a more accurate screen position, but I don't remember how accurate. On the mac I remember complications with the menu bar height and desktop, and on Windows there is the application window. 

In the end, you may have to resort to writing an external function. But have a go using $framehwnd first, it may give you what you need.


Michael Monschau (Director)
Brainy Data Limited

Reply To: michael at brainydata.co.uk
Phone: +44 (0)870 474 0708
Web: www.brainydata.co.uk the home of Omnis Components and Developer Services

On 28 Aug 2014, at 05:07, Bastiaan Olij wrote:

> Hi Kim,
> Nope, those only give me the position of the field within its current
> container, so if I want the position on screen I would have to add the
> left and top position of its container, and its container, and possibly
> traverse further down, and then the window, and add any top/left
> toolbars, take into account scrollbar positions of the various
> containers, take into account any container that is a tabpane, take into
> account the size of borders of all the containers, not to mention that
> those sizes change depending on the OS and that certain things have a
> size that can change depending on content without Omnis providing me
> with that info (tab panes with a double row of headers for instance).
> I've written such logic before but it is a dog to maintain whenever a
> new OS comes out. It would be so neat to just have a function that gives
> me the screen coordinates of a field. I was hoping that someone found a
> way to do so. I know there is a function in the XCOMP SDK that allows me
> to get to this info if I provide it with the HWND of the field (I may
> add such a function to my external if all else fails) but I find it hard
> to believe it is not part of Omnis somewhere.
> Cheers,
> Bas
> On 28/08/14 1:32 PM, Kim Sumner wrote:
>> Hi Bas
>> $cfield.$top & $cfield.$left will give you coordinates location within
>> $cwind
>> Regards
>> Kim Sumner
>> Corporate Windows Pty Ltd, AUSTRALIA
>> Tel:    + 61-3-5338-8232
>> Mobile: 0419-561-496
>> Skype:  corpwin
>> Web:    http://www.corporate-windows.com
>> -------------------------------------------------------------------
>> WebPublisher Studio - Share your data with the World
>> http://www.webpublisherstudio.com
>> -------------------------------------------------------------------
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com

More information about the omnisdev-en mailing list