nsmatrix

Discussion in 'Mac Programming' started by medasmx, Dec 28, 2008.

  1. medasmx macrumors member

    Joined:
    Nov 9, 2008
    #1
    Code:
    prototypeTextField=[[NSTextField alloc]init];
    NSMatrix*myMatrix1 = [[NSMatrix alloc] 
        initWithFrame:NSMakeRect(138.0f, 85.0f, 0.0f, 0.0f)
        mode:NSRadioModeMatrix
        prototype:prototypeTextField 
        numberOfRows:1 
        numberOfColumns:3];
    
    Above is the code for a matrix, made up of three textFields inside a custom view. It is supposed to set up the matrix that inputs data. I get the error -- "error: initializer element is not constant". Any ideas? Thanks, Adam.
     
  2. gnasher729 macrumors P6

    gnasher729

    Joined:
    Nov 25, 2005
    #2
    Could you copy and paste the code you are trying to compile? And is this within a function or method or not?
     
  3. medasmx thread starter macrumors member

    Joined:
    Nov 9, 2008
    #3
    nsmatrix-fullcode

    Enclosed is the full code. Wish I knew how to copy from the nib file, so I could send that too. Basically, it has two custom view items, with text fields inside. The first one inputs a string, and two numbers. This then goes into the second matrix, in row and column inputted. Thanks.

    Adam

    #import "asmcv.h"
    @implementation asmcv

    prototypeTextField=[[NSTextField alloc]init];
    NSMatrix*myMatrix1 = [[NSMatrix alloc]
    initWithFrame:NSMakeRect(138.0f, 85.0f, 0.0f, 0.0f)
    mode:NSRadioModeMatrix
    prototype:prototypeTextField
    numberOfRows:1
    numberOfColumns:3];

    prototypeTextField=[[NSTextField alloc]init];
    NSMatrix*myMatrix2 = [[NSMatrix alloc]
    initWithFrame:NSMakeRect(138.0f, 85.0f, 0.0f, 0.0f)
    mode:NSRadioModeMatrix
    prototype:prototypeTextField
    numberOfRows:2
    numberOfColumns:2];

    myString=[[NSString alloc]init];
    int i,j;
    i=[myMatrix1 selectCellAtRow:1 Column:2];
    j=[myMatrix1 selectCellAtRow:1 Column:3];
    myString=[myMatrix1 selectCellAtRow:1 Column:1];

    myCell=[myMatrix2 makeCellAtRow:i column:j];
    theTarget=[myCell target];
    [myCell setTarget:theTarget];
    [myCell setAction:mad:selector(myButton:)];

    @end
     

Share This Page