How to reference the parent window? 
Author Message
 How to reference the parent window?

I have, let's say, 5 windows, A, B, C, D, E, and from one of those windows I
open another window, lets say M.

From M, I want to call a method in the window that opened M, but I don't
know whether it is ABCD or E. Is there a simple way to know this without
using globals.

I thought that there was a property something like "caller," where I could
access a method that resides in the first window from M  with something
like:

caller.method

But I can't find it. Does it exists? Thanks.

Bill Mounce
Teknia Software



Sat, 25 Jan 2003 03:00:00 GMT  
 How to reference the parent window?

Quote:

> I have, let's say, 5 windows, A, B, C, D, E, and from one of those windows I
> open another window, lets say M.

sub mywindow.call(w as window)
dim e as windowE

if w isa windowE then
e=windowe(w)
'now work with e as you want.
e.method

end if
end sub

And you call it with:

thewindow.call self

--
- Macs sind fr die, die nicht wissen wollen, warum Ihr Rechner funzt.
- Linux ist fr die, die wissen wollen, warum er funzt.
- DOS ist fr die, die wissen wollen, warum er nicht funzt und
- Windows ist fr die, die nicht wissen wollen, warum er nicht funzt.



Sat, 25 Jan 2003 03:00:00 GMT  
 How to reference the parent window?

Quote:

> From M, I want to call a method in the window that opened M, but I don't
> know whether it is ABCD or E. Is there a simple way to know this without
> using globals.

Sure.  Make a property on M that stores this info.  Then, the window
that opens in stuffs (a reference to) itself into this property.  Job
done!

Quote:
> I thought that there was a property something like "caller"...

Nope.

Cheers,
-- Joe

--
,------------------------------------------------------------------.
|    Joseph J. Strout         Check out the Mac Web Directory:     |

`------------------------------------------------------------------'



Sat, 25 Jan 2003 03:00:00 GMT  
 How to reference the parent window?

Quote:

> I have, let's say, 5 windows, A, B, C, D, E, and from one of those windows I
> open another window, lets say M.

> From M, I want to call a method in the window that opened M, but I don't
> know whether it is ABCD or E. Is there a simple way to know this without
> using globals.

> I thought that there was a property something like "caller," where I could
> access a method that resides in the first window from M  with something
> like:

> caller.method

> But I can't find it. Does it exists? Thanks.

> Bill Mounce
> Teknia Software

Make a property in window M called Caller as WhateverKindOfWindowOpensM.
Then when A-E open M, they do:

m.Caller = me

Then whenever M needs to deal with the window that called it, you can do
Caller.Method.

--
"In a world full of lies / Which tug at the truth
 I'm taking no sides.. Now I recognize you."
                                               -DS



Sat, 25 Jan 2003 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Referencing parent windows-more confusion.

2. tk_getOpenFile ... -parent locks up parent window

3. Parent references: hot or not?

4. Q: Accessing a window's parent window

5. Copying grand parent, parent, and child records

6. MDI or Parent windows with VAST

7. How to get a windows parent screen?

8. Update parent window

9. Get Window's Parent Screen?

10. Error: No Parent Frame for DLL Child MDI window

11. How to disable parent window.

12. parent windows's size and position

 

 
Powered by phpBB® Forum Software