i want to implement NSForm view in my application i am new in cocoas application.can you advice me about this controller?Thanks in advance.
There are different ways you can use NSForm in your application.
- Adding NSForm in your nib file
- Create NSForm by programming and attach that NSform in your view of window.
@2 I have one example with me with which you can understand
NSWindow*window = [self window]; // gets current widnow NSView *theContentView = [window contentView]; // gets view from window
NSRect contentRect = [theContentView frame]; // gets frame from view
NSRect formRect = NSMakeRect( 0, 50, 300, 220 ); // creates new frame
NSForm *theForm; theForm = [[NSForm alloc] initWithFrame:formRect]; // init with frame fromRect
NSFormCell *theFormCell; // create cell for form
// defines first cell with field First Name theFormCell = [theForm addEntry:@"First Name:"]; [theFormCell setTag:EContactFieldTag_FirstName];
// defines first cell with field Last Name
theFormCell = [theForm addEntry:@"Last Name:"];
[theFormCell setTag:EContactFieldTag_LastName];
[theForm setCellSize:NSMakeSize( 300, 25 )]; // defines size for cell [theForm sizeToCells];
[theForm setKeyCell:theFormCell]; // assign cell to form
[theContentView addSubview:theForm]; // add form to current view
I think this should help you get started.
Let me know if you have any questions.