On Dec 29, 2006, at 11:03 AM, Charles Yeomans wrote:
On Dec 29, 2006, at 12:46 PM, Chuck Pelto wrote:
On Dec 29, 2006, at 8:18 AM, CV wrote:
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
Perhaps I'm not describing it properly.
I understand the new Window1 approach.
What I'm dealing with here is an existing Window.
I have several Windows.
Window1
Window2
Window3
In Window1 I have declared a property known as relatedWindow as
Window
I set relatedWIndow to Window2 by the following:
relatedWindow = Window2
Then I try to set values of properties, e.g., a string property,
in Window2 via the relatedWindow property by:
relatedWindow.aProperty = "Something or other...."
This does not compile.
The compiler only knows that relatedWindow is of type Window. Thus
it does not recognize any Window2 properties. You can define
relatedWindow to be of type Window2. Or you can cast the reference
as follows.
Window2(relatedWindow).aProperty =
THAT looks like an interesting idea. But I doubt if it will satisfy
what I'm attempting.
I still would have to hard-code in the window somewhere in the system
instead of passing the window name from someplace else in the
application. May as well just use Window2.aProperty = ..... The
relatedWindow is superfluous.
So, I take it that RB has not been modified to accept this sort of
passing of windows.
Too bad.....
Regards,
Chuck
_______________________________________________
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>