help-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Instantiate some classes?


From: Sašo Kiselkov
Subject: Re: Instantiate some classes?
Date: Mon, 03 Oct 2005 20:29:04 +0200
User-agent: Internet Messaging Program (IMP) 3.2.5

Quoting Jeannette Gorrin <jeannettegorrin@yahoo.com>:

> Hi everybody:
>
> I'm using Gorm. In my application it's necesary to
> instantiate NSDocumentController class. In the Classes
> Menu, the Instantiate option is unsensitive, i can't
> click it and i'm selecting NSDocumentController
> classes in the dialog, is there any reason that i
> don't know?

Hi Jeanette.

Under normal circumstances you don't have to *instantiate* an
NSDocumentController. See
http://developer.apple.com/documentation/Cocoa/Conceptual/Documents/Concepts/OverviewDocArchitecture.html#//apple_ref/doc/uid/20000023
for the class-diagram of document-based apps. Looking at the diagram in Apple's
docs you'll see that when modelling some interface in Gorm you are doing stuff
from the 'Window' side. The NSDocumentController, however, lives on the other
side of the diagram, so you're doing it the wrong way around. If, for whatever
reason, you need to instantiate an NSDocumentController *manually* in your app
(please note that in the common case of document-based apps the AppKit
framework does this for you automagically) you should do it in Objective-C
code, not using Gorm.

However, I guess what you actually want to do is model some interface for your
document window. Is that it? In case it is you don't need to instantiate
anything manually. Instead set the NSOwner object in the 'Objects' tab to of
the correct class that will load the gorm file (either NSDocument or
NSWindowController or (more precisely) actually some subclass of them you
create. See
http://developer.apple.com/documentation/Cocoa/Conceptual/Documents/index.html
for a detailed description of what you can and should do in document-based
apps.

> I also realise that it happens to some classes in the
> dialog.
>
> Thanks in advance...
> Jeannette.
>
> P.S: i attached class menu..

Yes, Gorm doesn't allow you to instantiate stuff that's not logical to create by
instantiation, such as NSWindow (if you want a window, drag it from the
'Palettes' panel) or a general NSView (if you want a custom view drag a 'Custom
View' from the Palette and put it in the window you where you want it to be). It
does, however, allow you to do so with non-graphical objects (such as an
NSDocument, or a custom subclass of NSObject, or perhaps an NSDictionary),
because non graphical stuff is created by instantiation, not by dragging it
from the Palette.

Sorry if I underestimated your knowledge in this post, I didn't mean to insult
you. I just want to make sure we understand each other. ;-)

Cheers
--
Saso





reply via email to

[Prev in Thread] Current Thread [Next in Thread]