Menubar not always redrawing in 10.10

2014-10-20 Thread Mills, Steve
We're seeing a weird problem in 10.10. Inserting or removing items from the main menubar will often not cause the menubar to redraw. Clicking in the menubar or typing a key equiv used in a menu item will cause it to redraw. I've done quite a bit of dinking around to try to figure out if it's som

Re: Defer opening documents until app is fully inited

2014-09-22 Thread Mills, Steve
On Sep 20, 2014, at 08:51:32, Jerry Krinock wrote: > I’m surprised that works. I think I was in a similar situation about 4 years > ago. > > http://www.cocoabuilder.com/archive/cocoa/293279-very-simple-demo-modal-dialog-causes-later-modal-session-to-crash.html?q=applicationWillFinishLaunching+

Re: Defer opening documents until app is fully inited

2014-09-19 Thread Mills, Steve
On Sep 19, 2014, at 11:49:38, edward taffel wrote: > just out of curiosity—have you attempted this earlier, e.g. in NSApplication > init? No. I don't think that's the right place to do this sort of thing. And we're too late in the cycle now to make such a radical change. -- Steve Mills office

Defer opening documents until app is fully inited

2014-09-19 Thread Mills, Steve
Our app init (called from applicationWillFinishLaunching) needs to put up some modal dialogs. When one of these modals is dismissed, NSApplication proceeds to call application:openFiles:, but we haven't returned from applicationWillFinishLaunching yet, so we're not ready. I'm sure others have n

Re: NSTextAlignment Enum?

