Women in Technology

Hear us Roar



Article:
  Working with Tables: Writing an Address Book Application
Subject:   Has anyone used NSTableView.SetAutosaveTableColumns() ?
Date:   2001-08-16 20:16:13
From:   jakem
In Interface Builder, when editing the attributes of a NSTableView there is a field called "AutoSave File Name". From reading the API I figured out that this is for specifying a file in which to automatically save a custom table layout (column width, order etc) for each user of the app. However, I can't get it to work!! I've specified some file names in Interface Builder, and called setAutosaveTableColumns(true) for each of my NSTableViews, but when I run the app, make modifications to the table layout, quit and run it again - the modifications aren't maintained. What am I doing wrong?? BTW I program in Java - I'd love pointers to any Java specific Cocoa resources!
Full Threads Oldest First

Showing messages 1 through 3 of 3.

  • more info...
    2001-08-16 20:57:54  jakem [View]

    I just realised where the problem is (I think!). Interface Builder does not save the information about a NSTableView's autoSave name!! I enter the name in the attribute field, save the .nib file, quit, re-open the .nib file and the autoSave field is blank again!! - strange :( I guess the only solution is to set the autoSave name programatically, using the SetAutosaveName() method. However, where do I place this call? any ideas?
    • Michael Beam photo more info...
      2001-08-16 22:33:37  Michael Beam | O'Reilly Author [View]

      That's weird that IB doesn't save the info. I've gotten it to work for me. Just a thought, did you press enter or click on another field after entering the autosave name before you saved the nib file? I had this problem when i was first learning how to tables and the column identifiers would never stick b/c i would type the name and then click another column header to do it again.

      If you want to set a table view's autosave name programatically, i think the best place to do this would be in awakeFromNib or whatever initialization method you use.

      You can also do the same thing for windows. If you look at a window's attributes in the info panel, you will notice a field for the window's title, and a seperate one for the window's name. The name they speak of here is an autosave name, and by giving it a name you're application will rememeber window size and position between launches.

      Mike
      • more info...
        2001-08-22 04:49:50  jakem [View]

        Well, I've tried everything and IB simply does not save my table's autosave name. I can enter a autosave name for the window and this works great.. but no autosave for a table. Could this be because may tables are within a tab pane?? Has anyone else had this problem?