nsmatrix - calculator

Discussion in 'Mac Programming' started by medasmx, Apr 7, 2009.

  1. medasmx macrumors member

    Nov 9, 2008
    Below is code for a basic ten button nsmatrix(of numbers), which should output the number to a text-field. The difficulty I am having is setting the ibaction (mytextoutput) to the matrix -- I can't do it in the IB. It only allows myMatrix to be set to the matrix, Do I need to do this programatically. I have tried to read about tags but not getting anywhere. The program runs without errors but when pushing buttons nothing happens. Thanks. Adam.

    #import <Cocoa/Cocoa.h>

    @interface AppController : NSObject {
    IBOutlet NSTextField*myTextField;
    IBOutlet NSMatrix*myMatrix;


    #import "AppController.h"

    @implementation AppController

    [myTextField setStringValue:[[NSMatrix selectedCell]title]];

  2. kainjow Moderator emeritus


    Jun 15, 2000
    What do you mean you can't do it? When you control-drag from the matrix to your controller, do you see your myTextOutput: method show up in the list?

Share This Page