Focus ring and layer-backed views

2013-03-01 Thread Oleg Krupnov
I have two custom views in a container view. The first view is a
custom layer-hosting view, the second one is an ordinary custom view
without layers.

Both views can have keyboard focus and draw focus rings around
themselves. As usual, the focus ring is drawn partially on the
superview.

In the first view, I have a CALayer stretching a bit beyond around the
frame of the view so that it can display the focus ring. The second
view simply calls NSSetFocusRingStyle() and relies on Cocoa for
drawing on the superview.

Now I have a problem that the focus ring gets clipped by the view
frame in either of two cases.

If the container view is not layer-based (wantsLayer == NO), then the
first view's focus ring gets clipped, but the second view's focus ring
is fine. Else if the container view is layer-based (wantsLayer ==
YES), then the first view's focus ring is fine, but the second's is
clipped.

It seems like a known problem. Is there some workaround?

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/archive%40mail-archive.com

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


Re: 2 icons showing in dock

2013-03-01 Thread Rob McBroom
On Feb 28, 2013, at 6:22 PM, Rick C. rickcort...@gmail.com wrote:

 You're having the same issue?  FWIW I moved it to 
 applicationWillFinishLaunching and changed it to NSApplication activation 
 policy and I see no difference in the behavior…

So you are able to reproduce it? Any tips? I’ve tried everything I can think 
of. Different users, with and without “restoring windows”, putting two copies 
of the app in different places and having the one in a non-standard location 
launch at login, etc.

-- 
Rob McBroom
http://www.skurfer.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: Focus ring and layer-backed views

2013-03-01 Thread Kyle Sluder
On Mar 1, 2013, at 1:26 AM, Oleg Krupnov oleg.krup...@gmail.com wrote:

 
 It seems like a known problem. Is there some workaround?

This is why Apple added the -drawFocusRingMask API. Try using that instead of 
drawing the focus ring manually.

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

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


Re: Custom control with 4 vertical sliders

2013-03-01 Thread Gordon Apple
Ah! A Boilermaker.  Did my MS and PhD there in EE may years ago, before I
went to Bell Labs.

I just suggested a collection view because they are so easy to use when you
need an array of identical views bound to an array of objects via the
represented object.  You just create the prototype and let the collection
view do the replication work.


On 2/23/13 11:59 PM, N!K pu56ucl...@alumni.purdue.edu wrote:

 I've been following this thread because I have a similar application in mind,
 displaying 6 sets (groupings, not NSSets)  consisting of a label with slider
 and
 textview, both bound to an ivar.
 
 It seems so simple: create a custom view with one set, duplicate it to make 6
 such custom views, and place them all into another custom view.
 I'm not advanced enough to understand why there's a discussion.
 
 On the other hand, there seems to be interest in more complex ways, which
 implies that there are advantages in them that I don't see. Specifically, I
 don't see advantage in going on with collection views or boxes, and I don't
 know what you would do with a subclass (of what?).
 
 What am I missing? It must be elementary.


___

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: Documents not opening from Finder

2013-03-01 Thread Steve Mills
On Feb 28, 2013, at 02:35:18, Uli Kusterer witness.of.teacht...@gmx.net wrote:

 Opening internally sends Apple Events. Have you checked whether theopen 
 document Apple event is sent and whether it looks any different? My guess is 
 they won't use that for the open panel, but maybe they do and something's 
 broken there?

I have tons of experience with AppleEvents under Carbon, but none under Cocoa. 
Where does that event come in?

I've added an NSDocumentController subclass to see if any of its document 
opening methods are being invoked. If I print a document from Finder, these 2 
methods are called:

-(id) openDocumentWithContentsOfURL:(NSURL*)absoluteURL 
display:(BOOL)displayDocument error:(NSError**)outError
-(id) makeDocumentWithContentsOfURL:(NSURL *)absoluteURL ofType:(NSString 
*)typeName error:(NSError **)outError

