NSBrowser active column problem
NSBrowser active column problem
- Subject: NSBrowser active column problem
- From: Patrick Haruksteiner <email@hidden>
- Date: Tue, 29 Mar 2005 17:35:37 +0200
Hi!
I have a problem with NSBrowser. In my App there are 2 views - an
outline and a browser view, displaying files/folder hirarchies. The
selections of both views are kept in sync, but if I switch from outline
to browser view, the selected items (lets say in the 3rd browser
column) are higlighted gray (!), and the "active" column seems to be
the first one of this path (it is highlight in color and responds to
the arrow keys...) - it looks like the path was selected right, but the
focus of the browser is on the wrong (first, not last) column...
How do I tell the browser that the last column should be the active one?
/patrick
P.S.:
I use setPath: to set the correct path in the NSBrowser and then select
the items in the matrix of the last column via
setSelectionFrom:to:anchor:highlight:
some code sniplets for "better" understanding:
[_fileBrowser setPath:[_fileOutlineView itemAtRow:[selectedRows
firstIndex]]]; //sync directory with NSOutlineView
int count = [_fileOutlineView numberOfRows];
NSMatrix *browserMatrix = [_fileBrowser
matrixInColumn:[_fileBrowser selectedColumn]];
[browserMatrix deselectAllCells];
//found no better way for multiple selection of no-neighbour items
(neigbour-items could be selected via –
setSelectionFrom:to:anchor:highlight:)
NSMutableArray *outlineSelectedItems = [NSMutableArray
arrayWithCapacity:[selectedRows count]];
for(i = 0; i <= count; i++){ //selected item names
if([selectedRows containsIndex:i]){
[outlineSelectedItems addObject:[[_fileOutlineView itemAtRow:i]
lastPathComponent]];
}
}
for(i = [browserMatrix numberOfRows]-1; i >= 0 ; i--){ //sync
selected items (reverse order to emulate finder behavior on multiple
selects with dirs)
if([outlineSelectedItems containsObject:[[browserMatrix
cellAtRow:i column:0] title]]){
[browserMatrix setSelectionFrom:i to:i anchor:i highlight:YES];
}
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden