Using NSButton and Action Invocation

  • First, my warning--this is a newbie question.

    I have a question about NSButton and Action Invocation binding. So, I
    have a simple Cocoa (Not a Document) app. It takes two values,
    eccentricity and eccentricAnomaly and uses these values in an
    instance method createMeanAnomalyWithEccentricty:andEccentricAnomaly:
    to calculate meanAnomaly.

    So, here's the code:

    MeanAnomaly.h
    MeanAnomaly.m
    #import <Cocoa/Cocoa.h>
    #import "MeanAnomaly.h"
    #import <math.h>

    @implementation MeanAnomaly
    .
    .
    .
    - (float) calculateMeanAnomalyWithEccentricity:(float)eccentricityNumber
                                andEccentricAnomaly:(float)
    eccentricAnomalyNumber
    {
        meanAnomaly = eccentricityNumber * sin(eccentricAnomalyNumber);
        return meanAnomaly;
    }
    .
    .
    .
    @end

    The interface has three text fields, one for each value. I have an
    NSObjectController, called MeanAnomalyController, which has a Class
    Object name of "MeanAnomaly". It is "connected" to and instance of
    MeanAnomaly in the MainMenu.nib. Using Cocoa Bindings, I have the
    fields bound to their keys,

    eccentricity
    eccentricAnomaly
    meanAnomaly

    and for the "Calculate!" NSButton, I used target-argument binding,

    target--        Bind To: MeanAnomalyController
                          Controller Key: selection
                          Model Key Path: (left blank)
                          Selector:
    calculateMeanAnomalyWithEccentricity:andEccentricAnomaly:

    and the arguments (2) are

    argument--    Bind To: MeanAnomalyController
                          Controller Key: selection
                          Model Key Path: eccentricAnomaly
                          Selector:
    calculateMeanAnomalyWithEccentricity:andEccentricAnomaly:

    argument 2-- Bind To: MeanAnomalyController
                          Controller Key: selection
                          Model Key Path: eccentricity
                          Selector:
    calculateMeanAnomalyWithEccentricity:andEccentricAnomaly:

    Building goes fine. Upon Run, I can enter info into the fields, but
    pressing "Calculate!" does nothing. I know I'm doing something bone-
    headed here, but just can't figure this out.

    Thanks.

    Jim Hillhouse
previous month june 2005 next month
MTWTFSS
    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      
Go to today