home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / next / programm / 5831 < prev    next >
Encoding:
Internet Message Format  |  1992-08-27  |  1.5 KB

  1. Path: sparky!uunet!mcsun!uknet!siesoft!athen!tim
  2. From: tim@sinix.UUCP (Tim Bissell)
  3. Newsgroups: comp.sys.next.programmer
  4. Subject: Initialisation of custom objects
  5. Message-ID: <1992Aug27.175004.568@sinix.UUCP>
  6. Date: 27 Aug 92 17:50:04 GMT
  7. Organization: SNI AG Muenchen, STO XS
  8. Lines: 75
  9.  
  10. << My system:  slab/2.1 >>
  11.  
  12. Hi,
  13.  
  14. I have run into an old problem.  I want to create a custom object that
  15. loads part of itself from a nib, and does some fiddling with the nib
  16. objects at initialisation.  If I just do a loadNibSection:owner: in
  17. my init method, the nib object pointers are still nil (according to gdb)
  18. e.g.
  19.  
  20.  
  21. @interface X:Object
  22. {
  23.     id window;
  24.     id splitView;
  25.     ...
  26. }
  27.  
  28. ...
  29.  
  30. @end
  31.  
  32.  
  33. @implementation X
  34.  
  35. - init
  36. {
  37.     [super init];
  38.     [NXApp loadNibSection:"X.nib" owner:self];
  39.  
  40.     // at this point window and splitView are still 0x0/nil
  41.  
  42.     [window setBackgroundGray:NX_BLACK];
  43.     ...
  44.  
  45.     return self;
  46. }
  47.  
  48. ...
  49.  
  50. @end
  51.  
  52. In NextAnswers (#817 I think) it addresses this problem, and says it
  53. can be cured by adding a new method (say awake) and doing the initialisation
  54. in there:
  55.  
  56. - init
  57. {
  58.     [super init];
  59.         [NXApp loadNibSection:"X.nib" owner:self];
  60.  
  61.     [self awake];
  62.  
  63.     return self;
  64. }
  65.  
  66.  
  67. - awake
  68. {
  69.         [window setBackgroundGray:NX_BLACK];
  70.     ....
  71.  
  72.         return self;
  73. }
  74.  
  75.  
  76. Unfortunately, window and splitView are *still* set to nil.  Any ideas?
  77.  
  78. Thanks in advance,
  79.  
  80. Tim
  81. -- 
  82. Tim Bissell        |      best...    tim@athen.uucp
  83. Work:+49 89 636 49542    |     hmm...    tim%sinix@germany.eu.net
  84. Home:+49 89 692 5263    |   UK only...    uk.co.uel!sinix!athen!tim
  85.