Home All Groups Group Topic Archive Search About

Re: UIPAB - how to obtain a reference to a parent window from another

Author
16 Nov 2004 8:29 PM
Juan
Thanks Stijin... i will work on it and see what comes out!

Show quote
"Stijn Guillemyn" <StijnGuille***@discussions.microsoft.com> escribió en el
mensaje news:DED37303-3A65-433F-BD07-A1A532CDB133@microsoft.com...
> Hi Juan,
>
> I had the same problem, I wanted to know when my menu was the active view,
> because this form may not be closed before all other forms where closed.
My
> problem was, knowing when a particular form (my menu) was the only active
> view...
>
> If you look at the source code, you will see that Microsoft provides you
> with an interface. The IShutdownUIP - interface. A view that implements
this
> interface can then register for shutdown. This means that you can ask UIP
to
> call a particular function on this form (the function that is defined in
the
> interface) when the number of active views reaches 0. The code in you
> implementation of the Shutdown() method will then be executed. You can see
> how this mechanism works in the source code of the UIPManager. Here you
> should specifically look at the following methods: RegisterShutdown,
> OnCompletion and NotifyShutdownListeners.
>
> I have implemented a similar mechanism by creating my own UIPManager,
called
> MyUIPManager, and instead of checking if the number of active views is
> greater than 0, I do the following. In my RegisterForCallback function I
> register the view that I get as a parameter, but with this registration I
> also add the current number of active views. The view that wants to
register
> must implement my own ICallback interface, by which I make this form
> implement a method called executeCallback(). In the OnCompletion method of
> MyUIPManager I extend the existing code by running through the active
views
> and checking if the current number of active views equals the number of
> active views they were registered with. If it does, I call the
> executeCallback() method they had to implement when using the ICallback
> interface.
>
> If you take some time to look at the described methods, I'm sure you can
> construct such a solution for your problem!
>
> Good luck ;)
>
> It is simpler than this long explanation. It's not always easy to describe
> such solutions. I find describing some code never is...
>
> If you didn't understand something, or need some more help, just reply to
> this post, I will keep my eyes open for it...
>
> One final thought, you should be aware that this system might not be 100%
> certain, I'm afraid. I haven't got any problems for now, but if an
exception
> occurs in the dialog form, I'm not sure if the callback will be performed
as
> wanted...
> Better solutions are welcome!
>
> "Juan" wrote:
>
> > I use a pupup window (navigate to a modal view, keping the parent
visible)
> > to ask for some values, after that, when closing the pupup, I navigate
back
> > to the parent view. I don´t know how to fire an event when the parent
window
> > is again the active one, or how to call a method in the parent window
> > immediately after closing the popup...
> >
> > any clue is very welcome!
> >
> > thanks.
> >
> >
> >

AddThis Social Bookmark Button