BSD

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • NSObjectController's removeObject just a stub?

    1 answers - 2817 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Hi guys, I am kind of curious about something
    Does NSController's actually work?
    NSArrayController's absolutely works but I suspect
    that NSController's is just a stub. If so, I will certainly
    report that as a bug to Apple (either to be fixed or fixed in the
    documentation) but I want to make sure my understanding is
    correct before I do. My bet is that I'm wrong and not Apple. :)
    Basically, I created a simple Cocoa application and did not add any
    extra code to it just messed with its MainMenu.nib. In the nib,
    I instantiated a NSController object and left "Automatically
    Creates Content" unchecked. Nextly, I created two buttons and set
    the controller as their targets; I set the first button's action to
    "add" in the controller, the other to "remove." My understanding is
    that these actions invoke the "" and "" methods
    within the controller. I then created a controller key -- "value" --
    keeping the controller's object class name set to
    NSMutableDictionary. Finally, I bound a couple of user interface
    widgets (a slider and text field) to "value" just for testing.
    So I ran the app and it started out by behaving exactly as I
    expected. With no selection object, the slider and text field were
    inactive. I clicked on my "Add" button and immediately the widgets
    came alive, working as normal. However, when I clicked on my
    "Remove" button, nothing happened. It's my understanding that my
    controller should have gone back to having no selection object and
    that should have disabled my slider and text field. To test my
    understanding, I bound two text fields to the controller's "canAdd"
    and "canRemove" keys and re-ran the app. Here are the results:
    App starts:
    Selection object: None
    Can add? Yes
    Can remove? No
    After click on Add button:
    Selection object: Available
    Can add? No
    Can remove? Yes
    After click on Remove button:
    Selection object: (Still) Available
    Can add? No
    Can remove? Yes
    I setup another simple application, this time using a table and an
    NSArrayController and and worked exactly as
    advertised. canAdd and canRemove also reported exactly what I
    expected. Now according to the documentation:
    #//apple_ref/doc/uid/
    TP40002147-183285-BBCDFJHD
    and are synonymous with setContent with
    passing nil as an argument. But I am not sure that it
    really is passing nil.
    Am I missing something?
    Do not post admin requests to the list. They will be ignored.
    Cocoa-dev mailing list (Cocoa-dev (AT) lists (DOT) apple.com)
    Help/Unsubscribe/Update your Subscription:
    %40developershed.com
    This email sent to bsdarchive (AT) developershed (DOT) com
  • No.1 | | 972 bytes | |

    Just a follow-up

    A well-known soul in the Cocoa community suggested that I subclass
    NSController and implement and observe the
    results. To be honest, I was kind of thinking of doing something
    like that probably should have before I posted to the list.

    Anywho, I did override :
    - (void):(id)object
    {
    [super :object];
    [self setContent:nil];

    NSLog(@"My got called");

    return;
    }

    and that makes my subclass of NSController work just as
    advertised in the documentation. So I guess I have a bug to report.
    It's unlikely this bug would matter in production code
    still :) And at least this is fixable. :)

    Thanks guys!

    Do not post admin requests to the list. They will be ignored.
    Cocoa-dev mailing list (Cocoa-dev (AT) lists (DOT) apple.com)
    Help/Unsubscribe/Update your Subscription:
    %40developershed.com

    This email sent to bsdarchive (AT) developershed (DOT) com

Re: NSObjectController's removeObject just a stub?


max 4000 letters.
Your nickname that display:
In order to stop the spam: 8 + 7 =
QUESTION ON "BSD"

EMSDN.COM