AW: Re: Position of field on screen

Udo Sonnabend U.Sonnabend at
Thu Aug 28 08:18:56 EDT 2014


Some modified code, originating from Master Object Framework (Marc Smit)...

While prObject
Calculate left as left+prObject.$left
If prObject.$gridsection=kGridRow
If prObject.$gridcolumn>1
Calculate left as left+prObject.$container().$dividers.[prObject.$gridcolumn-1].$posn
End If
Calculate left as left+prObject.$gridcolumn     ;; Korrektur, pro Spalte ein Pixel dazu
End If
Set reference prObject to prObject.$container
If prObject
If prObject.$objtype<>kComplexGrid     ;; Korrektur, nicht im Grid
Calculate left as left+prObject.$hwnd.$ref().$left-prObject.$framehwnd.$ref().$left
End If
If prObject.$objtype=kTabPane
Calculate left as left+3    
End If
End If
End While
Quit method left

While prObject
Calculate top as top+prObject.$top

If prObject.$gridsection=kGridRow
Calculate top as top+((prObject.$container().$firstsel-1)*prObject.$container().$rowheight)

If prObject.$container().$showheader
Calculate top as top+prObject.$container().$headerheight+2     ;; (nicht getestet mit showheader)
End If
If prObject.$container().$showhorzheader
Calculate top as top+prObject.$container().$horzheaderheight+2
End If
End If

Set reference prObject to prObject.$container
If prObject
If prObject.$objtype<>kComplexGrid     ;; Korrektur
Calculate top as top+prObject.$hwnd.$ref().$top-prObject.$framehwnd.$ref().$top
End If
If prObject.$objtype=kTabPane
Calculate top as top+27     ;; in Tests andere Masse ermittelt 
End If
End If
End While
Quit method top

Hope that helps, may be offsets have to be changed..
Regards, Udo.

-----Ursprüngliche Nachricht-----
Von: omnisdev-en-bounces at [mailto:omnisdev-en-bounces at] Im Auftrag von brian.os at
Gesendet: Donnerstag, 28. August 2014 14:02
An: omnisdev-en at
Betreff: Re: Re: Position of field on screen

   Hi Bas,

   I guess  you don't have the option of using mouseo=r() to help...?

   I've used this in the past to open special wind=s at the

   current mouse position, but I gather that in your

   case the mouse is not necessarily over your field...


   brian o'sullivan; bear, DE

   O=8/28/14, Michael Monschau<michael at> w=te:

   Hi Bas,
   You  may  be  able  to  calculate  it  via=f.$framehwnd.$left  and
   ref.$framehwnd.$top. But again these are the co-o=inates local to the
   parent container. So you will need to use ref.$contai=r to traverse to
   the window and add the windows $framehwnd.$left or $fram=wnd.$top. This
   should give you a more accurate screen position, but I don= remember how
   accurate. On the mac I remember complications with the menu�r height and
   desktop, and on Windows there is the application window. 
   In the end, you may have to resort to writing an external functio= But
   have a go using $framehwnd first, it may give you what you need.
   Michael Monschau (Director)
   B=iny Data Limited
   Reply To: [1]michael at
   Phone: +44 (0)870 474 0708
   Web: [2] home of Omnis Components and Developer
   On 28 Aug 2014, at 05:07, Bastiaan Olij wrote:
   > Hi Kim,
   > Nope, those only give me the position o=he field within its current
   > container, so if I want the positi= on screen I would have to add the
   > left and top position of its=ntainer, and its container, and possibly
   > traverse further down=nd then the window, and add any top/left
   > toolbars, take into a�ount scrollbar positions of the various
   > containers, take into a�ount any container that is a tabpane, take into
   > account the siz=f borders of all the containers, not to mention that
   > those siz= change depending on the OS and that certain things have a
   > size=at can change depending on content without Omnis providing me
   > =th 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 =enever a
   > new OS comes out. It would be so neat to just have a f=ction that gives
   > me the screen coordinates of a field. I was ho=ng that someone found a
   > way to do so. I know there is a functio=n the XCOMP SDK that allows me
   > to get to this info if I provid=t with the HWND of the field (I may
   > add such a function to my =ternal if all else fails) but I find it hard
   > to believe it is n= part of Omnis somewhere.
   > Cheers,
   &g= Bas
   > On 28/08/14 1:32 PM, Kim Sumner wrote:
   >= Hi Bas
   >> $cfield.$top & $cfield.$left =ll give you coordinates location within
   >> $cwind
   >> Regards
   >> Kim Su=er
   >> Corporate Windows Pty Ltd, AUSTRALIA
   >> Tel: + 61-3-5338-8232
   >> Mobile: 0419-561-496
   = Skype: corpwin
   >> Web: [3]
   >> -------------------------------------------=----------------------
   >> WebPublisher Studio - Share your dat=ith the World
   >> [4]<=>
   >> ---------------------------------------------------------=--------
   > ___________________________________________=________________
   > Manage your list subscriptions at [5]
   Manage your list subscriptions at [6]


   1. file://localhost/tmp/3D"ma   2. =""/
   3. =""/
   4. 3D"http://www.w=
   5. 3D""/
   6. 3D""/
Manage your list subscriptions at

More information about the omnisdev-en mailing list