1

I want my each table cell to be scrollable since its editable.I am using

        self.nsChildTextFieldObj = [[NSTextFieldCell alloc] init];
        [self.nsChildTextFieldObj setControlView:self.controlView];
        [self.nsChildTextFieldObj setBackgroundStyle:self.backgroundStyle];
        [self.nsChildTextFieldObj setScrollable:YES];
        [self.nsChildTextFieldObj setFont:[NSFont fontWithName:appDelegate.selectedFont size:appDelegate.selectedFontSize]];
        [self.nsChildTextFieldObj setEditable:NO];

but my table view cell is not scrolling .Please help!

Swastik
  • 2,415
  • 2
  • 31
  • 61
  • What exactly do you mean by “scrollable”? Scroll bars, or making the user use the arrow keys during editing to scroll through it? And what do you mean by “child text field”—are you trying to embed cells in other cells? – Peter Hosey Apr 21 '11 at 04:24
  • Basically,I need to have a fixed size cell.The cell text can be editable by the user.So he can enter long text & he may be able to scroll the text. – Swastik Apr 21 '11 at 05:39
  • Can you give me some more information? Why are you putting a TextFieldCell inside another cell? What happens when you type a long line, is the text clipped, wrapped? – Francis McGrew May 03 '11 at 23:24
  • Dou you want the line in the table view to extend across multiple lines then? – Max Seelemann May 07 '11 at 00:50

1 Answers1

0

I think you can make use of sizeWithFont method.

Use it with every keypress or upon paste and change the height of self.nsChildTextFieldObj dynamically.

iMatoria
  • 1,450
  • 2
  • 19
  • 35
  • i need to fix my cell height fixed & able to scroll the text within that height. – Swastik May 10 '11 at 09:50
  • @Swastik: Either you need to set ContentHeight (or something similar) of NSTextFieldCell or of tableViewCell (use heightForRowAtIndexPath method). And to do that you need to use sizeWithFont method upon the text of NSTextFieldCell. – iMatoria May 10 '11 at 11:47