Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

medasmx

macrumors member
Original poster
Nov 9, 2008
89
0
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.
 

gnasher729

Suspended
Nov 25, 2005
17,980
5,566
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.

Could you copy and paste the code you are trying to compile? And is this within a function or method or not?
 

medasmx

macrumors member
Original poster
Nov 9, 2008
89
0
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
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.