Position of field on screen

Mark Phillips mark.phillips at mophilly.com
Fri Aug 29 11:50:05 EDT 2014


On Aug 27, 2014, at 4:40 PM, Bastiaan Olij <bastiaan at basenlily.me> wrote:

> I need to know the location of a field on my window in screen
> coordinates so I can open a window at that exact location.


Bas,

Here is a bit of code I use to place a popup menu precisely over a window control. Perhaps it will give you an idea that will work in your case. 

In this example, $cobj is (obviously) the control receiving the event. swMainPanel is a subwindow, and $cobj is an element of another subwindow displayed by swMainPanel. $cwind.$framehwnd is the "inside" edge of the grafport.

$cwind
	swMainPanel
		mySubwindowClass
			$cobj

==========================
On evClick     ;; Event Parameters - pRow( Itemreference )
	Calculate x as offset+$cobj().$left()+$cwind.$objs.swMainPanel.$left()+$cwind.$framehwnd.$ref().$left()
	Calculate y as offset+$cobj().$top()+$cwind.$objs.swMainPanel.$top()+$cwind.$framehwnd.$ref().$top()

	Popup menu from list findlist at x,y
==========================

Regards,

 - Mark

I want to die peacefully in my sleep like my grandfather, not screaming in terror like his passengers.






More information about the omnisdev-en mailing list