brendand / mbtablegrid

An NSControl subclass which provides a spreadsheet-style table grid
9 stars 3 forks source link

Auto-save column widths and positions in NSUserDefaults #26

Closed brendand closed 9 years ago

brendand commented 10 years ago

Allow developer to provide an identifier used for identifying the MBTableGrid object. The identifier will be used as a key in the user defaults along with the column identifiers to auto-save the widths and positions.

For example:

"MBTableGrid Columns records-table-98190C92-A354-4D00-966F-567C6453654D" =     {
    "C-0" =         {
        AutosavedColumnHidden = 0;
        AutosavedColumnIndex = 0;
        AutosavedColumnWidth = "126.2031";
    };
    "C-1" =         {
        AutosavedColumnHidden = 0;
        AutosavedColumnIndex = 1;
        AutosavedColumnWidth = 100;
    };
};

Where records-table-98190C92-A354-4D00-966F-567C6453654D is the developer provided grid component identifier. C-0 and C-1 are the column identifiers. Eventually this would be extended to remember row heights.

AutosavedColumnIndex represents the position of the column in the table. Meaning, C-0 doesn't necessarily have to be the first column displayed. C-1 could be displayed before C-0 if the user had dragged C-1 to the left of C-0.

kdbdallas commented 9 years ago

Finished in commit d79836286d25cc70a4caed0fc062f4be2da66241