Perspx/PXListView — Issue #21: Creatog PXListView programmatically
Author: loretoparisi
Created: 2011-10-20 13:25:18+00:00
State: open

I need to create the PXListView programmatically. I achieved to create the view and the rows, but scrolling is not working.

searchListView = [[PXListView alloc] initWithFrame:NSMakeRect(origin.x, origin.y, size.width, size.height)];
[searchListView setDelegate:self];
[searchListView setCellSpacing:2.0f];
[searchListView setAllowsEmptySelection:YES];
[searchListView setAllowsMultipleSelection:NO];
//[searchListView registerForDraggedTypes:[NSArray arrayWithObjects: NSStringPboardType, nil]];

PXListDocumentView *searchDocView = [[PXListDocumentView alloc] initWithFrame:NSMakeRect(origin.x, origin.y, size.width, size.height)];
[searchDocView setListView:searchListView];
[searchListView setDocumentView:searchDocView];

searchListItems = [[NSMutableArray alloc] init];

//Create a bunch of rows as a test
for( NSInteger i = 0; i < 10; i++ )
{
NSString *title = [[NSString alloc] initWithFormat: @"Item %d", i +1];
[searchListItems addObject:title];
[title release];
}

[searchListView reloadData];

// just as a test I put the document view as the content view of a window
[window setContentView:searchDocView];

What's wrong?