Professional Web Applications Themes

Renaming MyDoent - Mac Programming

Does MyDoent (in a doent-based app) have to be called "MyDoent"? I've tried renaming it but then the app can't make a new doent. -- C Lund, www.notam02.no/~clund...

  1. #1

    Default Renaming MyDoent

    Does MyDoent (in a doent-based app) have to be called
    "MyDoent"? I've tried renaming it but then the app can't make a new
    doent.

    --
    C Lund, www.notam02.no/~clund
    C Guest

  2. #2

    Default Re: Renaming MyDoent

    In article <chello.com>,
    C Lund <no> wrote:
     

    Sure you can. You just have to rename it everywhere the word is used.
    This includes your NIB file (you may have to re-add it as a new class
    and change the instance's "custom class"), your source files etc.

    IIRC you also need to change the class name in Project Builder's
    "doent types" list.

    Cheers,
    -- Uli
    http://www.zathras.de
    Uli Guest

  3. #3

    Default Re: Renaming MyDoent

    In article <t-online.com>,
    Uli Kusterer <de> wrote: 
    > Sure you can. You just have to rename it everywhere the word is used.
    > This includes your NIB file (you may have to re-add it as a new class
    > and change the instance's "custom class"), your source files etc.[/ref]

    Done all that.
     

    That might be what I haven't done. Where is the "doent types" list?

    Although I think I may have been barking up the wrong tree wrt
    changing the name of MyDoent. That class is just an envelope for
    the actual doents, isn't it?
     

    --
    C Lund, www.notam02.no/~clund
    C Guest

  4. #4

    Default Re: Renaming MyDoent

    In article <chello.com>,
    C Lund <no> wrote:
     
    >
    > That might be what I haven't done. Where is the "doent types" list?[/ref]

    It should be in the Target Info. Go to the "Targets and Build Styles"
    pane, double-click the target at the top, and you'll get a window. In
    that window you can specify version number, bundle identifier and other
    stuff.
     

    I don't think it's an envelope, at least by my definition of the word.
    I'd rather call it a "template", or more correctly just the class for
    doents of one particular type and suffix.

    Cheers,
    -- Uli
    http://www.zathras.de
    Uli Guest

  5. #5

    Default Re: Renaming MyDoent

    In article <t-online.com>,
    Uli Kusterer <de> wrote: 
    > > That might be what I haven't done. Where is the "doent types" list?[/ref]
    > It should be in the Target Info. Go to the "Targets and Build Styles"
    > pane, double-click the target at the top, and you'll get a window. In
    > that window you can specify version number, bundle identifier and other
    > stuff.[/ref]

    You mean under the "application settings" tab? I don't really see
    anything there that would have to be changed. Not under any of the
    other tabs either, for that matter.
     
    > I don't think it's an envelope, at least by my definition of the word.
    > I'd rather call it a "template", or more correctly just the class for
    > doents of one particular type and suffix.[/ref]

    I'm a bit unsure about the role of the "MyDoent" class. What I want
    to do is make a doent that consists of a data tree. Should
    "MyDoent" be the root class of that tree (ie should it be renamed)
    or should MyDoent just have #include "RootClass.h" in the
    implementation?

    I have tried both now. If I rename MyDoent, I can't make new
    doents. If I append/include the root class to MyDoent, I can
    make new doents, but I can't figure out how to link the MainMenu to
    the doents. Should I make a subclass of DoentController to do
    this?
     

    --
    C Lund, www.notam02.no/~clund
    C Guest

  6. #6

    Default Re: Renaming MyDoent

    In article <chello.com>,
    C Lund <no> wrote:
     

    I'm assuming you have the newest Project Builder (I don't have xCode
    yet). Click the "Targets" tab. In the "Targets" list, select your Target
    and double-click it.

    You'll get a new window (or maybe you'll get it displayed in the right
    pane, depends on whether you're in single-or multi-window mode. Click
    "Info.plist entries". Now scroll down to "Doent Types". If you click
    on one of the types in the list, you'll see its state reflected in the
    edit fields. Make sure "Doent Class:" reflects the new name of your
    NSDoent subclass.
     

    It may help to read the docs on NSDoent. There's a copy in
    /Developer/Doentation/ on your hard disk.
     

    What do you mean by "append/include"? You can either #import your class
    and add a pointer to an object of that class to your NSDoent
    subclass's instance variables, or you can merge the two classes, so your
    custom doent is actually the same as your "root" object.

    As to "link the MainMenu to the doents", read the docs about the
    "First Responder" to find out how to do it. Basically, you hook up menu
    items to the "First Responder" icon, and AppKit will automatically pick
    the current responder (e.g. the frontmost text field or the frontmost
    doent) and send it the message.

    I think you really want to buy or borrow a copy of Aaron Hillegass'
    book on Cocoa programming, it covers all that stuff. And it only takes a
    day to work through it, and you know most of the stuff.

    Cheers,
    -- Uli
    http://www.zathras.de
    Uli Guest

  7. #7

    Default Re: Renaming MyDoent

    In article <t-online.com>,
    Uli Kusterer <de> wrote: 
    > I'm assuming you have the newest Project Builder (I don't have xCode
    > yet).[/ref]

    Actually, I'm still using 10.1.5 and the version of PB that can with
    10.1.0(?).
     
     

    Hmm.. I can't find it. Either because I'm using an outdated version of
    PB or because I'm not doing the right thing. The closest I can find to
    what you're describing is the "english.lprog/infoPlist.strings" entry
    in the "Bundle Resources" list. Clicking on it gives me an
    "fileReference should be an instance inheriting from PBXFileReference,
    but it is <PBXVariantGroup:0x029dd310>" error and an option to quit or
    continue.

    However:
     

    This is under the "application settings" tab. But it works as you
    described it. Thanks. B)
     
    >
    > What do you mean by "append/include"? You can either #import your class
    > and add a pointer to an object of that class to your NSDoent
    > subclass's instance variables, or you can merge the two classes, so your
    > custom doent is actually the same as your "root" object.[/ref]

    Yeah, I've tried both. I think I'll stick to adding a pointer to the
    NSDoent class for now.
     

    The problem then is that the methods I'm trying to link to (from the
    menu) don't show up in the list. I've pd the header files to the
    nib files (both the doent and menu nibs). Or do I need a
    NSDoentController subclass for this? I've tried implementing a
    controller class, but it doesn't seem to be aware of the presence of
    any doents. [self currentDoent] returns null.
     

    I have his book. It's a good one too, and his Raiseman example has two
    instances of *almost* doing what I want to do; First, he has controls
    for editing the active doent. But he does so by putting buttons on
    the doent window. I want to do so via the applicaiton menu.
    Secondly, he lets the user set the background color of the doent by
    calling up a pref panel - which is done via the menu. The problem is
    that this affects *all* doents. I only want to change the active
    doent.

    However, it's been some time since I actually *read* his book, so I
    might as well go through that section again. I might find what I'm
    looking for. B)
     

    --
    C Lund, www.notam02.no/~clund
    C Guest

  8. #8

    Default Re: Renaming MyDoent

    In article <chello.com>,
    C Lund <no> wrote:
     

    What you do is to hook your menu items up to your FirstResponder in the
    nib file. Don't worry about FirstResponder not having the methods you
    want; just go to the classes tab, find FirstResponder, and add the
    methods you need in the inspector. NSResponder is smart enough to
    forward unknown messages down the responder chain until it find somebody
    who understands it. If it doesn't find anybody, then the menu item will
    be disabled, which is incidentally usually the best way to handle
    enabling/disabling menu items.
    Michael Guest

  9. #9

    Default Re: Renaming MyDoent

    In article <mail-102967.17431303112003localhost>,
    Michael Ash <com> wrote:
     

    That did the trick. Thanks. B)

    --
    C Lund, www.notam02.no/~clund
    C Guest

  10. #10

    Default Re: Renaming MyDoent

    In article <chello.com>,
    C Lund <no> wrote:

    From your other replies above this, I presume renaming your NSDoent
    subclass works now.
     

    You may have to add them to the "First Responder" class entry in the
    "Classes" tab of your NIB file.
     

    So far, what you'e doing is still well inside the scope that can be
    done without messing with subclasses of NSDoent(Controller) etc...
     

    Did you write a "currentDoent" method for your controller class?
    What does it look like? The current doent (in your case) is the
    "File's Owner" in the NIB for your doent. So, have you hooked up the
    controller class's currentDoent outlet to the File's owner? If not,
    since nobody's assigning it a value, it's no surprise it's nil.
     

    There's not much difference here. He has a chapter on the responder
    chain, which details how to hook up your menu item with the "First
    Responder" icon, and then you just add an action method of the same name
    to your doent, and it should pick it up.
     

    Read about the first responder, it's exactly for this purpose. Hook up
    anything that is to go to the current text field, or current doent,
    to the first responder, and as soon as your object is in the responder
    chain, and nobody below it catches the message, your object will get it.

    Cheers,
    -- M. Uli Kusterer
    http://www.zathras.de
    Uli Guest

  11. #11

    Default Re: Renaming MyDoent

    In article <t-online.com>,
    Uli Kusterer <de> wrote:
     
    >
    > Did you write a "currentDoent" method for your controller class?
    > What does it look like?[/ref]

    Write...? I was under the impression that currentDoent was a part
    of the BSDoentController class. That's the impression I got from
    reading the docs, anyway. "Returns the NSDoent object associated
    with the main window." But it seems like I won't be needing to get
    this to work.

    As for the other points, I think I've manged to get them to work now,
    thanks to you guys.

    --
    C Lund, www.notam02.no/~clund
    C Guest

Similar Threads

  1. renaming ftp upload
    By CF Nut in forum Macromedia ColdFusion
    Replies: 5
    Last Post: May 19th, 02:20 PM
  2. DB2 Server Renaming
    By Remove in forum IBM DB2
    Replies: 2
    Last Post: October 6th, 12:44 PM
  3. renaming problem.....Help me !
    By kwang woo lee in forum Macromedia Director Lingo
    Replies: 1
    Last Post: September 17th, 03:43 AM
  4. Renaming files
    By Grand Wazoo in forum Adobe Photoshop Elements
    Replies: 0
    Last Post: August 4th, 05:17 AM
  5. Renaming Folders
    By ubu webforumsuser@macromedia.com in forum Macromedia Dreamweaver
    Replies: 1
    Last Post: July 16th, 01:00 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