home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!uknet!siesoft!athen!tim
- From: tim@sinix.UUCP (Tim Bissell)
- Newsgroups: comp.sys.next.programmer
- Subject: Initialisation of custom objects
- Message-ID: <1992Aug27.175004.568@sinix.UUCP>
- Date: 27 Aug 92 17:50:04 GMT
- Organization: SNI AG Muenchen, STO XS
- Lines: 75
-
- << My system: slab/2.1 >>
-
- Hi,
-
- I have run into an old problem. I want to create a custom object that
- loads part of itself from a nib, and does some fiddling with the nib
- objects at initialisation. If I just do a loadNibSection:owner: in
- my init method, the nib object pointers are still nil (according to gdb)
- e.g.
-
-
- @interface X:Object
- {
- id window;
- id splitView;
- ...
- }
-
- ...
-
- @end
-
-
- @implementation X
-
- - init
- {
- [super init];
- [NXApp loadNibSection:"X.nib" owner:self];
-
- // at this point window and splitView are still 0x0/nil
-
- [window setBackgroundGray:NX_BLACK];
- ...
-
- return self;
- }
-
- ...
-
- @end
-
- In NextAnswers (#817 I think) it addresses this problem, and says it
- can be cured by adding a new method (say awake) and doing the initialisation
- in there:
-
- - init
- {
- [super init];
- [NXApp loadNibSection:"X.nib" owner:self];
-
- [self awake];
-
- return self;
- }
-
-
- - awake
- {
- [window setBackgroundGray:NX_BLACK];
- ....
-
- return self;
- }
-
-
- Unfortunately, window and splitView are *still* set to nil. Any ideas?
-
- Thanks in advance,
-
- Tim
- --
- Tim Bissell | best... tim@athen.uucp
- Work:+49 89 636 49542 | hmm... tim%sinix@germany.eu.net
- Home:+49 89 692 5263 | UK only... uk.co.uel!sinix!athen!tim
-