Professional Web Applications Themes

How can I access NSDoent? - Mac Programming

I have a window that is up all the time from the main nib when the application is launched. This window will process the data and depending which doent is active, I want to update the doent from the data in this window. I am having problem trying to get it to work. I can easily access the main window from the doent by setting the delegate to the main window and call [NSApp delegate], but I can't to it the other way around. For example, if I have a NSTextField in my NSDoent. How do I update that data ...

  1. #1

    Default How can I access NSDoent?

    I have a window that is up all the time from the main nib when the
    application is launched. This window will process the data and
    depending which doent is active, I want to update the doent from
    the data in this window. I am having problem trying to get it to
    work. I can easily access the main window from the doent by
    setting the delegate to the main window and call [NSApp delegate], but
    I can't to it the other way around. For example, if I have a
    NSTextField in my NSDoent. How do I update that data with the data
    from the main window?
    Toan Guest

  2. #2

    Default Re: How can I access NSDoent?

    Toan <toanasianboxoffice.com> wrote:
    > I have a window that is up all the time from the main nib when the
    > application is launched. This window will process the data and
    > depending which doent is active, I want to update the doent from
    > the data in this window. I am having problem trying to get it to
    > work. I can easily access the main window from the doent by
    > setting the delegate to the main window and call [NSApp delegate], but
    > I can't to it the other way around. For example, if I have a
    > NSTextField in my NSDoent. How do I update that data with the data
    > from the main window?
    If you are using the doent framework (that is, you started with a
    Doent-Based Cocoa app project), then from an interface item you can
    get its window and from a window you can get its windowController and
    from a windowController you can get the doent. For further reading:

    ...TasksAndConcepts/ProgrammingTopics/Doents/index.html

    m.


    --
    matt neuburg, phd = [email]matttidbits.com[/email], [url]http://www.tidbits.com/matt/[/url]
    Read TidBITS! It's free and smart. [url]http://www.tidbits.com[/url]
    matt neuburg Guest

  3. #3

    Default Re: How can I access NSDoent?

    On Wed, 17 Sep 2003 22:03:39 GMT, [email]matttidbits.com[/email] (matt neuburg)
    wrote:
    >Toan <toanasianboxoffice.com> wrote:
    >
    >> I have a window that is up all the time from the main nib when the
    >> application is launched. This window will process the data and
    >> depending which doent is active, I want to update the doent from
    >> the data in this window. I am having problem trying to get it to
    >> work. I can easily access the main window from the doent by
    >> setting the delegate to the main window and call [NSApp delegate], but
    >> I can't to it the other way around. For example, if I have a
    >> NSTextField in my NSDoent. How do I update that data with the data
    >> from the main window?
    >
    >If you are using the doent framework (that is, you started with a
    >Doent-Based Cocoa app project), then from an interface item you can
    >get its window and from a window you can get its windowController and
    >from a windowController you can get the doent. For further reading:
    >
    > ...TasksAndConcepts/ProgrammingTopics/Doents/index.html
    >
    >m.
    >
    >
    >--
    >matt neuburg, phd = [email]matttidbits.com[/email], [url]http://www.tidbits.com/matt/[/url]
    >Read TidBITS! It's free and smart. [url]http://www.tidbits.com[/url]
    Thanks for the quick response. So, would this be the correct way to
    do it?

    - (MyDoent *)getDoent
    {
    MyDoent *currentDoc;
    NSArray *windows = [NSApp windows];

    unsigned count = [windows count];
    while (count--)
    {
    NSWindow *window = [windows objectAtIndex:count];
    if (window)
    {
    MyDoent *currentDoc = [[window windowController]
    doent];
    }
    }

    return currentDoc;
    }
    Toan Guest

  4. #4

    Default Re: How can I access NSDoent?

    Toan <toanasianboxoffice.com> wrote:
    >So, would this be the correct way to
    > do it?
    >
    > - (MyDoent *)getDoent
    > {
    > MyDoent *currentDoc;
    > NSArray *windows = [NSApp windows];
    >
    > unsigned count = [windows count];
    > while (count--)
    > {
    > NSWindow *window = [windows objectAtIndex:count];
    > if (window)
    > {
    > MyDoent *currentDoc = [[window windowController]
    > doent];
    > }
    > }
    >
    > return currentDoc;
    > }
    Sorry, it isn't obvious to me what problem that code is trying to solve.
    m.

    --
    matt neuburg, phd = [email]matttidbits.com[/email], [url]http://www.tidbits.com/matt/[/url]
    Read TidBITS! It's free and smart. [url]http://www.tidbits.com[/url]
    matt neuburg Guest

  5. #5

    Default Re: How can I access NSDoent?

    On Wed, 17 Sep 2003 23:01:51 GMT, [email]matttidbits.com[/email] (matt neuburg)
    wrote:
    >Toan <toanasianboxoffice.com> wrote:
    >
    >>So, would this be the correct way to
    >> do it?
    >>
    >> - (MyDoent *)getDoent
    >> {
    >> MyDoent *currentDoc;
    >> NSArray *windows = [NSApp windows];
    >>
    >> unsigned count = [windows count];
    >> while (count--)
    >> {
    >> NSWindow *window = [windows objectAtIndex:count];
    >> if (window)
    >> {
    >> MyDoent *currentDoc = [[window windowController]
    >> doent];
    >> }
    >> }
    >>
    >> return currentDoc;
    >> }
    >
    >Sorry, it isn't obvious to me what problem that code is trying to solve.
    >m.
    >
    >--
    >matt neuburg, phd = [email]matttidbits.com[/email], [url]http://www.tidbits.com/matt/[/url]
    >Read TidBITS! It's free and smart. [url]http://www.tidbits.com[/url]
    I'm trying to access the doent from a different file. What I am
    trying to do is to create a function that will allow me to get a
    handle to the doent. So, I was hoping that I can simply do the
    following with that.

    MyDoent *doc = [self getDoent];
    [doc [setTextData str]];

    setTextData would be a function define inside the doent.



    Toan Guest

  6. #6

    Default Re: How can I access NSDoent?

    Toan <toanasianboxoffice.com> wrote:
    > I'm trying to access the doent from a different file
    I'm sorry, the words "from a different file" don't convey anything to
    me. Your desire is to say [self getDoent] but I don't understand who
    "self" is or how he can fail to know what the doent is. Who is self
    and what doent is he trying to obtain? m.


    --
    matt neuburg, phd = [email]matttidbits.com[/email], [url]http://www.tidbits.com/matt/[/url]
    Read TidBITS! It's free and smart. [url]http://www.tidbits.com[/url]
    matt neuburg Guest

  7. #7

    Default Re: How can I access NSDoent?

    On Thu, 18 Sep 2003 00:10:55 GMT, [email]matttidbits.com[/email] (matt neuburg)
    wrote:
    >Toan <toanasianboxoffice.com> wrote:
    >
    >> I'm trying to access the doent from a different file
    >
    >I'm sorry, the words "from a different file" don't convey anything to
    >me. Your desire is to say [self getDoent] but I don't understand who
    >"self" is or how he can fail to know what the doent is. Who is self
    >and what doent is he trying to obtain? m.
    >
    >
    >--
    >matt neuburg, phd = [email]matttidbits.com[/email], [url]http://www.tidbits.com/matt/[/url]
    >Read TidBITS! It's free and smart. [url]http://www.tidbits.com[/url]
    Since I'm used to program in C, maybe I might confuse myself. Here's
    how it is.

    I have a file maincontroller.m and MyMainController is connected to
    the window in the main.nib

    interface MyMainController : NSObject
    {
    }

    - (MyDoent *)getDoent

    end

    So, if I was calling the function within the maincontroller.m, that is
    MyMainController, don't I have to do a [self getDoent] ?

    So, what it's trying to access is the MyDoent's records or
    tableView that is define inside the doent.nib

    interface MyDoent : NSDoent
    {
    NSMutableArray *records;
    IBOutlet id tableView;
    }

    end


    Toan Guest

  8. #8

    Default Re: How can I access NSDoent?

    Toan <toanasianboxoffice.com> wrote:

    [..]
    > I'm trying to access the doent from a different file. What I am trying
    > to do is to create a function that will allow me to get a handle to the
    > doent. So, I was hoping that I can simply do the following with that.
    >
    > MyDoent *doc = [self getDoent];
    > [doc [setTextData str]];
    >
    > setTextData would be a function define inside the doent.
    It probably won't solve your problem, but if you look at the
    doentation for NSDoentController's -doents method, things might
    become more clear. Or more confused. :-)

    You can get an array of all doents this way:

    NSArray *allTheDoents = [[NSDoentController
    sharedDoentController] doents];

    Then you'll be able to search and sort through the doents however you
    want.
    Paul Mitchum Guest

  9. #9

    Default Re: How can I access NSDoent?

    Toan <toanasianboxoffice.com> wrote:
    > So, if I was calling the function within the maincontroller.m, that is
    > MyMainController, don't I have to do a [self getDoent] ?
    >
    > So, what it's trying to access is the MyDoent's records or
    > tableView that is define inside the doent.nib
    How about using NSDoentController's - (id) currentDoent ?

    Per
    Per Bull Holmen Guest

  10. #10

    Default Re: How can I access NSDoent?

    Per Bull Holmen <pbh_news> wrote:
    > Toan <toanasianboxoffice.com> wrote:
    >
    > > So, if I was calling the function within the maincontroller.m, that is
    > > MyMainController, don't I have to do a [self getDoent] ?
    > >
    > > So, what it's trying to access is the MyDoent's records or
    > > tableView that is define inside the doent.nib
    >
    > How about using NSDoentController's - (id) currentDoent ?
    By the way, this would be the code:

    id theDoent = [[NSDoentController sharedDoentController]
    currentDoent];

    I have never tried it, so I don't know if it works.

    Per
    Per Bull Holmen Guest

  11. #11

    Default Re: How can I access NSDoent?

    On Wed, 17 Sep 2003 18:30:17 -0700, [email]usenetmile23.com[/email].r3m0v3 (Paul
    Mitchum) wrote:
    >Toan <toanasianboxoffice.com> wrote:
    >
    >[..]
    >> I'm trying to access the doent from a different file. What I am trying
    >> to do is to create a function that will allow me to get a handle to the
    >> doent. So, I was hoping that I can simply do the following with that.
    >>
    >> MyDoent *doc = [self getDoent];
    >> [doc [setTextData str]];
    >>
    >> setTextData would be a function define inside the doent.
    >
    >It probably won't solve your problem, but if you look at the
    >doentation for NSDoentController's -doents method, things might
    >become more clear. Or more confused. :-)
    >
    >You can get an array of all doents this way:
    >
    >NSArray *allTheDoents = [[NSDoentController
    >sharedDoentController] doents];
    >
    >Then you'll be able to search and sort through the doents however you
    >want.

    Okay, I'll try these method. I was surprised that the function I
    define in the message ealier also worked. Although I am not exactly
    sure if it's getting the current active doent or not.
    Toan Guest

  12. #12

    Default Re: How can I access NSDoent?

    Toan <toanasianboxoffice.com> wrote:
    > what it's trying to access is the MyDoent's records or
    > tableView that is define inside the doent.nib
    >
    > interface MyDoent : NSDoent
    > {
    > NSMutableArray *records;
    > IBOutlet id tableView;
    > }
    You do not "define" an NSDoent inside a nib. (The nib is where you
    draw the windows.) The framework will create an NSDoent each time one
    is needed (either because the user said New or because the user said
    Open). There can be many NSDoents (because the user can open many
    doents at a time). So I still do not know which one you want. If I
    don't know which NSDoent you want, I can't tell you how to access it.
    You should read the explanation of the doent architecture I pointed
    you to earlier. m.


    --
    matt neuburg, phd = [email]matttidbits.com[/email], [url]http://www.tidbits.com/matt/[/url]
    Read TidBITS! It's free and smart. [url]http://www.tidbits.com[/url]
    matt neuburg Guest

  13. #13

    Default Re: How can I access NSDoent?

    On Thu, 18 Sep 2003 04:20:50 +0200, [email]pbh_news[/email] (Per Bull
    Holmen) wrote:
    >Per Bull Holmen <pbh_news> wrote:
    >
    >> Toan <toanasianboxoffice.com> wrote:
    >>
    >> > So, if I was calling the function within the maincontroller.m, that is
    >> > MyMainController, don't I have to do a [self getDoent] ?
    >> >
    >> > So, what it's trying to access is the MyDoent's records or
    >> > tableView that is define inside the doent.nib
    >>
    >> How about using NSDoentController's - (id) currentDoent ?
    >
    >By the way, this would be the code:
    >
    >id theDoent = [[NSDoentController sharedDoentController]
    >currentDoent];
    >
    >I have never tried it, so I don't know if it works.
    >
    >Per
    I tried this method and it didn't work. theDoent became 0, the
    function I define actually worked.
    Toan Guest

  14. #14

    Default Re: How can I access NSDoent?

    Toan <toanasianboxoffice.com> wrote:
    > On Thu, 18 Sep 2003 04:20:50 +0200, [email]pbh_news[/email] (Per Bull
    > Holmen) wrote:
    >
    > >Per Bull Holmen <pbh_news> wrote:
    > >
    > >> Toan <toanasianboxoffice.com> wrote:
    > >>
    > >> > So, if I was calling the function within the maincontroller.m, that is
    > >> > MyMainController, don't I have to do a [self getDoent] ?
    > >> >
    > >> > So, what it's trying to access is the MyDoent's records or
    > >> > tableView that is define inside the doent.nib
    > >>
    > >> How about using NSDoentController's - (id) currentDoent ?
    > >
    > >By the way, this would be the code:
    > >
    > >id theDoent = [[NSDoentController sharedDoentController]
    > >currentDoent];
    > >
    > >I have never tried it, so I don't know if it works.
    > >
    > >Per
    >
    > I tried this method and it didn't work. theDoent became 0, the
    > function I define actually worked.
    My guess is that at the time you call the function, the main doent is
    not your main window, because the "shared" window is, and so
    +currentDoent returns nil.

    You must have a method wich always points to the current doent and no
    other doent. My suggestion is you keep a static reference that always
    points to the main doent:

    implementation MainController

    static id currentDoent = nil;

    +(void)setCurrentDoent:(id)newDoc {

    currentDoent = newDoc;

    }

    +(id)currentDoent {

    return currentDoent;

    }

    +(void)doentGotClosed:(id)closeDoc {

    if( closeDoc == currentDoent )
    currentDoent = nil; // To avoid keeping references to
    invalid objects

    }

    // insert the rest of your code here

    Now you can always retrieve the current doent this way:
    [MainController currentDoent];

    Set current doent like this:
    [MainController setCurrentDoent:theDoc];

    In setCurrentDoent:, you should define the actions to update the
    shared window, so it always keeps the "shared" window updated, no matter
    if it's active or not etc...

    Now what you have to do, is make sure the appropriate methods always get
    called at the right time.... this requires a little investigation from
    your part:

    * You may use NSNotifications, to have MainController always get
    notified when a new doent is current.
    * Override methods in either the doents window class (which must be
    subclassed), or the doent (if NSDoent has defined methods for a
    doent to become current).

    This is by far the best approach, because (if implemented correctly) it
    ALWAYS makes sure the maincontroller knows what doent is active, and
    it ensures immediate update of the shared window. Also, the method for
    retrieving the shared window (via MainController) should be:

    static id sharedWindow = nil;

    +(void)setSharedWindow:(id)theWin {

    sharedWindow = theWin;

    }

    +(id)sharedWindow {

    return sharedWindow;

    }

    This is better than "weird" solutions like setting the NSApp's delegate
    if it's not needed for other reasons. Sorry this requires you to read
    and investigate a little if you're new to Objectve-C/Cocoa, but then
    again you learn the right way to do things... :)

    Per
    Per Bull Holmen Guest

  15. #15

    Default Re: How can I access NSDoent?

    On Thu, 18 Sep 2003 03:05:27 GMT, [email]matttidbits.com[/email] (matt neuburg)
    wrote:
    >Toan <toanasianboxoffice.com> wrote:
    >
    >> what it's trying to access is the MyDoent's records or
    >> tableView that is define inside the doent.nib
    >>
    >> interface MyDoent : NSDoent
    >> {
    >> NSMutableArray *records;
    >> IBOutlet id tableView;
    >> }
    >
    >You do not "define" an NSDoent inside a nib. (The nib is where you
    >draw the windows.) The framework will create an NSDoent each time one
    >is needed (either because the user said New or because the user said
    >Open). There can be many NSDoents (because the user can open many
    >doents at a time). So I still do not know which one you want. If I
    >don't know which NSDoent you want, I can't tell you how to access it.
    >You should read the explanation of the doent architecture I pointed
    >you to earlier. m.
    >
    >
    >--
    >matt neuburg, phd = [email]matttidbits.com[/email], [url]http://www.tidbits.com/matt/[/url]
    >Read TidBITS! It's free and smart. [url]http://www.tidbits.com[/url]
    The main controller will always try to access the active doent.
    So, if there are 10 doents open, the main controller will access
    the last selected one (could be the first opened one).
    Toan Guest

  16. #16

    Default Re: How can I access NSDoent?

    On Thu, 18 Sep 2003 12:16:02 +0200, [email]pbh_news[/email] (Per Bull
    Holmen) wrote:
    >Toan <toanasianboxoffice.com> wrote:
    >
    >> On Thu, 18 Sep 2003 04:20:50 +0200, [email]pbh_news[/email] (Per Bull
    >> Holmen) wrote:
    >>
    >> >Per Bull Holmen <pbh_news> wrote:
    >> >
    >> >> Toan <toanasianboxoffice.com> wrote:
    >> >>
    >> >> > So, if I was calling the function within the maincontroller.m, that is
    >> >> > MyMainController, don't I have to do a [self getDoent] ?
    >> >> >
    >> >> > So, what it's trying to access is the MyDoent's records or
    >> >> > tableView that is define inside the doent.nib
    >> >>
    >> >> How about using NSDoentController's - (id) currentDoent ?
    >> >
    >> >By the way, this would be the code:
    >> >
    >> >id theDoent = [[NSDoentController sharedDoentController]
    >> >currentDoent];
    >> >
    >> >I have never tried it, so I don't know if it works.
    >> >
    >> >Per
    >>
    >> I tried this method and it didn't work. theDoent became 0, the
    >> function I define actually worked.
    >
    >My guess is that at the time you call the function, the main doent is
    >not your main window, because the "shared" window is, and so
    >+currentDoent returns nil.
    >
    >You must have a method wich always points to the current doent and no
    >other doent. My suggestion is you keep a static reference that always
    >points to the main doent:
    >
    >implementation MainController
    >
    > static id currentDoent = nil;
    >
    > +(void)setCurrentDoent:(id)newDoc {
    >
    > currentDoent = newDoc;
    >
    > }
    >
    > +(id)currentDoent {
    >
    > return currentDoent;
    >
    > }
    >
    > +(void)doentGotClosed:(id)closeDoc {
    >
    > if( closeDoc == currentDoent )
    > currentDoent = nil; // To avoid keeping references to
    >invalid objects
    >
    > }
    >
    > // insert the rest of your code here
    >
    >Now you can always retrieve the current doent this way:
    >[MainController currentDoent];
    >
    >Set current doent like this:
    >[MainController setCurrentDoent:theDoc];
    >
    >In setCurrentDoent:, you should define the actions to update the
    >shared window, so it always keeps the "shared" window updated, no matter
    >if it's active or not etc...
    >
    >Now what you have to do, is make sure the appropriate methods always get
    >called at the right time.... this requires a little investigation from
    >your part:
    >
    >* You may use NSNotifications, to have MainController always get
    >notified when a new doent is current.
    >* Override methods in either the doents window class (which must be
    >subclassed), or the doent (if NSDoent has defined methods for a
    >doent to become current).
    >
    >This is by far the best approach, because (if implemented correctly) it
    >ALWAYS makes sure the maincontroller knows what doent is active, and
    >it ensures immediate update of the shared window. Also, the method for
    >retrieving the shared window (via MainController) should be:
    >
    > static id sharedWindow = nil;
    >
    > +(void)setSharedWindow:(id)theWin {
    >
    > sharedWindow = theWin;
    >
    > }
    >
    > +(id)sharedWindow {
    >
    > return sharedWindow;
    >
    > }
    >
    >This is better than "weird" solutions like setting the NSApp's delegate
    >if it's not needed for other reasons. Sorry this requires you to read
    >and investigate a little if you're new to Objectve-C/Cocoa, but then
    >again you learn the right way to do things... :)
    >
    >Per
    I thought about doing it that way because that's how I used to do it
    on the Windows side. Except that I also need to call [MainController
    setCurrentDoent:this]; whenever a doent gets focus. What I
    really want to do is to make the maincontroller like a tool window
    that never gets focus. You can click on the action you want and it
    will always perform on your current active doent. So, of course
    the best would be able to just cycle through all the windows, find the
    top most one or the active one. Check to see if it's a doent type.

    Also, can you tell me what's the difference between the + and -
    infront of the function?
    Toan Guest

  17. #17

    Default Re: How can I access NSDoent?


    [email]toanasianboxoffice.com[/email] (Toan) writes:
    > I thought about doing it that way because that's how I used to do it
    > on the Windows side. Except that I also need to call [MainController
    > setCurrentDoent:this]; whenever a doent gets focus. What I
    > really want to do is to make the maincontroller like a tool window
    > that never gets focus. You can click on the action you want and it
    > will always perform on your current active doent. So, of course
    > the best would be able to just cycle through all the windows, find the
    > top most one or the active one. Check to see if it's a doent type.
    In that case you probably want to use a panel rather than a
    window. I haven't done this myself, but the doentation on
    Apple's site suggests that.

    [url]http://developer.apple.com/doentation/Cocoa/Conceptual/WinPanel/index.html#//apple_ref/doc/uid/10000031i[/url]

    Btw, CocoaBrowser is a really great tool for looking at the
    doentation.

    [url]http://homepage2.nifty.com/hoshi-takanori/cocoa-browser/[/url]
    > Also, can you tell me what's the difference between the + and -
    > infront of the function?
    The + means it's a class method, - means it's an instance
    method. For example, alloc is a class method because you invoke it
    on the class object to create a new instance of that class. Init
    is an instance method because you invoke it on a particular
    object.

    id a = [NSArray array]; // class method
    [a objectAtIndex: i]; // instance method

    Check out Apple's Objective-C doentation for more.

    Also, cycling though array elements based on index works, but I
    believe the preferred way of doing this is to use NSEnumerator.

    [url]http://developer.apple.com/doentation/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSArray.html#//apple_ref/doc/uid/20000137/BABCDDIC[/url]

    Hope this helps,

    Peter

    -- Peter Ilberg <peter.ilbergni.com>
    Peter Ilberg Guest

  18. #18

    Default Re: How can I access NSDoent?

    [email]toanasianboxoffice.com[/email] (Toan) wrote in message news:<3f68d2ea.452947824news.dslindiana.com>...
    > I have a window that is up all the time from the main nib when the
    > application is launched. This window will process the data and
    > depending which doent is active, I want to update the doent from
    > the data in this window. I am having problem trying to get it to
    > work. I can easily access the main window from the doent by
    > setting the delegate to the main window and call [NSApp delegate], but
    > I can't to it the other way around. For example, if I have a
    > NSTextField in my NSDoent. How do I update that data with the data
    > from the main window?
    I'm not sure exactly what you're asking. I'm not sure what exactly
    you're
    calling the main window, because that term has another meaning in
    Cocoa.

    Is this, like, the tools window in Interface Builder? In that case,
    this is
    an NSPanel, which should never be the main window. The main window
    is, roughly, the topmost regular window, usually a doent window.

    If this is what you're doing, it's simple. Give your NSPanel a custom
    subclass of NSWindowController. When this needs to find out what
    the main (i.e. topmost doent window), it can do [[NSApplication
    sharedApplication] mainWindow]; to find out what the doent
    window is. It can also be notified when the main window changes,
    so that it can stay up-to-date, like this:

    [[NSNotificationCenter defaultCenter]addObserver:self
    selector:selector(loadObserver:)
    name:(NSString *)NSWindowDidBecomeMainNotification
    object:nil];

    [[NSNotificationCenter defaultCenter]addObserver:self
    selector:selector(loadObserver:)
    name:(NSString *)NSWindowDidResignMainNotification
    object:nil];

    This is a quote from some of my code, where loadObserver (you'd maybe
    want to call it loadDoent) is declared like this:

    - (void)loadObserver:(id)notification;

    This method is responsible for getting information from the doent.

    Your subclassed controller will keep track of the main (doent)
    window.
    As the user moves controls or it computes or whatever, it can use this
    information to stuff everything back into the main (doent) window.

    If this *isn't* what you're doing, such as if you're trying to make
    this
    common window a regular window rather than a panel, I suggest
    rethinking the design, because that window can become main as
    well, and it may confuse the user, who will be unable to tell at a
    glance which is the main window.
    Eric Pepke Guest

  19. #19

    Default Re: How can I access NSDoent?

    On 18 Sep 2003 10:38:39 -0500, Peter Ilberg <peter.ilbergni.com>
    wrote:

    >In that case you probably want to use a panel rather than a
    >window. I haven't done this myself, but the doentation on
    >Apple's site suggests that.
    >
    Hmmm, I should think about doing that. So, can I put a whole
    quicktime video control inside a panel? Currently, my main window is
    where all the video process the data.
    >[url]http://developer.apple.com/doentation/Cocoa/Conceptual/WinPanel/index.html#//apple_ref/doc/uid/10000031i[/url]
    >
    >Btw, CocoaBrowser is a really great tool for looking at the
    >doentation.
    >
    >[url]http://homepage2.nifty.com/hoshi-takanori/cocoa-browser/[/url]
    >
    >> Also, can you tell me what's the difference between the + and -
    >> infront of the function?
    >
    >The + means it's a class method, - means it's an instance
    >method. For example, alloc is a class method because you invoke it
    >on the class object to create a new instance of that class. Init
    >is an instance method because you invoke it on a particular
    >object.
    I see. For a while, I thought that was just a way Objective C define
    it's function.
    >
    > id a = [NSArray array]; // class method
    > [a objectAtIndex: i]; // instance method
    >
    >Check out Apple's Objective-C doentation for more.
    >
    >Also, cycling though array elements based on index works, but I
    >believe the preferred way of doing this is to use NSEnumerator.
    >
    >[url]http://developer.apple.com/doentation/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSArray.html#//apple_ref/doc/uid/20000137/BABCDDIC[/url]
    >
    >Hope this helps,
    >
    >Peter
    >
    >-- Peter Ilberg <peter.ilbergni.com>
    Toan Guest

  20. #20

    Default Re: How can I access NSDoent?


    [email]toanasianboxoffice.com[/email] (Toan) writes:
    > Hmmm, maybe I need to redesign the application. What I am trying to
    > do in this common window is to run quicktime connected to a capture
    > card. Since that is done at the start of the application, the window
    > will never close until you exit the application. Now, depending on
    > which doent you have open, clicking on the grab button in the
    > common window will automatically save an image and display it to the
    > appropriate doent (that is the active one).
    Why not simply create a new doent window when the user clicks
    grab and display the image in there? Otherwise the user has to
    create a new empty window first and then grab the image. That
    seems wrong.

    Then, if you intend to allow the user to manipulate the captured
    image, you can implement a tools palette in a separate NSPanel.
    (separate from your quicktime window)

    -- Peter Ilberg <peter.ilbergni.com>
    Peter Ilberg Guest

Page 1 of 2 12 LastLast

Similar Threads

  1. Access 2002 PDFWriter VBA Code w/WinXP does not work like Access 2000
    By Tony_VBACoder in forum Adobe Acrobat Windows
    Replies: 3
    Last Post: April 30th, 07:44 PM
  2. Replies: 0
    Last Post: December 16th, 06:19 PM
  3. one NSDoent, multiple windows; no focus change
    By matt in forum Mac Programming
    Replies: 1
    Last Post: September 12th, 02:39 PM
  4. Getting NSDoent to load a file into current window
    By Eric Lada in forum Mac Programming
    Replies: 1
    Last Post: September 9th, 04:14 PM
  5. Access denied when creating Access application object
    By Bill Murphy in forum ASP Database
    Replies: 7
    Last Post: July 31st, 05:37 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139