views:

168

answers:

1

Hi Everyone:

Today I have a question that sprouted off of this one: http://stackoverflow.com/questions/1082840/database-results-in-cocoa. It's regarding using the data that was returned by a database to create a certain number of questions. I am using a form of the following code (this was posted in the question).

NSMutableDictionary * interfaceElements = [[NSMutableDictionary alloc] init];

for (NSInteger i = 0; i < numberOfTextFields; ++i) {
  //this is just to make a frame that's indented 10px
  //and has 10px between it and the previous NSTextField (or window edge)
  NSRect frame = NSMakeRect(10, (i*22 + (i+1)*10), 100, 22);
  NSTextField * newField = [[NSTextField alloc] initWithFrame:frame];
  //configure newField appropriately
  [[myWindow contentView] addSubview:newField];
  [interfaceElements setObject:newField forKey:@"someUniqueIdentifier"];
  [newField release];
}

However, now when I attempt to use IFVerticallyExpandingTextfield (from http://www.cocoadev.com/index.pl?IFVerticallyExpandingTextField), or create any large amount of text, it simply goes over the other drawn content. I looked into using setAutosizingMask: on the object, but it has not worked so far.

Thanks for any help.

EDIT: What I want the effect to look like is called "Correct TextField" and what happens is called "StackOverflow Sample" - http://www.mediafire.com/?sharekey=bd476ea483deded875a4fc82078ae6c8e04e75f6e8ebb871.

EDIT 2: And if no one knows how to use this IFVerticallyExpandingTextfield class, would anyone know if there is another way to accomplish the effect?

+1  A: 
Time Machine
Hi Koning: I'll definitely look into that link, but would you like me to upload some sample code so I can better show the problem?
PF1
If you think it will explain everything better, ofcourse!
Time Machine
I just updated the main post with a link to the files.
PF1
Thanks, now it's clear to me.
Time Machine
In reply to your newly edited main post, the problem with the project is that I want it to *look* like the "Correct" example but I want it to be drawn to the screen via code. And I'm not sure if that comment on the page will help in this situation, but I will definitely think about it!
PF1