Re: NSTableView - preventing user moving with mouse
Re: NSTableView - preventing user moving with mouse
- Subject: Re: NSTableView - preventing user moving with mouse
- From: Peter Hudson <email@hidden>
- Date: Mon, 21 Nov 2011 17:06:32 +0000
Kyle
Kyle - Your guess was right - this is to do with the previous thread.
I am trying to make the line item table and the data table look like one table.
Your approach to scrolling the tables in sync works - but I still have
the original syncing problem :-
The issue remains that if I start scrolling in one table,
when I then continue the scroll in the other table, the table jumps to a different location
as the scroll commences. Its as though scrolling a table programmatically,
as we are doing, does not update some internal mechanism to do with its location.
I was busy going through the code I had written to see where the goof was ...
…but I have *another* issue I had not considered - I cannot get the selection bar to appear continuously
across both tables at the same time. I can fudge it - but it doesn't look right and will confuse people.
One feasible solution is to confine selection / scrolling to the data table only.
This works as far as the heuristics of the window is concerned.
Hence my question about preventing the user from being able to scroll
any of the other views apart from the data view.
I'll have a look at the simpler of your suggestions….
Peter
On 21 Nov 2011, at 16:33, Kyle Sluder wrote:
> On Mon, Nov 21, 2011 at 6:45 AM, Richard Somers
> <email@hidden> wrote:
>> On Nov 21, 2011, at 5:11 AM, Peter Hudson wrote:
>>
>>> I have an NSTableView whose position I want to control purely programatically.
>>>
>>> How do I stop the user from changing its position using the mouse - including two finger swipe gestures ?
>>
>> The position of the NSTableView is set with -initWithFrame: along with all of the various frame methods. Column adjustment is controlled with -setAllowsColumnReordering: and -setAllowsColumnResizing:.
>
> -initWithFrame: really doesn't matter here, since the table view is
> contained within an NSScrollView and will automatically resize itself
> to fit its content.
>
> Peter, AFAIK there's no way to disable user-initiated scrolling in an
> NSScrollView via API. If this is the same scenario as your previous
> thread, where you had one data table, a row header table, and a column
> header table, then you've got a couple of options as far as I can
> tell, all of them pretty advanced:
>
> 1. Subclass NSTableView and override -scrollWheel: and
> -swipeWithEvent: to do nothing. This is probably the easiest method,
> but the most likely to result in Whack-A-Mole of finding new ways that
> scrolling can be performed and plugging those holes. You might also
> need to subclass NSScrollView's implementation of these methods.
>
> 2. Embed the row and column NSTableViews inside NSClipViews _without_
> an enclosing NSScrollView. Change the code from our previous
> discussion to message the header views' clip views directly, rather
> than going through the -enclosingScrollView method. Essentially this
> means changing [tableView scrollPoint:] to [clipView
> setBoundsOrigin:].
>
> 3. Put all three table views inside one NSScrollView. Subclass
> NSScrollView and override -tile to arrange the three views correctly.
> Having tried similar things myself, this is a fairly difficult
> endeavor. It might not even be possible.
>
> Is there a particular reason you wish to disable user-initiated
> scrolling in this view? Perhaps you can just turn off visible
> scrollers in your other table views to maintain the illusion that this
> is just one big table view.
>
> --Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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