alexrozanski / PXSourceList

Source List control for the Mac
Other
639 stars 77 forks source link

Adding items dynamically behaving funny #12

Open coneybeare opened 13 years ago

coneybeare commented 13 years ago

I am adding items to the source list dynamically using the following code:

    - (void)addPlaylist:(NSNotification *)notification {
        // Create a core data
        UABaseNode *node = [[UAModelController defaultModelController] createPlaylistBaseNode];
        [sourceList expandItem:[node parent]];
        [sourceList reloadData];
        [sourceList noteNumberOfRowsChanged];
        NSInteger row = [sourceList rowForItem:node];
        [sourceList scrollRowToVisible:row];
        [sourceList selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO];
        [sourceList editColumn:0 row:row withEvent:nil select:YES];
    }

and although items are added, the focus is not applied correctly and the following weird behavior happens: http://screencast.com/t/ZV4Nd3vWD

Notice how I am typing in a cell but directly on top of the previous value. Clicking away and editing the cell by pressing enter works fine. It is only when trying to add an element dynamically, then set it to editing mode programmatically that this happens.

coneybeare commented 13 years ago

I have been hacking at this for hours now and can't figure out what could be causing this behavior. Do you think you could update your sample project with and add/delete button to show how editing the sourcelist can be done dynamically?