2014-09-01 Thread Mills, Steve
On Sep 1, 2014, at 11:44, "Keary Suska" wrote: > > One future-proof approach that occurred to me is to declare your own enum: > > typedef NS_ENUM(NSInteger, MYTextAlignment) { >MYInvalidTextAlignment= -1, >MYLeftTextAlignment= NSLeftTextAlignment, >MYRightTextAlignment

Re: NSTextAlignment Enum?

2014-09-01 Thread Mills, Steve
On Sep 1, 2014, at 5:51, "Dave" wrote: > > I have a method that takes a String and depending on it’s value needs to > return an NSTextAlignment type. However, if the string is invalid, then I > want to indicate that an error so I pass back -1. This is fine expect I get > warnings on this code:

Re: What is the modern Cocoa way to send an Apple Event to yourself?

2014-08-22 Thread Mills, Steve
On Aug 22, 2014, at 12:35:53, Kyle Sluder wrote: > On Fri, Aug 22, 2014, at 12:10 PM, Fritz Anderson wrote: >> On 22 Aug 2014, at 10:40 AM, Kyle Sluder wrote: >> >>> This is a very strange idea. Cocoa applications do not do this; they just >>> call straight into NSDocumentController. >> >> Ev

Re: Color closest to color

2014-06-17 Thread Mills, Steve
On Jun 17, 2014, at 06:43:54, Maxthon Chan wrote: > One easy-to-implement method: colour cube. > > Define a colour using its RGB values as a 3-tuple (r, g, b) and standard > colours (ri, gi, bi) (where i = 0..n).The square distance between the given > colour and a standard colour is (ri-r)^2+(

Re: Figuring out the file's owner class

2014-05-27 Thread Mills, Steve
On May 23, 2014, at 19:34:10, Graham Cox wrote: > If what you're really trying to do is to store a class in the nib such that > you can use that to instantiate the right kind of object for FO, I would say > that you're doing it wrong (™). What you probably want is some way in your > code to ma

Re: Figuring out the file's owner class

2014-05-27 Thread Mills, Steve
On May 23, 2014, at 19:28:32, Ken Thomases wrote: > I doubt it's possible to learn the design-time-specified class from the > objects of the loaded NIB. The technique you outline doesn't make sense. > The window from the NIB won't have a controller if the controller was File's > Owner and yo

Figuring out the file's owner class

2014-05-23 Thread Mills, Steve
We have some generic window loading code that must instantiate the window controller first, then calls initWithWindowNibName: on that. This made it impossible to provide a subclass of our generic window controller subclass in the xib, but now we need to do this. Since NSNib doesn't have a method

Window gets moved to the wrong location when changing screen resolution

2014-05-22 Thread Mills, Steve
Our app has a bunch of palettes (NSPanels). One of them is usually flush against the menubar and against the left edge of the monitor. These palettes have setMovable:NO set on them, because we needed to handle moving them ourselves so they will snap into place. When the screen res changes, we al

Re: Document being reopened on launch during modal dialog

2014-05-07 Thread Mills, Steve
On May 6, 2014, at 19:05:22, Graham Cox wrote: > The compromise we've adopted is to let all the documents open as normal > *then* show the dialog if necessary on top of them. That avoids the need to > capture the 'open' URLs, but it's only OK if you can accept the documents > being there - in

Re: Document being reopened on launch during modal dialog

2014-05-06 Thread Mills, Steve
On May 6, 2014, at 13:44:42, Quincey Morris wrote: > On May 6, 2014, at 11:23 , Mills, Steve wrote: > >> I'm looking at a crash log for our app that shows our app is initting. >> During init ([NSApplication finishLaunching]) we discover a problem and put >

Document being reopened on launch during modal dialog

2014-05-06 Thread Mills, Steve
I'm looking at a crash log for our app that shows our app is initting. During init ([NSApplication finishLaunching]) we discover a problem and put up a modal dialog using [NSApplication runModalForWindow:]. During this modal run loop, something has decided that it would be a great time to handle

Re: Get unmodified character for key matching

2014-03-27 Thread Mills, Steve
On Mar 27, 2014, at 13:24:33, Ken Thomases wrote: > If you want to know what key was pressed in a physical (or pseudo-physical) > sense, you should pay attention to the keyCode of the NSEvent. If you want > to know what a given key code maps to with the user's current keyboard > layout, you w

Re: Get unmodified character for key matching

2014-03-27 Thread Mills, Steve
Fixing one small correction in the first line: If I type command-shift-/, the OS sends '?' instead of '/' (edit: was '-') in the NSEvent's characters and charactersIgnoringModifiers properties when using an English keyboard. If using a German keyboard, typing command-shift-- will result in the

Get unmodified character for key matching

2014-03-27 Thread Mills, Steve
If I type command-shift-/, the OS sends '?' instead of '-' in the NSEvent's characters and charactersIgnoringModifiers properties when using an English keyboard. If using a German keyboard, typing command-shift-- will result in the NSEvent sending us '_' instead of '-'. How can I map the modifie

Re: How to prevent a temp folder from being deleted

2014-03-27 Thread Mills, Steve
On Mar 26, 2014, at 17:50:55, Kyle Sluder wrote: > Wouldn't it be better to stop fighting the system and put your files in > a more appropriate place, like inside the document wrapper or in your > Application Support directory? Application Support; that's an idea. -- Steve Mills office: 952-818

How to prevent a temp folder from being deleted

2014-03-26 Thread Mills, Steve
It appears that items in the TemporaryItems folder that are older than 3 days will be periodically deleted. (One of our guys found some Darwin docs that mention this.) This is a problem for users of our app that might keep it running for more than 3 days. We store a temp folder in there that mig

Re: menuNeedsUpdate for key equivalents?

2014-03-18 Thread Mills, Steve
On Mar 18, 2014, at 13:16:31, Jim Prouty wrote: > Because menuHasKeyEquivalent:forEvent:target:action: is asking only menu(s) > it knows about whether they contain the key equivalent, and we very likely > are about to change which menu/menu item has that key equivalent with our > just-in-time

Re: Key event data not available in eventRef

2014-03-04 Thread Mills, Steve
On Mar 4, 2014, at 16:16:53, Kyle Sluder wrote: > That doesn't seem right… if I press a dead key (like Option-e), then the > next unmodified space should insert an acute accent in whatever field > editor is first responder. If your code is triggered solely by virtual > key code, the user will be

Re: Key event data not available in eventRef

2014-03-04 Thread Mills, Steve
On Mar 4, 2014, at 13:51:31, Eric Schlegel wrote: > A little architectural background first: normally, when a keyboard event > first arrives in the HIToolbox event queue from the window server, the > initial contents are just as you saw - a keycode and key modifiers, but no > unicode values. T

Re: Key event data not available in eventRef

2014-03-04 Thread Mills, Steve
On Mar 4, 2014, at 13:03:34, Mills, Steve wrote: > I'm seeing something really odd. We get the NSEvent for the current keyDown > when the user types an unmodified space. From that we get the eventRef to > pass to some legacy code. Sometimes that EventRef will contain the co

Key event data not available in eventRef

2014-03-04 Thread Mills, Steve
I'm seeing something really odd. We get the NSEvent for the current keyDown when the user types an unmodified space. From that we get the eventRef to pass to some legacy code. Sometimes that EventRef will contain the correct space character (32) in kEventParamKeyMacCharCodes and the correct spac

Re: Disabling screen capture

2014-02-23 Thread Mills, Steve
On Feb 23, 2014, at 11:32, "Kyle Sluder" wrote: > > Control-Shift-3 puts the screenshot on the pasteboard Command-control-shift-3. Steve via iPad ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator

Re: Allowing users to customize keyboard shortcuts

2013-10-25 Thread Mills, Steve
> On Oct 25, 2013, at 18:37, "Rick Mann" wrote: > > I’m working on a complex app with lots of commands. I’m considering > eventually allowing users to customize the keyboard shortcuts they use. I > don’t want to build all that UI now, but I thought it might make sense to > build in the underpi

Re: Setting key equivalent for menus depending on window

2013-10-20 Thread Mills, Steve
> On Oct 20, 2013, at 14:38, "Ken Thomases" wrote: > > This isn't correct. Menus are updated/validated when resolving keyboard > shortcuts. What makes you think otherwise? Lots of things wouldn't work if > that weren't so. For what it's worth, Cocoa's key equiv updating doesn't always work

Re: Cocoa class extension best practice

2013-10-15 Thread Mills, Steve
On Oct 15, 2013, at 17:05, "Graham Cox" mailto:graham@bigpond.com>> wrote: On 15/10/2013, at 10:39 PM, Steve Mills mailto:smi...@makemusic.com>> wrote: I was seeing hundreds of still-alive allocated objects that came from the copied itemArray OK, so the objects *IN* the array are leaking

Re: Strange behaviour of iPhone

2013-09-21 Thread Mills, Steve
> On Sep 21, 2013, at 13:22, "Dave" wrote: > > A similar gotcha is when you declare a local with the same name as an > instance variable. That's why I prefer it when instance vars are named as such. I dislike the Microsoftish m_var. my old job used iVar, which was a lot easier to type. Steve

Re: Strange behaviour of iPhone

2013-09-21 Thread Mills, Steve
> On Sep 21, 2013, at 12:44, "Gerriet M. Denkmann" wrote: > > But why no compiler error? Like: "assigning a global pointer to local storage > is illegal"? It's not a compiler error, it's a programmer error. Static analysis would probably flag it (Build & Analyze or whatever it's called). Stev

Re: Strange behaviour of iPhone

2013-09-21 Thread Mills, Steve
> On Sep 21, 2013, at 12:24, "Gerriet M. Denkmann" wrote: > > 1. tupelsP lives outside the block Because once the block containing the array exits scope, so does the memory of the array. tuplesP is pointing to memory that is no longer valid. Steve via iPad __

Dismissing Open dlog before doc actually opens

2013-08-12 Thread Mills, Steve
I haven't been able to find any info about this, but I might be searching for the wrong thing. How can we get rid of the Open dlog so it doesn't hang around while the document is being read? It's an incredibly annoying design. Steve via iPad ___ Coco

Re: drawing outside the dirtyRect (of a NSView sub class) and overlapping NSTableView

2013-08-04 Thread Mills, Steve
On Aug 4, 2013, at 9:45, "Nick Rogers" wrote: > I have a column of buttons stacked up one over the other and on clicking a > button I want to draw an image on it with an arrow protruding to the right. > And on the right side there is a tab view and in it there is a table view. > So the arrow pa

Re: There must be a live human at Apple?

2013-08-03 Thread Mills, Steve
What does any of this have to do with Cocoa or Xcode development? Admins? Steve via iPad ___ 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-

Re: forward decls vs #import

2013-03-14 Thread Mills, Steve
On Mar 14, 2013, at 18:52, "Luther Baker" wrote: > Given today's computing power, is there a strong case that can be made for > or against the general use of forward declarations? It really depends on the size of your project. The projects I've worked on throughout my career would be slow as mu

Re: Documents not opening from Finder

2013-03-02 Thread Mills, Steve
On Mar 2, 2013, at 15:06, "Kyle Sluder" wrote: > The documentation is pretty clear about how NSDocument's default > implementation works. -[NSDocument > runModalPrintOperation:delegate:didPrintSelector:context:] is what actually > messages the delegate with the didPrintSelector. As long as you

Re: NSSavePanel problem

2013-02-23 Thread Mills, Steve
On Feb 23, 2013, at 18:43, "Peter Hudson" wrote: > I'm not using sandboxing - the app only runs on OSX. > > I wondered if it's possible to run the save panel without the row of widgets > which the directory picker popup is in ? >From the look of that crash log, it looks like something could be