Re: NSTableView first column reorder...
Re: NSTableView first column reorder...
- Subject: Re: NSTableView first column reorder...
- From: Chas Spillar <email@hidden>
- Date: Tue, 05 Dec 2006 15:42:16 -0800
- Thread-topic: NSTableView first column reorder...
So, I poked around the methods in NSTableView (with introspection) and
found:
- (BOOL) _userCanMoveColumn:(int)column toColumn:(int)nextIndex
{
return (newIndex != 0);
}
In addition, I included the obvious name that Apple will probably use if
they ever export this:
- (BOOL) userCanMoveColumn:(int)column toColumn:(int)nextIndex
{
return (newIndex != 0);
}
Overriding NSTableView with these methods causes the desired effect... You
can't move any other column into the 0th position.
Of course, the usual caveats apply... These are generally private methods
and can change without notice. Although, in this case, it is unlikely that
anything would change that wouldn't keep this working...
Chas.
> From: Chas Spillar <email@hidden>
> Date: Tue, 05 Dec 2006 11:31:39 -0800
> To: apparao <email@hidden>, Cocoa Dev List <email@hidden>
> Cc: Chas Spillar <email@hidden>
> Conversation: NSTableView first column reorder...
> Subject: Re: NSTableView first column reorder...
>
> So, my "solution" solves part of the problem. I can now not move the first
> column out of the first position, but I can move other columns into the
> first position... sigh :-< I really wish there was just a "don't move this
> column bit"...
>
> Chas.
>
>
>> From: Chas Spillar <email@hidden>
>> Date: Tue, 05 Dec 2006 11:24:12 -0800
>> To: apparao <email@hidden>, Cocoa Dev List
>> <email@hidden>
>> Cc: Chas Spillar <email@hidden>
>> Conversation: NSTableView first column reorder...
>> Subject: Re: NSTableView first column reorder...
>>
>> I found a solution...
>>
>> I implement the delegate method:
>>
>> - (void) tableView:(NSTableView *)tableView
>> mouseDownInHeaderOfTableColumn:(NSTableColumn *)tableColumn
>> {
>> if (tableView == myTableView) {
>> if ([tableColumn identifier] isEqualToString:@"title"])
>> [tableView setAllowsColumnReordering:NO];
>> } else {
>> [tableView setAllowsColumnReordering:YES];
>> }
>> }
>> }
>>
>> This has the desired effect. It prevents the drag from beginning at all on
>> the first column (which is what I wanted).
>>
>> Chas.
>>
>>
>>> From: apparao <email@hidden>
>>> Date: Tue, 05 Dec 2006 12:09:06 +0530
>>> To: Cocoa Dev List <email@hidden>
>>> Subject: Re: NSTableView first column reorder...
>>>
>>> Use - (void)tableView:(NSTableView *)tableView didDragTableColumn:
>>> (NSTableColumn *)tableColumn delegate method and skip first table
>>> column by using table identifier.
>>>
>>>
>>> On 05-Dec-06, at 9:50 AM, Chas Spillar wrote:
>>>
>>>> Hello,
>>>>
>>>> I want to enable an NSTableView which you can reorder all the
>>>> columns except
>>>> for the first one. That is, you can drag all the columns after the
>>>> first
>>>> one to different relative locations (e.g. You can drag column 2 to
>>>> position
>>>> 3, etc.) Does anyone know how I would do this?
>>>>
>>>> Chas.
>>>>
>>>>
>>>> _______________________________________________
>>>>
>>>> Cocoa-dev mailing list (email@hidden)
>>>>
>>>> Do not post admin requests or moderator comments to the list.
>>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>>>
>>>> Help/Unsubscribe/Update your Subscription:
>>>> 40effigent.net
>>>>
>>>> This email sent to email@hidden
>>>>
>>>
>>> Apparao
>>> ------------------------------------------------------------
>>> Apparao Mulpuri
>>> Effigent India Pvt. Ltd.
>>> Web: http://www.effigent.com
>>> ------------------------------------------------------------
>>>
>>>
>>>
>>> _______________________________________________
>>>
>>> Cocoa-dev mailing list (email@hidden)
>>>
>>> Do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>>
>>> Help/Unsubscribe/Update your Subscription:
>>>
>>> This email sent to email@hidden
>>
>>
>
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden