realbasic-nug
[Top] [All Lists]

Re: Passing data to a form.

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Passing data to a form.
From: "Joseph J. Strout" <joe at realsoftware dot com>
Date: Tue, 30 Nov 2004 14:14:48 -0600
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <200411302004 dot iAUK4umm022881 at mac dot com>
At 2:06 PM -0600 11/30/04, Steve Smith wrote:

I'm trying to set a property in a form that I'm calling. In the VB world,
I'm used to using the TAG property for this, so I set a public property  in
window1 with the name gTag and then using the following code.

dim w as new window1
w.gTag = "Title"
w.show

That's a reasonable approach.

However, it appears that the dim w as new window is firing the open sub in
window1.

Right. The Open event fires as soon as the window is opened (which, if the Visible property of the window is not checked in the IDE, is not the same thing as when it appears on the screen).

 I expected the w.show to fire it.

Understandable, but now you know -- Open fires as soon as the window is created. If you want an event that fires when the window appears, you might use Activate (though of course this will also fire when the window is deactivated and then reactivated).

 As a result, the gTag property isn't set when the open sub is run.

True, but why does that matter? If you're doing something in the Open event that depends on the value of gTag, then you either should do that stuff somewhere else (perhaps in an Initialize or Present method that configures the window, and then calls self.Show), or you should use a Constructor that takes any initial values as parameters. The Constructor always fires before the Open event.

Best,
- Joe

--
REAL World 2005 - The REALbasic User Conference
March 23-25, 2005, Austin, Texas
<http://www.realsoftware.com/realworld>
_______________________________________________
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>

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