So I have a task of reading from an xml file which contains a description of what form fields and comboboxes should exist in a dialog. I started by using NSForm and addentry to add the form fields, but then found out NSMatrix may be required to add combobox cells dynamically.
So my questions are:
1) Since NSForm inherits from NSMatrix can I add combobox cells to NSForm after I add the text fields.
2) If I have to use NSMatrix, does anyone have any good sample code they can point me to or write which adds a text field, and combobox to it at runtime and then resizes the NSMatrix to fit its contents. A lot of books just describe what NSMatrix is, and show how to populare it using interface builder.
NSForm does not allow custom cell types (text field only) and NSMatrix takes only one cell type (you cannot have an NSMatrix that has a mix of NSTextFieldCell and NSComboBoxCell).
If you really need to create a variable number of rows of field + combo box, you’re going to have to manage the creation, layout, and destruction of these manually.
Alternatively, you might consider using collection views.
Update – If you’re targeting 10.7 and up and need better control than collection views offer, consider using view-based table views.