realbasic-nug
[Top] [All Lists]

Re: Window.Left and WIndow.Top incorrect

To: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Subject: Re: Window.Left and WIndow.Top incorrect
From: Karen <keatk@verizon.net>
Date: Wed, 29 Jul 2009 10:42:36 -0400
Authentication-results: mx.google.com; spf=neutral (google.com: 74.124.194.228 is neither permitted nor denied by best guess record for domain of realbasic-nug-bounces@lists.realsoftware.com) smtp.mail=realbasic-nug-bounces@lists.realsoftware.com
Delivered-to: listarchive@realsoftware.com
In-reply-to: <048D0EFB-D608-4802-99E5-46187B30F447@stretchedout.com>
References: <048D0EFB-D608-4802-99E5-46187B30F447@stretchedout.com>
Reply-to: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Sender: realbasic-nug-bounces@lists.realsoftware.com

On Jul 28, 2009, at 10:16 PM, Greg O'Lone wrote:

I'm attempting to create an autocomplete menu for an editfield (2009r2.1) that appears at the text insertion point and having a problem with the placement of the menu. It seems that when I call TrueWindow.Left and TrueWindow.Top from a subclass of an editfield, I am not getting the coordinates of the window, but the window behind it.

True Window is the wrong approach because it won't work for nested container controls... Put this in a module to calulate ScreenPosition of any RectControl:

Sub ScreenPosition(Extends RectCtrl as RectControl, ByRef ScreenTop as integer, ByRef ScreenLeft as Integer)
  Dim Container as Window

  ScreenTop = RectCtrl.Top
  ScreenLeft = RectCtrl.Left
  Container = RectCtrl.Window

  While  Container IsA ContainerControl
    ScreenTop = ScreenTop + Container.Top
    ScreenLeft = ScreenLeft + Container.Left
    Container = ContainerControl(Container).Window
  Wend

  ScreenTop = ScreenTop + Container.Top
  ScreenLeft = ScreenLeft + Container.Left
End Sub






_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>