If I close the document and then open a document via my app's Open Recent 
submenu, nothing happens and none of them get hit. If I go through the Open 
menu item, these get hit:

-(IBAction) openDocument:(id)sender
-(NSInteger) runModalOpenPanel:(NSOpenPanel *)openPanel forTypes:(NSArray 
*)types
--returns 1

But nothing else happens. To rule out our internal print code, I can open 
documents via our Open or Open Recent menu items, Print, and Close any number 
of times and things keep working correctly. It's only when we're commanded to 
open and print from Finder that things get messed up. Maybe because we don't 
close the document when we're done, but let the user do it manually?

--
Steve Mills
office: 952-818-3871
home: 952-401-6255
cell: 612-803-6157



___

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: Documents not opening from Finder

2013-03-01 Thread Quincey Morris
On Mar 1, 2013, at 13:59 , Steve Mills smi...@makemusic.com wrote:

 I have tons of experience with AppleEvents under Carbon, but none under 
 Cocoa. Where does that event come in?

I think the diversion into Apple Events is something of a red herring, at least 
at this stage of your debugging. Requests to open and print may indeed arrive 
at your app as Apple Events, but the best place to intervene is in 
NSApplicationDelegate protocol. By default, all such external requests should 
end up at one or other of the delegate protocol methods.

If they don't get there, it seems likely the Finder isn't sending them. That 
wouldn't solve your problem, of course, but it would tell you that looking in 
your app's code isn't going to get to the solution.


___

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


Syncing CATiledLayer drawInContext: with setAffineTransform:

2013-03-01 Thread Dave Fernandes
I'm using a CATiledLayer to plot a stream of data points in real-time on iOS 6. 
When the user pinches to zoom in either X or Y, I need to zoom the plot. To 
avoid lots of flashing during redraws, I use an affine transform *during* the 
zoom gesture, but then redraw the plot after the gesture is complete.

This works, but there is an instant where I need to transition from the 
zoomed-by-transform plot to the zoomed-by-redrawing plot. Where is the 
appropriate place to reset the transform to the identity transform? Doing it in 
drawInContext: seems to work most but not all of the time (sometimes it flashes 
or fails to redraw correctly - presumably a race condition). Ditto for a 
dispatch_async to the main queue.

Note: all drawing in drawInContext is done using CGContextXXX methods.

I am going about this the wrong way?

Thanks,
Dave
___

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: Documents not opening from Finder

2013-03-01 Thread Steve Mills
On Mar 1, 2013, at 16:21:35, Quincey Morris 
quinceymor...@rivergatesoftware.com wrote:

 I think the diversion into Apple Events is something of a red herring, at 
 least at this stage of your debugging. Requests to open and print may indeed 
 arrive at your app as Apple Events, but the best place to intervene is in 
 NSApplicationDelegate protocol. By default, all such external requests should 
 end up at one or other of the delegate protocol methods.
 
 If they don't get there, it seems likely the Finder isn't sending them. That 
 wouldn't solve your problem, of course, but it would tell you that looking in 
 your app's code isn't going to get to the solution.

Sorry, I still consider myself a newbie in Cocoaland. I can add those open and 
print overrides to my NSApplicationDelegate, but I only want to be able to set 
breakpoints on them but still let the default behavior happen. Since 
NSApplicationDelegate doesn't actually implement those methods, I can't simply 
call [super application:sender openFiles:filenames]; to get that default 
behavior. So what do I do? I need everything to work at least once in the 
normal way so I can then see which methods might not be getting called when 
things start going wrong.

--
Steve Mills
office: 952-818-3871
home: 952-401-6255
cell: 612-803-6157




___

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: Documents not opening from Finder

