Path: utzoo!yunexus!ists!helios.physics.utoronto.ca!news-server.csri.toronto.edu!utgpu!watserv1!watcgl!jvkelley From: jvkelley@watcgl.waterloo.edu (Jeff Kelley) Newsgroups: comp.sys.next Subject: Re: How to obtain object id's loaded with loadNibFile Message-ID: <1990May29.154549.16615@watcgl.waterloo.edu> Date: 29 May 90 15:45:49 GMT Article-I.D.: watcgl.1990May29.154549.16615 References: <1990May27.193144.21730@watcgl.waterloo.edu> <130072@gore.com> Organization: University of Waterloo Lines: 38 In article <130072@gore.com> jacob@gore.com (Jacob Gore) writes: >> In article <1990May27.193144.21730@watcgl.waterloo.edu> >> jvkelley@watcgl.waterloo.edu (Jeff Kelley) writes: >> >How can an application determine what objects were loaded >> >using the Application class' loadNibFile method? >> ... >Sorry to interrupt your string of self-abuse, but: couldn't you just assign >names to these controls, and then use NXGetNamedObject()? > >Jacob >-- >Jacob Gore Jacob@Gore.Com boulder!gore!jacob I tried using NXGetNamedObject but couldn't get it to work. Specifically, I did something like: manager = [PanelManager new]; /* PanelManager handles object messages */ panel = [NXApp loadNibFile:filename owner:manager withNames:YES]; slider = NXGetNamedObject( "Slider2"/*name*/, manager/*owner*/ ); where I assigned the name "Slider2" or somesuch to an object using IB. The result in 'slider' was always nil. I traced the code of NXGetNamedObject and got the impression that it references the Applications _nameTable instance variable, which I believe was a List. I found that the number of items in the _nameTable List didn't change after calling loadNibFile. However, in 'main()' where the initial loadNibSection is performed, I found the _nameTable made a transition from nil to a list of 30 objects or so. I was somewhat confused by this behaviour. To sum up, the behaviour I would expect from loadNibFile: owner: withNames:YES is that the loaded objects would then be accessible with NXGetNamedObject using the owner specified to loadNibFile. If someone can confirm that this does indeed work (and point out what I'm doing wrong) I would use this approach. (I still don't have any printed docs, just what's online). -- Jeff Kelley National Research Council of Canada, Ottawa uunet!watmath!watcgl!jvkelley tel: (613) 990-5924