Kyle -  

I've tried the suggestion of subclassing  -scrollWheel: and  swipeWithEvent: 
to prevent the table views being scrolled - and they work.

Many thanks

Peter




On 21 Nov 2011, at 16:33, Kyle Sluder wrote:

> On Mon, Nov 21, 2011 at 6:45 AM, Richard Somers
> <rsomers.li...@infowest.com> 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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to