2013-03-01 Thread Quincey Morris
On Mar 1, 2013, at 14:59 , Steve Mills smi...@makemusic.com wrote:

 Sorry, I still consider myself a newbie in Cocoaland. I can add those open 
 and print overrides to my NSApplicationDelegate, but I only want to be able 
 to set breakpoints on them but still let the default behavior happen. Since 
 NSApplicationDelegate doesn't actually implement those methods, I can't 
 simply call [super application:sender openFiles:filenames]; to get that 
 default behavior. So what do I do? I need everything to work at least once in 
 the normal way so I can then see which methods might not be getting called 
 when things start going wrong.

Well, yes, good point. Answers are buried in here:


https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ScriptableCocoaApplications/SApps_handle_AEs/SAppsHandleAEs.html#//apple_ref/doc/uid/20001239

under the heading Apple Events Sent by the Mac OS. That brings us back to 
AppleEventland, in a sense, but the point is to pull out of this documentation 
the standard invocations of NSDocumentController or NSDocument methods, and use 
those in your app delegate methods.

Unfortunately, this document appears to date from 10.4 times, but it should 
lead you to the information you want. In practice, you'll likely only care 
about providing 2 app delegate methods: 'application:openFile:' (or 
'application:openFiles:') and 
'application:printFiles:withSettings:showPrintPanels'.

___

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


Core Text attributed strings and NSTextField incompatibility

2013-03-01 Thread Graham Cox
Parts of my app use Core Text. I build an CFAttributedStringRef which contains 
attributes as defined by CTStringAttributes, which are needed to render the 
text with Core Text, which all works fine.

A different part of my app provides an interface to edit this text. On the Mac, 
this uses NSTextField. I cast by CFAttributedStringRef to NSAttributedString 
and try to set it in the text field using -setAttributedStringValue:

Chaos ensues, with the text system throwing exceptions all over the place, and 
eventually crashing with a EXC_BAD_ACCESS.

CFAttributedString is toll-free bridged to NSAttributedString, but the new Core 
Text attributes are wholly incompatible, apparently, with the classic 
NSAttributedString handling classes such as NSTextField. I find myself 
surprised by this, that a whole slew of new attributes were defined for Core 
Text without updating existing code to handle them gracefully. That's very bad 
not joined up thinking on Apple's part. There are now two entirely 
incompatible variants of NSAttributedString that can't be distinguished 
externally, one variety of which will cause severe problems for all the 
existing code that handles these objects.

Unless I'm doing something wrong of course

Has anyone else run into this? Am I expected to do Apple's work and go through 
every possible attribute of an NSAttributedString and sanitise it so that it 
works both with Core Text and the classic text system? This seems wrong, but 
after investigating the problem it appears that I have no choice. I find myself 
baffled that Apple has done this, which is why I wonder if I've missed 
something.

--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


Re: OS X Collection Views videos?

2013-03-01 Thread Scott Anguish
Collection Views on Mac OS X predate 2012. Try 2010.

Also, there is a conceptual document on them now.


On Feb 15, 2013, at 4:58 PM, Rick Mann rm...@latencyzero.com wrote:

 Yeah, I saw those, but figured they wouldn't have much applicable. Maybe I'll 
 skim through them.
 
 On Feb 15, 2013, at 13:51 , Jean Suisse jean.li...@gmail.com wrote:
 
 Well, there are session 205  219 of WWDC2012, but I think both are 
 exclusively about IOS6. Might be worth fast forwarding through them, thought.
 Jean
 
 
 On 15 févr. 2013, at 22:46, Rick Mann rm...@latencyzero.com wrote:
 
 Are there any WWDC videos covering Cocoa Collection Views (not iOS 
 Collection Views)? I just looked through the titles online, but it's hard 
 to discern, and doesn't look like there are any expressly dedicated to the 
 topic.
 
 
 -- 
 Rick
 
 
 
 
 ___
 
 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/jean.lists%40gmail.com
 
 This email sent to jean.li...@gmail.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/rmann%40latencyzero.com
 
 This email sent to rm...@latencyzero.com
 
 
 -- 
 Rick
 
 
 
 
 ___
 
 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/scott%40cocoadoc.com
 
 This email sent to sc...@cocoadoc.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