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: Greg O'Lone <rbnuglist@stretchedout.com>
Date: Wed, 29 Jul 2009 14:25:32 -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: <28648C61-3E4B-41F7-91E2-A99B55D4E697@xochi.com>
References: <048D0EFB-D608-4802-99E5-46187B30F447@stretchedout.com> <3A1798A9-5105-450C-A220-10F5D8E82C52@xochi.com> <CF7C7E87-5990-4C26-B5E9-4BD6DAC61D8A@stretchedout.com> <28648C61-3E4B-41F7-91E2-A99B55D4E697@xochi.com>
Reply-to: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Sender: realbasic-nug-bounces@lists.realsoftware.com
On Jul 29, 2009, at 12:30 pm, Michael Diehr wrote:

On Jul 29, 2009, at 6:19 AM, Greg O'Lone wrote:
triggerAutoComplete
dim x,y as integer
x = me.left
y = me.top
// figure out global coordinates
x = x + self.left
y = y + self.top

Problem is that because this is a subclass of an editfield self.left and self.top are returning the top/left corner of the control... not the window.

I thought "self" was always the owner window (which may be a ContainerControl). What you are describing sounds like "Super.left"...odd.

Michael,

Try this:

Create a new project
Add a class and make it's super Editfield
Edit the new class, in the Open event, add the following code:

  dim x,y as integer

  x = self.left
  y = self.top

  break

Add an instance of this class to Window1 and position it at 0,0

Run the app. When it breaks, you'll find that x and y are both zero because in this case, self refers to the class which is why I'm trying to use TrueWindow.

Greg

_______________________________________________
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>