Re: Sizing NSScrollView width to exactly fit NSTableView

2015-07-08 Thread Jonathan Mitchell
Hi

Try constraining the document view (your table view in this case), to the width 
of the scroll content view (the NSClipView instance).
You will also need to ensure that the columns are sized in such a way as to fit 
the prevailing table view frame width.

   NSDictionary *viewsDict = @{@"documentView" : self.view, @"contentView" 
: scrollView.contentView};
   NSString *vfl = nil;
   vfl = @“H:|-0-[documentView]-0-|";
   NSArray *vConstraints = [NSLayoutConstraint 
constraintsWithVisualFormat:vfl options:0 metrics:nil views:viewsDict];
   [scrollView.contentView addConstraints:vConstraints];

HTH

Jonathan

> On 7 Jul 2015, at 16:07, Matthew LeRoy  wrote:
> 
> Hi,
> 
> I’m trying to figure out how to correctly calculate the required width of an 
> NSScrollView such that it will exactly fit the NSTableView inside, with no 
> horizontal scroller and no “filler column” to the right of the last column in 
> the table.
> 
> The number of columns in the table changes based on the selection in an 
> NSPopUpButton elsewhere on the screen. The columns are all the same width and 
> are not resizable. When a new selection is made in the popup button, I want 
> to reset the table with however many columns correspond to that selection, 
> and then resize the scroll view’s width to exactly fit those columns. Both 
> the height of the scroll view and the number of rows in the table are fixed, 
> and there are more rows than will fit in the scroll view’s height so there 
> will always be vertical scrolling — either legacy or overlay style depending 
> on the user’s preference — so I need to account for the width of the vertical 
> scroller when calculating the required width of the scroll view, if using a 
> legacy scroller.
> 
> From reading the docs, I gather that [NSScrollView 
> frameSizeForContentSize:horizontalScrollerClass:verticalScrollerClass:borderType:controlSize:scrollerStyle]
>  can be used to calculate the required frame size for the scroll view — but I 
> don’t know how to calculate the required size of the table view to pass as 
> the first argument (contentSize). I tried simply summing the column widths 
> and using a dummy value for the height (since the height of the scroll view 
> is fixed anyway), but that didn’t quite work (as I expected it wouldn’t) — 
> the returned size wasn’t wide enough.
> 
> Any pointers?
> 
> Thanks!
> ___
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/jonathan%40mugginsoft.com
> 
> This email sent to jonat...@mugginsoft.com

Regards

Jonathan Mitchell
Mugginsoft LLP

jonat...@mugginsoft.com
-
KosmicTask - the Integrated Scripting Environment for OS X.
http://www.mugginsoft.com/KosmicTask
-
Follow on Twitter @KosmicTask
-
Github http://github.com/mugginsoft













___

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

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

Re: Predicate warning from text view

2015-07-08 Thread David Durkee
I am seeing this in my application too, and turning off Markup did eliminate 
it. I was really glad to see your email about that. Makes me want to see if any 
other mysterious bugs go away with Markup turned off.

In my case it is not a subclass of a NSTextView, but a straight instance of one.

David

