Re: Window widget events not firing

Alex Russell <[email protected]>
Newsgroups gmane.comp.windows.devel.netwindows
Organization netWindows.org
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 22 July 2003 3:55 pm, Dee Gould wrote:
> The buttons are located within the html page that is being loaded
> into the window widget.  netWindows is being loaded into the parent
> of the iframe ( the window widget ) as well as the iframe itself.

please note that unless you are adding another iframe element into 
your target URL, the contents of the window widget are not in an 
iframe when they display on the page. Just an FYI = )

we do use an iframe to load the content into the page, but the 
contents are subsequently copied into a content area widget, which is 
just a <div> with smarts. We can use all of these properties to our 
advantage in solving your problem.

> It's not a cross-frame or cross-window problem.  Everything being
> loaded into the window widget is self contained and I want the
> window widget to close itself once the cancelButton is clicked. 
> Problem is that the onclick event is not getting fired.

Right. The first problem is that since we don't load things in windows 
into their own iframes (for many reasons, not the least of which is 
memory footprint), a document.getElementById() may not be unique 
should you have multiple windows (or other containers) with that page 
loaded into them. This is a slightly annoying property, but not 
insurmoutable. Instead, netWindows provides you with ways to discover 
your context, and get references to widgets from DOM nodes.

Here's what I'd have your cancelButton call from onClick (directly if 
need be) instead:

onclick="__components__.getComponentFromNode(this).getTopLevelComponent().remove();"

The effect here is to find the component that the current node is a 
child of (the content_area), and use that reference to discover in 
the environment the first parent that has declared it self "top 
level". Windows are by default top level components, and so this then 
calls the remove() method of the window object.

Another way to accomplish the same thing would be:

onclick="__components__.getComponentOfTypeFromNode(this,"window").remove();"

which again discovers an ancestor component from the local DOM node 
and tells it to clobber itself.

Does that help at all?

Regards.

- -- 
Alex Russell
[email protected]
[email protected]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)

iD8DBQE/Ha4koV0dQ6uSmkYRAjyyAKDYch1+woWW1jHY0yBAKVvhQopnAgCgmyRi
5lPk6Z9Xwcdj86t0i+yURQc=
=nepi
-----END PGP SIGNATURE-----


_______________________________________________
The netWindows developers list: [email protected]
http://netwindows.org/mailman/listinfo/devel_netwindows.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.