Re: how can i get a component from nwAppId
Alex Russell <[email protected]> Mon, 26 Jul 2004 10:41:49 -0700
| Newsgroups | gmane.comp.windows.devel.netwindows |
|---|---|
| Organization | netWindows.org |
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Monday 26 July 2004 10:22 am, salva wrote: > hi, congratulations, great code. > > how can i get a component from nwAppId Components can (optionally) be given the nwAppId property on their inline constructors which will create a variable in the global namespace with the name specified in the attribute value and a reference to the component itself. This means that if I create, say, a button, I can locate it via nwAppId like: <!-- in the HTML --> <div nwType="button" nwAppId="foo" /> // in the JS: foo.componentType == "button"; Note: the variables that correpsond to components will only be (safely) available AFTER onLoad fires in the document. Note 2: you can easily shoot yourself in the foot by giving multiple components the same nwAppId, since the last one will overwrite the reference set in earlier constructors. netWindows will internally give components unique Ids which can be used to locate components either from nodes or programatically. nwAppId is a circumvention of this system and therefore the uniqueness garuntees that NW would otherwise provide no longer apply. Let me know if you need more information. Regards - -- Alex Russell [email protected] BD10 7AFC 87F6 63F9 1691 83FA 9884 3A15 AFC9 61B7 [email protected] F687 1964 1EF6 453E 9BD0 5148 A15D 1D43 AB92 9A46 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (Darwin) iD8DBQFBBUJdoV0dQ6uSmkYRAkWkAJ9GnclBq2wH0RpnA6b9+XgpDU4nEwCeP8Il 1+WOuA7DdsMLN8M0mN1LghM= =DpNP -----END PGP SIGNATURE----- _______________________________________________ The netWindows developers list: [email protected] http://netwindows.org/mailman/listinfo/devel_netwindows.org