On Dec 29, 2006, at 6:19 AM, Chuck Pelto wrote:

Greetings All,

Has REALbasic developed a variable that can be used to hold a reference to a Window?

I asked this about a year ago as it seemed to me that such a capability would be beneficial for creating reusable objects; instead of having to hardwire in a window reference you established the variable as a property and then loaded that property with whatever window you wanted to refer to.

Happy New Year....


As described above, this has always been possible and is commonly done. Perhaps you're suggesting a new wrinkle that I'm not grasping:

Add a property to Window2, for example:  MyWindow as Window1

Then initialize it as you wish, for example:

MyWindow = new Window1  // MyWindow now holds a ref to Window1

Then you can access Window1 elements within Window2 as: self.MyWindow.Whatever.

Or, from outside Window2 as: Window2.MyWindow.Whatever


If you want a more generic property, dim the property in Window2 as:

    MyWindow as Window

You can assign any Window instance to MyWindow, and access any element of the Window as for example:

    MyWindow.Top = 5

But if you want access to a unique element that you have added to say, Window1, then you need to cast MyWindow to a Window1:

If MyWindow IsA Window1 then
 Window1(MyWindow).MyWindow1Method
End


Best,

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

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to