Q: When can I download PostScript code to the Window Server? Can I use the +initialize methods for factory objects?
A: Object class +initialize methods cannot download PostScript code to the Window Server because they are run before the connection to the Server has been established. Initialize messages for classes always get sent before any other messages are delivered, specifically before [Application new] has been executed. But [Application new] is what connects the program to the Server.
A good time to download code to the server is after [Application new] and loading the nib section, but before the application starts running. In your main(), after sending the loadNibSection method, sent a setUp message, like this:
[NXApp loadNibSection:"MyNibFile.nib" owner:NXApp];
[NXGetNamedObject("MyObj", NXApp) setUp];
setUp is an instance method that downloads PostScript code to the Window Server.
QA29
Valid for 1.0, 2.0, 3.0