> On Jul 8, 2015, at 12:23 AM, Shane Stanley  wrote:
> 
> On 25 Oct 2014, at 10:23 am, Martin Wierschin  wrote:
> 
>>> I have a subclass of a text view in my app. When I double-click on other 
>>> than a word (ie, a space or return), I get entries like these in the 
>>> Console:
>>> 
>>> _NSExtensionIsSafeExpressionForObjectWithSubquerySubstitutions: Expression 
>>> considered unsafe: SUBQUERY(extensionItems, $extensionItem, 
>>> $extensionItem.attachments.@count == 1 AND 
>>> SUBQUERY($extensionItem.attachments, $attachment, (NOT ANY 
>>> $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.adobe.pdf") AND 
>>> (NOT ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO 
>>> "public.image")).@count == 0).@count
>> 
>> 
>> I observed this log statement during the Yosemite beta period, on a stock 
>> system with no additional extensions/apps installed, aside from my own app 
>> being tested on OS X 10.10. My app (which also uses an NSTextView subclass) 
>> produced that log statement, but TextEdit also produced a very similar log:
>> 
>>> TextEdit[578]: 
>>> _NSExtensionIsSafeExpressionForObjectWithSubquerySubstitutions: Expression 
>>> considered unsafe: SUBQUERY($extensionItem.attachments, $attachment, ANY 
>>> $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.image")
>> 
>> 
>> I filed it as rdar://17541734  which was marked as a 
>> duplicate of rdar://17432480  which is apparently closed 
>> now. Perhaps the problem was reintroduced, or this has a different source? 
>> 
>> In any case, I never observed any actual ill effects in my app whenever the 
>> logging was triggered.
> 
> Just coming back to this...
> 
> I *think* that the number of these entries seems to have increased since I 
> upgraded to 10.10.4  -- Console can be flooded with dozens at a time. But 
> I've also found that they *stop* if turn off the Markup extension, and start 
> back up when I turn it back on.
> 
> Can anyone else who is seeing the problem confirm that turning Markup solves 
> the problem? nd aAny thoughts on how I might get Markup to stop poking in my 
> window, especially as it can't actually do anything there?
> 
> -- 
> Shane Stanley 
> 
> 
> ___
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/david%40dwdurkee.com
> 
> This email sent to da...@dwdurkee.com


___

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

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

Re: Predicate warning from text view

2015-07-08 Thread Shane Stanley
On 8 Jul 2015, at 9:49 pm, David Durkee  wrote:
> 
> I am seeing this in my application too, and turning off Markup did eliminate 
> it. I was really glad to see your email about that. Makes me want to see if 
> any other mysterious bugs go away with Markup turned off.
> 
> In my case it is not a subclass of a NSTextView, but a straight instance of 
> one.

FYI, my bug report has been closed as a duplicate since I posted, so I guess 
that's also confirmation of a sort.

-- 
Shane Stanley 



___

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

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

Re: selectText of NSTextField on focus

2015-07-08 Thread Willeke
> @implementation MyTextField
> 
> - (void)mouseDown:(NSEvent *)event
> {
>NSText *editor = self.currentEditor;
>assert(editor && "Current editor is nil!");
>assert(editor.isFieldEditor && "Editor not a field editor!");
>NSRange range = NSMakeRange(0, editor.string.length);
>[editor setSelectedRange:range];
> 
>[super mouseDown:event];
> }
> 
> @end

You're almost there, do  [super mouseDown:event] first.

- Willeke
___

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

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

Re: selectText of NSTextField on focus

2015-07-08 Thread Richard Charles

> On Jul 8, 2015, at 7:00 AM, Willeke  wrote:
> 
>> @implementation MyTextField
>> 
>> - (void)mouseDown:(NSEvent *)event
>> {
>>   NSText *editor = self.currentEditor;
>>   assert(editor && "Current editor is nil!");
>>   assert(editor.isFieldEditor && "Editor not a field editor!");
>>   NSRange range = NSMakeRange(0, editor.string.length);
>>   [editor setSelectedRange:range];
>> 
>>   [super mouseDown:event];
>> }
>> 
>> @end
> 
> You're almost there, do  [super mouseDown:event] first.

That works! Thank you so much for your help.

I have another question regarding focus ring animation for a text field. This 
is a document based application. In the document window there are many text 
fields. After opening a document window - the first time a text field is 
clicked there is no focus ring animation. Thereafter when any text field is 
clicked in the window the focus ring will animate.

Do you have any insight as to why the animation does not occur the first time a 
text field is clicked?

--Richard Charles


___

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

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

How to resize accessory view to match Open panel

2015-07-08 Thread Jonathan Taylor
I feel this should be a simple question, but I cannot find an answer that works.

I have an open panel to which I am trying to add an accessory view. That much 
works. However I would like the accessory view to resize to fit the width of 
the parent window. It’s just a textual description, after all.

An old thread here:
http://www.cocoabuilder.com/archive/cocoa/106875-setaccessoryview.html
suggests this is not trivial to do.

I have tried the suggested monitoring of NSWindowDidResizeNotification (and 
also tried NSViewFrameDidChangeNotification), and these don’t seem to work 
quite right. There have been plenty of OS changes since that thread was 
written, so probably no surprises there.

What happens is that it doesn’t seem possible to *shrink* the Open window (I 
guess the ‘hard’ size that I am setting for my view is affecting the minimum 
size of the overall window) and, much more alarmingly, I get crashes when 
resizing.

The alternative suggestion related to IB struts doesn’t seem to work for me 
either. I set all four edge struts and tried both with and without the 
‘resizeable’ arrows in the middle of the view. No effect.

Can anyone advise on the current and correct way of getting the accessory view 
to resize appropriately? It seems this should be a common desired behaviour, 
but haven’t had any luck doing it or finding any recent examples/advice on 
google…

Thanks
Jonny
___

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

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

Re: How to resize accessory view to match Open panel

2015-07-08 Thread Richard Charles

> On Jul 8, 2015, at 9:33 AM, Jonathan Taylor  
> wrote:
> 
> I have an open panel to which I am trying to add an accessory view. That much 
> works. However I would like the accessory view to resize to fit the width of 
> the parent window. It’s just a textual description, after all.

I have a preference panel window controller that adjusts the panel height based 
on which toolbar item is selected. You can see the same thing in the 
Preferences panel for a number of Apple’s applications (Mail, Preview, Safari). 
The understanding of how to do this came from "Cocoa Programming for OS X" 
Chapter 31 View Swapping and Custom Container View Controller by Hillegass.

There may be some similarities there to what you are doing.

--Richard Charles


___

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

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

Re: How to resize accessory view to match Open panel

2015-07-08 Thread Lee Ann Rucker
My accessory views use autolayout and that seems to work fine in 10.9 and up. 
In 10.8, you need

  [accessoryView layoutSubtreeIfNeeded];
  if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_8) {
 [accessoryView setTranslatesAutoresizingMaskIntoConstraints:YES];
  }



On Jul 8, 2015, at 8:33 AM, Jonathan Taylor  
wrote:

> I feel this should be a simple question, but I cannot find an answer that 
> works.
> 
> I have an open panel to which I am trying to add an accessory view. That much 
> works. However I would like the accessory view to resize to fit the width of 
> the parent window. It’s just a textual description, after all.
> 
> An old thread here:
> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.cocoabuilder.com_archive_cocoa_106875-2Dsetaccessoryview.html&d=BQIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=ie7S-J__EKnfyVOBV7-jV2rZ--p47O6vkyTklpDM3h4&m=cHbQmyTJpg2XJFwD6Ij_z3NjqhIEgWWn9zXrnGjjOxk&s=MuBFc9loNUfef9MsVOB-rZbhMfX4JwFpjj8iB_S-OzU&e=
>  
> suggests this is not trivial to do.
> 
> I have tried the suggested monitoring of NSWindowDidResizeNotification (and 
> also tried NSViewFrameDidChangeNotification), and these don’t seem to work 
> quite right. There have been plenty of OS changes since that thread was 
> written, so probably no surprises there.
> 
> What happens is that it doesn’t seem possible to *shrink* the Open window (I 
> guess the ‘hard’ size that I am setting for my view is affecting the minimum 
> size of the overall window) and, much more alarmingly, I get crashes when 
> resizing.
> 
> The alternative suggestion related to IB struts doesn’t seem to work for me 
> either. I set all four edge struts and tried both with and without the 
> ‘resizeable’ arrows in the middle of the view. No effect.
> 
> Can anyone advise on the current and correct way of getting the accessory 
> view to resize appropriately? It seems this should be a common desired 
> behaviour, but haven’t had any luck doing it or finding any recent 
> examples/advice on google…
> 
> Thanks
> Jonny
> ___
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/lrucker%40vmware.com
> 
> This email sent to lruc...@vmware.com


___

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

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

How can I make my application support splitview in El Capitan?

2015-07-08 Thread 周章林
Hi, all,

My application supports full screen, and I can use "Ctrl+Command+F" to make
my application window enter full screen mode in EI Capitan. I encounter a
problem when I try the split view node. When I hold-click on the green
expand window of Finder and put Finder window in the left side of split
view, and move mouse to my application window, it says "Not Available in
Full Screen". but when I hold-click on the green expand window of my
application window and put my application window in the left side, and I
can click the Finder window to put Finder window in the right side of split
view.

I found the Calendar.app have same behavior. I must make my application
window or Calendar.app window to enter split view mode first, and then make
other window like Finder window enter split view.

My question is: is this designed behavior? If it's not, how can I fix it in
my application? My application windows has been set
NSWindowCollectionBehaviorFullScreenPrimary already.

--zhanglin
___

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

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

Anyone recommend Dash?

2015-07-08 Thread Graham Cox

Is anyone using Dash for API documentation? Can you recommend it?

I received a bundle offer including this today and it seems like a good deal, 
but wonder if it’s worth using over and above XCode’s standard docs?

—Graham







___

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

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