On Mar 07, 2007, at 22:04 UTC, Tim Jones wrote:

> On Mar 7, 2007, at 2:35 PM, [EMAIL PROTECTED] wrote:
> 
> >>>   self.Close
> >>>   self.Show
> >>
> If we take this example OUT of the actual Window instance and put it 
> into a module, the result is that the WIndow "will" reappear, but  
> it's not the same instance of the window that was previously closed. 
> The result is that you've actually created a NEW instance of that  
> window.

That's not because you've put it in a module; that's because you're no
longer using a single reference to the window.  Your sample code:

>       Window1.Close
>       Window1.Show

..is calling the Window1 global function.  I see that a lot of people
here don't understand this, so let's try to be clear about it.  For
every window in your project, a global function of the same name is
created for you by the IDE.  The gist of this global function is
roughly: "If the global implicit instance of Window1 is not open, then
create and open it.  Return a reference to this global implicit
instance."

So, your code above first calls Window1, gets a reference to the window
that's open, and closes it (which also sets the hidden global reference
to nil).  Then, you call the Window1 function again, which creates a
new instance of Window1, and returns a reference to that, which you
show.

To prove that this has nothing to do with showing a window that's been
closed, keep your own reference to it:


   Dim w as Window = Window1
   ...
   w.Close
   w.Show

Here, you've got the reference.  "w" is just a simple variable, and
can't change values from one line to the next (unlike, say, the result
of a function call!).  You'll find that the window w refers to does not
reappear.  Once a window is closed, it can't be reopened or shown.

Cheers,
- Joe

--
Joe Strout -- [EMAIL PROTECTED]
Verified Express, LLC     "Making the Internet a Better Place"
http://www.verex.com/

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

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

Reply via email to