Re: ?
Alex Russell <[email protected]> Fri, 26 Sep 2003 10:14:20 -0500
| Newsgroups | gmane.comp.windows.devel.netwindows |
|---|---|
| Organization | netWindows.org |
| Message-ID | <[email protected]> |
On Friday 26 September 2003 05:00, you wrote: > Hi Alex, > > I still need to know how I can adress widgets that I have created with > inline c'tors, for example a split pane, programmatically. Is there an > index array with references to the objects? If not, could one be added? > Maybe one indexed by a special nwproperty tag? Sorry, guess I forgot to answer that. As it turns out, this is a recurring problem for app authors, and one we solve in a slightly kludgy way. There is indeed an extra property for inline ctors that allows you to specify a variable name (in the global namespace) that will contain a reference to the widget in question. So here's the simplest example I can think of: <div nwType="button" nwAppId="myButton" nwProperties="placement: inline;" text="foo" width="100" height="15"></div> Once the widget is instantiated, there would be a variable called myButton available for scripts to use. It would contain a reference to the widget object (not the DOM node). Problems with this approach include an inability to gurantee uniqueness, so if you're automatically generating inline ctors and wind up using this method to "find" a widget in a page instead of using __components__.getComponentsOfType(), only the last widget instantiated with a given nwAppId will be accessabile via that variable. So, for applications where you know how many of what kind of widget you can possibly have, this isn't a bad mechanism. For larger, more complex apps, it tends to be brittle. Let me know if there's anything else I can do to help you with this. 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 _______________________________________________ The netWindows developers list: [email protected] http://netwindows.org/mailman/listinfo/devel_netwindows.org