Re: NSSplitView layout problem

2022-09-16 Thread Andy Lee via Cocoa-dev
[catching up on email] On Thu, Sep 8, 2022, at 5:34 PM, James Walker via Cocoa-dev wrote: > I could insert the edit > field in a custom NSView and insert that in the split view, but I'm > wondering if there is a better way to handle the issue? This is how I would do it. Seems like a fine

Re: Launching in fullscreen gives "Funk" sound sometimes

2020-06-27 Thread Andy Lee via Cocoa-dev
On Jun 24, 2020, at 5:23 AM, Gabriel Zachmann via Cocoa-dev wrote: > I tried to add this in -viewDidLoad in MasterWindowController: > >[[[self view] window] makeKeyAndOrderFront: NULL]; Some questions that may or may not help: - Are you sure the above line of code is being called? (I

Re: NSTabViewItem and NSViewController

2019-04-04 Thread Andy Lee
On Apr 4, 2019, at 9:43 AM, Casey McDermott wrote: > > We have a tab view with tabs added from code. Each tab uses a NSTabViewItem > subclass, > which contains a reference to a NSViewController subclass within it to manage > tab contents. > Users click to add and remove tabs. I see that

Re: Trouble assigning datasource and delegate to an instance of NSTableView

2019-03-28 Thread Andy Lee
The compiler may accept it, but it doesn't interpret it the way you think. You can confirm by checking whether your class formally conforms to the protocols. Try this with your old code and your new code, and compare: NSLog(@"conforms to protocol? %d", [ImportTool

Re: NSAlert

2018-09-08 Thread Andy Lee
I don't know where or whether it's documented, but it's not new. Using Space for "clicking" whichever control has focus has been around for a while. I don't remember offhand -- it may depend on the setting in System Preferences that governs whether all controls can get keyboard focus. --Andy On

Re: Delayed perform never performing

2018-08-24 Thread Andy Lee
On Aug 24, 2018, at 2:21 PM, James Walker wrote: > What could cause a delayed perform (using -[NSObject performSelector: > withObject: afterDelay:]) to never happen? I'm sure you've checked, but *just in case*, I'll ask: are you sure you're not sending it to nil? > I wondered if I needed to

Re: strange behaviour of hasPrefix

2017-05-04 Thread Andy Lee
On May 3, 2017, at 11:25 AM, Gerriet M. Denkmann wrote: > Why has test2 no prefix? Seems like a subtle difference between the implementations of __NSCFConstantString/__NSCFString and NSPathStore2/NSString. I ran your code and got the same results. I also added a bunch of

Re: My god, it is so pleasant with the animations disabled on Sierra.

2016-10-29 Thread Andy Lee
On Oct 27, 2016, at 4:56 PM, Rich Siegel wrote: > System Preferences => Accessibility => Display => "Reduce Motion" On Oct 27, 2016, at 6:29 PM, Alex Zavatone wrote: > Sierra, System Preferneces > Accessibility (because not wanting excess > animation is a

Re: Window Opened Notification?

2016-09-05 Thread Andy Lee
Dave, can you clarify whether you want is: 1. a notification when the frontmost window changes, or 2. a notification when some application opens a new window? If #1, observing these NSWorkspace properties looks like the way to go. If #2, bear in mind that applications can open windows that

Re: Does setFormatter() retain?

2016-08-28 Thread Andy Lee
On Aug 24, 2016, at 4:25 PM, Jens Alfke wrote: > >> On Aug 24, 2016, at 1:04 PM, Andreas Falkenhahn >> wrote: >> >> Now, will "setFormatter" call retain on "formatter" or not? Looking >> at "retainCount" seems to suggest so, although I know that

Re: Core Data or not

2016-08-06 Thread Andy Lee
On Aug 6, 2016, at 12:13 PM, Trygve Inda wrote: > >> On Aug 6, 2016, at 1:46 AM, Trygve Inda wrote: >>> For example, I would need to add items with ID# 204, 765, 983, 124, and 458 >>> to the array. This seems like with Core Data it would be 5

Re: Core Data or not

2016-08-06 Thread Andy Lee
(Apologies to those getting this twice -- I sent from the wrong account the first time.) On Aug 6, 2016, at 1:46 AM, Trygve Inda wrote: > For example, I would need to add items with ID# 204, 765, 983, 124, and 458 > to the array. This seems like with Core Data it would

Re: NSTask argument list

2016-06-25 Thread Andy Lee
Don't glom the arguments together.  Pass each as a separate array element: "-i", the URL string, "-c", "copy", the output string. And you don't need to quote the arguments, just pass them as is. I hope that makes sense -- I'd make it more code-like if I were at my desk rather than on my phone.

Re: How to pre-select a file in NSOpenPanel -- specifically, a .app bundle?

2016-06-24 Thread Andy Lee
Whoops, meant for this to go to the list: On Jun 24, 2016, at 6:22 PM, Martin Wierschin wrote: > >>> It almost looks like the ability to pre-select a file was deliberately >>> removed from the NSOpenPanel API. > > > Whatever the reason for removing this feature from

Re: How to pre-select a file in NSOpenPanel -- specifically, a .app bundle?

2016-06-24 Thread Andy Lee
Interesting. I should mention I hadn't turned on sandboxing in this project. When I turn it on, and I set the "User Selected File" entitlement to "Read Only", I get the same behavior as before: TextEdit.app is selected in the panel's column view, and it's treated like a regular (non-bundle)

How to pre-select a file in NSOpenPanel -- specifically, a .app bundle?

2016-06-24 Thread Andy Lee
How do I present an NSOpenPanel with a particular file pre-selected? I can pre-select a *directory* by setting openPanel.directoryURL. Since the file I want to select is actually a .app bundle, which is really a directory, you might think I'm in luck, but not quite. Here's the code I tried:

Re: Set font on NSTextView that uses bindings?

2016-05-19 Thread Andy Lee
Suggestion 1: A few weeks ago I ran into the same problem. I stumbled onto a kludge that seems to work, which was to put some text into the text view in IB. It can be spaces, it can be anything, as long as it's non-empty and it uses the desired font. It seems that the bindings mechanism is

Re: Disable Text Replacement

2015-02-10 Thread Andy Lee
On Feb 10, 2015, at 6:15 AM, Andreas Höschler ahoe...@smartsoft.de wrote: I also found NSLog(@isAutomaticTextReplacementEnabled %d, [NSSpellChecker isAutomaticTextReplacementEnabled]); NSLog(@isAutomaticSpellingCorrectionEnabled %d, [NSSpellChecker

Re: Disable Text Replacement

2015-02-10 Thread Andy Lee
On Feb 10, 2015, at 11:42 AM, Andreas Höschler ahoe...@smartsoft.de wrote: What puzzles me is that [self respondsToSelector:@selector(setAutomaticQuoteSubstitutionEnabled:)] returns NO!? How can this be? It can't, assuming self is an NSTextView (or, as you seem to be using, a subclass of

Re: How do I temporary retain self, under ARC?

2014-07-18 Thread Andy Lee
if(keepAlive) { keepAlive=nil; } which shut up the analyzer. [keepAlive self]; like Andy suggests would probably work just as well, though probably a tad more expensive as a method call is involved. Gerd On Jul 17, 2014, at 11:23 PM, Andy Lee ag...@mac.com wrote: On Jul 17, 2014

Re: How do I temporary retain self, under ARC?

2014-07-18 Thread Andy Lee
And of course the second I hit Send I realized the do {} idea doesn't work. Imagine if it was some variable other than self that you might *deliberately* use to indicate when the loop should terminate. --Andy --Andy On Jul 18, 2014, at 10:07 AM, Andy Lee ag...@mac.com wrote: You could

Re: How do I temporary retain self, under ARC?

2014-07-17 Thread Andy Lee
On Jul 17, 2014, at 11:01 PM, Jens Alfke j...@mooseyard.com wrote: Once I’ve identified such a bug, the fix is easy: put a [[self retain] autorelease] at the top of the method. Except now I’m using ARC, and I can’t find a simple way of doing it. I tried adding __unused id retainedSelf

Re: Pop-up menus not working in NSOutlineView with image subview

2014-07-03 Thread Andy Lee
Maybe use a subclass of NSImageView that returns nil for hitTest:? Just a thought. --Andy On Wed, Jul 2, 2014, at 10:40 PM, Tim Hewett wrote: I have an NSOutlineView with a NSImageView subview providing a background image. Now a pop-up menu has been added to the outline view it seems the

Re: NSAlert - Default Cancel also respond to Escape?

2014-05-20 Thread Andy Lee
On May 19, 2014, at 4:30 PM, Seth Willits sli...@araelium.com wrote: Any ideas on how to get a Cancel button which is both the default button and responds to escape? Both require setting the button's key equivalent and there can only be one. This seems to work: NSAlert *alert =

Re: JSONSerialization 'Garbage at end' error

2014-04-30 Thread Andy Lee
On Apr 30, 2014, at 3:21 PM, Jens Alfke j...@mooseyard.com wrote: You’ll need to do some detective work to find out what function call that error is really coming from. At that point you can set a breakpoint and look at the input data. Maybe for debugging purposes you could drop in an

Re: JSONSerialization 'Garbage at end' error

2014-04-30 Thread Andy Lee
On Apr 30, 2014, at 3:21 PM, Jens Alfke j...@mooseyard.com wrote: On Apr 30, 2014, at 8:20 AM, Diederik Meijer | Ten Horses diede...@tenhorses.com wrote: Now here is the problem: although the JSON parses fine and populates a UITableView without any issues, I am still getting the following

Re: NSToolbarItem Action Not Passed to NSButton...

2014-04-25 Thread Andy Lee
Okay, I just brushed up a bit on toolbars (wow, it's been a *very* long time). How did you create the instance of RBSStopButtonToolbarItem in the nib? From the docs, I learned that you can drag a view (in your case a button) from the IB palette into the Allowed Toolbar Items area. This should

Re: Good idea/bad idea?

2014-04-25 Thread Andy Lee
On Apr 25, 2014, at 10:22 AM, Sean McBride s...@rogue-research.com wrote: The 'if form' is arguably better for testing too. Many code coverage tools are line-based, and with this form it's easier to see if your test cases cover going in the branch and not. Sure, and similarly for plain old

Re: NSToolbarItem Action Not Passed to NSButton...

2014-04-25 Thread Andy Lee
On Apr 25, 2014, at 5:52 PM, Peters, Brandon bap...@my.fsu.edu wrote: Thank you for the guidance! Clicking twice on the toolbar item in IB revealed the NSButton Attribute Inspector. However, now the images will not show despite being set in IB. I tried programmatically to set the images for

Re: Good idea/bad idea?

2014-04-24 Thread Andy Lee
On Apr 24, 2014, at 10:33 AM, Alex Zavatone z...@mac.com wrote: I was just asked yesterday if there is any shorthand in Objective-C for if this thing = nil, then instantiate a new instance from the class Something like this: NSString x; if ([x isEqualtoString:nil]) { x = @yo; }

Re: Good idea/bad idea?

2014-04-24 Thread Andy Lee
On Apr 24, 2014, at 11:14 AM, Alex Zavatone z...@mac.com wrote: On Apr 24, 2014, at 11:12 AM, Luther Baker wrote: Not native and I've no idea when or if this is a good idea ... nor am I sure how much typing you want to do ... but you _could_ create a class convenience method for this

Re: Good idea/bad idea?

2014-04-24 Thread Andy Lee
On Apr 24, 2014, at 4:10 PM, Alex Zavatone z...@mac.com wrote: Could we throw a category on NSObject for that and then every class that originates with NSObject gets that lovely method? Not exactly, because unlike Smalltalk's nil, Objective-C's nil is *not* an object. But you could switch

Re: Good idea/bad idea?

2014-04-24 Thread Andy Lee
On Apr 24, 2014, at 5:00 PM, Scott Ribe scott_r...@elevated-dev.com wrote: What's wrong with the simple straightforward C way??? One improvement might be if there was a ?:= conditional assignment operator. Just as x += y; is the same as x = x + y; and likewise for other binary operators,

Re: Good idea/bad idea?

2014-04-24 Thread Andy Lee
On Apr 24, 2014, at 5:39 PM, Lee Ann Rucker lruc...@vmware.com wrote: An orIfNull: for NSObject and NSNull might be nice for those times when you put placeholders in dictionaries. For that you really only need a method in one place. I'd be inclined to put it in NSNull: +

Re: Good idea/bad idea?

2014-04-24 Thread Andy Lee
On Apr 24, 2014, at 6:03 PM, Lee Ann Rucker lruc...@vmware.com wrote: That's the flip side of what I was thinking about, but also useful. I was thinking about the code that receives the dictionary: - (void)processDictionary:(NSDictionary *)d { foo = [[d valueForKey:@foo]

Re: Good idea/bad idea?

2014-04-24 Thread Andy Lee
On Apr 24, 2014, at 5:45 PM, Quincey Morris quinceymor...@rivergatesoftware.com wrote: On Apr 24, 2014, at 14:21 , Andy Lee ag...@mac.com wrote: I still don't see how foo = [@Something fallbackIfNil:foo]; has any advantage over foo = foo ?: @Something; I don’t see how the latter

Re: NSToolbarItem Action Not Passed to NSButton...

2014-04-24 Thread Andy Lee
On Apr 24, 2014, at 10:23 PM, Peters, Brandon bap...@my.fsu.edu wrote: Yesterday, I got the view for the NSToolbarItem to show the desired image by putting the set image code for the button in the toolbar item’s validate() method, then setting the toolbar item’s view to the button in that

Re: NSToolbarItem Action Not Passed to NSButton...

2014-04-24 Thread Andy Lee
Try setting the target/action on the button rather than the toolbar item. --Andy On Apr 24, 2014, at 10:47 PM, Peters, Brandon bap...@my.fsu.edu wrote: Andy, I get the name of the custom NSToolbarItem, which I should get. On Apr 24, 2014, at 10:41 PM, Andy Lee ag...@mac.com wrote

Re: NSToolbarItem Action Not Passed to NSButton...

2014-04-24 Thread Andy Lee
On Apr 24, 2014, at 11:15 PM, Peters, Brandon bap...@my.fsu.edu wrote: My button is inside the customer toolbar item, if I make the button an outlet, how will I connect to it in IB? You can do it in code when you set it up. See setAction: and setTarget:. I don't know for sure if that'll work

Re: NSToolbarItem view set to NSButton view, but not showing...

2014-04-23 Thread Andy Lee
On Apr 23, 2014, at 6:36 PM, Jerry Krinock je...@ieee.org wrote: On 2014 Apr 23, at 15:13, Peters, Brandon bap...@my.fsu.edu wrote: call [toolbaritem setView:view] and pass in the NSButton. Try some bonehead debugging with NSLog(). Verify that toolbaritem is your target item at that

Re: NSToolbarItem view set to NSButton view, but not showing...

2014-04-23 Thread Andy Lee
:18.394 3D Rolling Ball Simulator[6321:303] Setting 1st image for stop button 2014-04-23 20:41:18.395 3D Rolling Ball Simulator[6321:303] Setting 2nd image for stop button 2014-04-23 20:41:18.395 3D Rolling Ball Simulator[6321:303] Image position: 1 On Apr 23, 2014, at 7:59 PM, Andy Lee ag

Re: ARC Retain Cycles

2014-04-21 Thread Andy Lee
On Apr 21, 2014, at 8:27 AM, Dave d...@looktowindward.com wrote: Also, when I did this, I left the property attributes as “retain” and “assign”, I’m wondering if it would be better to change them to “strong” and “weak” ? Although, AFAIK this shouldn’t make a difference? For object

Re: ARC Retain Cycles

2014-04-21 Thread Andy Lee
On Apr 21, 2014, at 10:12 AM, Dave d...@looktowindward.com wrote: There is a delegate handler which makes passing and calling simple delegates a doddle. This was originally non ARC. There is a property defined: @property (nonatomic,retain) id payloadObject;

Re: ARC Retain Cycles

2014-04-21 Thread Andy Lee
On Apr 21, 2014, at 10:53 AM, Alex Zavatone z...@mac.com wrote: On Apr 21, 2014, at 10:34 AM, Andy Lee wrote: On Apr 21, 2014, at 8:27 AM, Dave d...@looktowindward.com wrote: Also, when I did this, I left the property attributes as “retain” and “assign”, I’m wondering if it would

Re: ARC Retain Cycles

2014-04-21 Thread Andy Lee
On Apr 21, 2014, at 5:18 PM, Kevin Meaney k...@yvs.eu.com wrote: On 21 Apr 2014, at 21:09, Andy Lee ag...@mac.com wrote: The solution is to use a weak reference for one of the properties in the cycle. In general, if one object conceptually owns the other, then the owning object uses

Re: Image scaling property of NSCell/NSButton - where is it?

2014-04-06 Thread Andy Lee
(Forgot to hit Reply All a minute ago.) I notice both NSImageCell and NSImageView implement setImageScaling:. Both NSSegmentedCell and NSSegmentedControl implement setImageScaling:forSegment:. NSButtonCell implements setImageScaling:, and as it turns out so does NSButton -- but the docs don't

Re: What do you guys use to convert an XSD to objective C data classes/structures?

2014-03-25 Thread Andy Lee
Maybe you could check with the developer of Objectify whether he has something similar in the works for XML? http://tigerbears.com/objectify/ --Andy On Mar 25, 2014, at 3:15 PM, Alex Zavatone z...@mac.com wrote: We have a lot of legacy systems at my latest gig that all use and output XML

Re: Why does menu item with shift-delete not work?

2014-01-17 Thread Andy Lee
I think the key event is getting stolen by the first responder of whatever your key window is at the time. I did a quick test and found the menu item did not get invoked when a text view was selected but *did* get invoked when I removed the text view. I suspect a more precise technical answer

Re: Auto Layout with NSSplitView, NSScrollView

2014-01-09 Thread Andy Lee
On Jan 6, 2014, at 11:54 AM, Fritz Anderson fri...@manoverboard.org wrote: On 4 Jan 2014, at 1:38 PM, thatsanicehatyouh...@me.com wrote: I like your user name. I have a couple of questions about using auto layout (AL) with NSSplitView and NSScrollView. I have watched the (excellent) WWDC

Re: Auto Layout with NSSplitView, NSScrollView

2014-01-09 Thread Andy Lee
, Andy Lee wrote: On Jan 6, 2014, at 11:54 AM, Fritz Anderson fri...@manoverboard.org wrote: On 4 Jan 2014, at 1:38 PM, thatsanicehatyouh...@me.com wrote: I like your user name. I have a couple of questions about using auto layout (AL) with NSSplitView and NSScrollView. I have watched

Re: Auto Layout with NSSplitView, NSScrollView

2014-01-09 Thread Andy Lee
On Jan 9, 2014, at 12:55 PM, SevenBits sevenbitst...@gmail.com wrote: On Thu, Jan 9, 2014 at 12:27 PM, Andy Lee ag...@mac.com wrote: That's a great thread, thanks! BTW Apple removed the splitview-without-NSSplitView sample code that's mentioned in the thread. For anyone still interested

Re: Auto Layout with NSSplitView, NSScrollView

2014-01-09 Thread Andy Lee
On Jan 9, 2014, at 12:48 PM, Kyle Sluder k...@ksluder.com wrote: On Thu, Jan 9, 2014, at 07:51 AM, Andy Lee wrote: As far as I know (see disclaimers), there's no reason you can't implement split view delegate methods just because you're using Auto Layout, as long as you aren't calling setFrame

Re: Auto Layout with NSSplitView, NSScrollView

2014-01-09 Thread Andy Lee
On Jan 9, 2014, at 12:48 PM, Kyle Sluder k...@ksluder.com wrote: Nope. Please see the 10.8 AppKit Release Notes, which enumerate all the delegate methods which will kick you out of Auto Layout mode: splitView:constrainMinCoordinate:ofSubviewAt: splitView:constrainMaxCoordinate:ofSubviewAt:

Re: NSView subclass does not seem to start

2013-12-31 Thread Andy Lee
On Dec 31, 2013, at 9:13 AM, Alex Hall mehg...@gmail.com wrote: Sorry, I should have specified - I'm so used to seeing it I didn't even think. The loop is based on an NSTimer and is used to process sound position updates. Basically, I use it to pan sounds and draw updates. I'm not putting

Re: NSView subclass does not seem to start

2013-12-30 Thread Andy Lee
On Dec 30, 2013, at 5:34 PM, Alex Hall mehg...@gmail.com wrote: Anyway, the problem remains that I need to capture keystrokes (and eventually mouse movements) in a subclass of NSView, but nothing seems to happen. Since this is an audio game, there is no need for any UI controls to be drawn -

Re: How to accept drag of a URL on the dock icon?

2013-12-22 Thread Andy Lee
, 2013, at 5:22 PM, Andy Lee wrote: To answer my own question, it looks like it's done by implementing a Service. I've gotten it working in a quick scratch application. --Andy On Dec 21, 2013, at 6:06 PM, Andy Lee ag...@mac.com wrote: I know how to accept files that are dragged from

How to accept drag of a URL on the dock icon?

2013-12-21 Thread Andy Lee
I know how to accept files that are dragged from Finder to the application icon. It's a matter of adding some settings to Info.plist and implementing the application:openFiles: application delegate method. This does not work for dragging URLs from a web browser -- for example, dragging from

Re: How to accept drag of a URL on the dock icon?

2013-12-21 Thread Andy Lee
To answer my own question, it looks like it's done by implementing a Service. I've gotten it working in a quick scratch application. --Andy On Dec 21, 2013, at 6:06 PM, Andy Lee ag...@mac.com wrote: I know how to accept files that are dragged from Finder to the application icon. It's

Re: Neatly fitting a dash to a rect

2013-12-12 Thread Andy Lee
I assume you mean dash as in NSBezierPath's setLineDash:count:phase:. Also, does the dash have just two elements (one segment and one gap), or is it more complex. Does it have to be the same exact pattern all the way around? If it's okay to differ a teeny bit (I bet imperceptibly), you could

Re: Neatly fitting a dash to a rect

2013-12-12 Thread Andy Lee
On Dec 12, 2013, at 10:06 AM, Andy Lee ag...@mac.com wrote: Does it have to be the same exact pattern all the way around? If it's okay to differ a teeny bit (I bet imperceptibly), you could solve the problem separately for the horizontal edges and the vertical edges, and draw four lines

Re: Neatly fitting a dash to a rect

2013-12-12 Thread Andy Lee
On Dec 12, 2013, at 10:06 AM, Andy Lee ag...@mac.com wrote: In other words, the line length will be an exact multiple of segment length. Correction: exact multiple of (segmentLength + gapLength). --Andy ___ Cocoa-dev mailing list (Cocoa-dev

Re: Neatly fitting a dash to a rect

2013-12-12 Thread Andy Lee
On Dec 12, 2013, at 10:52 AM, Graham Cox graham@bigpond.com wrote: Does it have to be the same exact pattern all the way around? If it's okay to differ a teeny bit (I bet imperceptibly), you could solve the problem separately for the horizontal edges and the vertical edges, and draw four

-[NSString capitalizedString]

2013-11-11 Thread Andy Lee
A friend asked why anyone would want the behavior of capitalizedString. The only thing I could think of was to convert all caps to title case, which seems an odd scenario to provide API support for. Is there a more common need for this method that I haven't thought of? --Andy Begin forwarded

Re: Not documented: NSArray responds to -allObjects

2013-10-24 Thread Andy Lee
On Oct 24, 2013, at 10:19 AM, Jerry Krinock je...@ieee.org wrote: Starting somewhere after OS X 10.6, NSArray instances respond to the NSSet method -allObjects. I can’t find any documentation of this. Also, it is not declared in the header NSArray.h I see it's also documented for

Re: Setting key equivalent for menus depending on window

2013-10-20 Thread Andy Lee
On Oct 20, 2013, at 7:21 AM, Martin Hewitson martin.hewit...@aei.mpg.de wrote: On 20 Oct 2013, at 01:15 am, Kyle Sluder k...@ksluder.com wrote: Rather than rely on intercepting responder chain-based validation, wouldn't it be much easier and more reliable to make some object the

Re: Setting key equivalent for menus depending on window

2013-10-19 Thread Andy Lee
On Oct 19, 2013, at 6:58 AM, Martin Hewitson martin.hewit...@aei.mpg.de wrote: Main Window with tabs: close (cmd-shift-w) close tab (cmd-w) All other windows: close (cmd-w) close tab (inactive, no keyboard shortcut) This is pretty much the way things work in

Re: Setting key equivalent for menus depending on window

2013-10-19 Thread Andy Lee
On Oct 19, 2013, at 8:46 AM, Uli Kusterer witness.of.teacht...@gmx.net wrote: On 19 Oct 2013, at 14:27, Andy Lee ag...@mac.com wrote: On Oct 19, 2013, at 6:58 AM, Martin Hewitson martin.hewit...@aei.mpg.de wrote: Main Window with tabs: close (cmd-shift-w) close tab (cmd-w

Re: Setting key equivalent for menus depending on window

2013-10-19 Thread Andy Lee
On Oct 19, 2013, at 9:04 AM, Andy Lee ag...@mac.com wrote: My first thought was that the app delegate might not get a validateMenuItem: message if something earlier in the responder chain handles those menu items. But you could change the actions of the menu items to something unique

Re: Setting key equivalent for menus depending on window

2013-10-19 Thread Andy Lee
stick with the settings arranged by the app delegate Did I understand correctly? Thanks to all who replied. Cheers, Martin On 19, Oct, 2013, at 02:46 pm, Uli Kusterer witness.of.teacht...@gmx.net wrote: On 19 Oct 2013, at 14:27, Andy Lee ag...@mac.com wrote: On Oct 19, 2013

Re: Cocoa class extension best practice

2013-10-16 Thread Andy Lee
On Oct 16, 2013, at 12:57 PM, Steve Mills smi...@makemusic.com wrote: So at this point, let's finish this thread by going back to my original question. Is it OK to use the private instance variable _itemArray in NSMenu since the methods we've added are *extensions* of NSMenu and not a

Re: Cocoa class extension best practice

2013-10-16 Thread Andy Lee
On Oct 16, 2013, at 1:38 PM, Charles Srstka cocoa...@charlessoft.com wrote: On Oct 16, 2013, at 11:57 AM, Steve Mills smi...@makemusic.com wrote: So at this point, let's finish this thread by going back to my original question. Is it OK to use the private instance variable _itemArray in

Re: Cocoa class extension best practice

2013-10-16 Thread Andy Lee
On Oct 16, 2013, at 2:09 PM, Steve Mills smi...@makemusic.com wrote: On Oct 16, 2013, at 12:45:49, Andy Lee ag...@mac.com wrote: I still don't see what mutability has to do with it, but that's a side issue. The mutability doesn't matter. I'm just emphasizing that the internal array

Re: Cocoa class extension best practice

2013-10-15 Thread Andy Lee
On Oct 15, 2013, at 3:50 PM, Steve Mills smi...@makemusic.com wrote: We have extended NSMenu so we could add some other methods. Many of the methods iterate over the itemArray like so: for(NSMenuItem* item in [self itemArray]) Instruments shows that we're leaking NSArrays created

Re: Cocoa class extension best practice

2013-10-15 Thread Andy Lee
On Oct 15, 2013, at 5:05 PM, Andy Lee ag...@mac.com wrote: Then instead of [self itemArray] you could use [self nonLeakingItemArray]. If you are indeed subclassing, even better would be to override itemArray to return [self nonLeakingItemArray]. Then you can use [self itemArray] everywhere

Re: Cocoa class extension best practice

2013-10-15 Thread Andy Lee
On Oct 15, 2013, at 4:30 PM, Steve Mills smi...@makemusic.com wrote: On Oct 15, 2013, at 14:50:51, Steve Mills smi...@makemusic.com wrote: NSArray*items = [self itemArray]; for(NSMenuItem* item in items) blah; [items release];

Re: Cocoa class extension best practice

2013-10-15 Thread Andy Lee
On Oct 15, 2013, at 6:22 PM, Graham Cox graham@bigpond.com wrote: On 15/10/2013, at 11:10 PM, Mills, Steve smi...@makemusic.com wrote: No, it's the itemArray. Ignore the code you can't see in the loop. It's simply asking each item for its tag. OK, so if that's the case, I'm

Re: ARC vs Manual Reference Counting

2013-09-11 Thread Andy Lee
On Sep 11, 2013, at 6:37 AM, Jean-Daniel Dupas devli...@shadowlab.org wrote: and that while in most code those would be lost in the noise, in some cases people would need to help ARC out with things like __unsafe_unretained. Hmm…I always thought that __unsafe_unretained was for instance

Provide Feedback on documentation pages is broken

2013-08-14 Thread Andy Lee
I tried using the Provide Feedback link on one of the dev doc pages and got this: http://twitpic.com/d89x06 I filed a Radar about it: #14735067, in case anyone wants to dupe it, assuming it's not just me. --Andy ___ Cocoa-dev mailing list

Re: Provide Feedback on documentation pages is broken

2013-08-14 Thread Andy Lee
Feedback links might be broken like this? On Aug 14, 2013, at 10:20 AM, Andy Lee wrote: I tried using the Provide Feedback link on one of the dev doc pages and got this: http://twitpic.com/d89x06 I filed a Radar about it: #14735067, in case anyone wants to dupe it, assuming it's

Re: Mixing Obj-C and C methods

2013-08-07 Thread Andy Lee
On Aug 7, 2013, at 3:47 AM, Jean-Daniel Dupas devli...@shadowlab.org wrote: Instead of trying to use complex approach to hide the fact you need a global, just use one, and don't try to reuse the existing one for things there are not designed to do. static id myCallbackHandler; void

Re: Mixing Obj-C and C methods

2013-08-07 Thread Andy Lee
On Aug 7, 2013, at 12:04 PM, Jean-Daniel Dupas devli...@shadowlab.org wrote: If you intend to use it from multiple threads, so use a tls. __thread id myCallbackHandler; I did not know about __thread, thanks for this. By using tls you're effectively having each thread store the info that

Re: Mixing Obj-C and C methods

2013-07-31 Thread Andy Lee
On Jul 30, 2013, at 5:29 PM, Michael Crawford li...@warplife.com wrote: That class object occupies a non-zero quantity of memory, at its lowest level being somewhat like the combination of a single copy of a C struct, as well as some C functions, that from the Objective-C point of view, appear

Re: Mixing Obj-C and C methods

2013-07-30 Thread Andy Lee
On Jul 30, 2013, at 4:19 AM, Rick Mann rm...@latencyzero.com wrote: On Jul 30, 2013, at 00:59 , Vincent Habchi vi...@macports.org wrote: I have a very simple question: if I embed a C-function (more precisely, a callback from an external C-library) in an Obj-C object, can I expect this

Re: Mixing Obj-C and C methods

2013-07-30 Thread Andy Lee
On Jul 30, 2013, at 4:27 AM, Vincent Habchi vi...@macports.org wrote: Yes, right; it’s a SQLite callback, the first parameter is a void *. I wanted to pass a pointer to a structure containing both a unique query id (out of uuid) and a pointer to self, but got told off by ARC because it

Re: Mixing Obj-C and C methods

2013-07-30 Thread Andy Lee
On Jul 30, 2013, at 10:42 AM, Scott Ribe scott_r...@elevated-dev.com wrote: On Jul 30, 2013, at 8:35 AM, Andy Lee ag...@mac.com wrote: The only effect, as others have explained, is on scope; if you put the function inside the @implementation and the function has a reference to an instance

Re: Mixing Obj-C and C methods

2013-07-30 Thread Andy Lee
On Jul 30, 2013, at 4:26 AM, Michael Crawford li...@warplife.com wrote: However, I expect there is a way you could call an Objective-C method from vanilla C. Possibly you will need some assembly-language glue. The nice thing is, you don't need glue. You can send Objective-C messages from

Re: Mixing Obj-C and C methods

2013-07-30 Thread Andy Lee
On Jul 30, 2013, at 11:25 AM, Scott Ribe scott_r...@elevated-dev.com wrote: On Jul 30, 2013, at 9:08 AM, Andy Lee ag...@mac.com wrote: I think it's subject to the same criticisms as *any* direct access to ivars, although I agree it feels sketchier when done in plain C for some reason. Yes

Re: Observing Time

2013-07-27 Thread Andy Lee
On Jul 27, 2013, at 7:53 PM, dangerwillrobinsondan...@gmail.com wrote: I just tried both approaches and guess which one stays right there with the menu bar clock and which one lags? dispatch timer is the winner. And it's not doing a lot. I built a test app for each approach to verify.

Re: Observing Time

2013-07-27 Thread Andy Lee
On Jul 27, 2013, at 9:43 PM, dangerwillrobinsondan...@gmail.com wrote: But with that I still see a faint lag that seems to update just a hair slower than the dispatch timer. Noticeable to me at least, I'll post a link to the sample projects in a bit. FWIW I created a quick test app using

Re: Observing Time

2013-07-27 Thread Andy Lee
On Jul 27, 2013, at 9:57 PM, Andy Lee ag...@mac.com wrote: I'm trying again, this time creating a new NSTimer each time as suggested by Scott Ribe. Will let it run a while and see if I notice any drift. Looks pretty solid after several minutes -- as I would expect. To repeat Scott's

Re: Observing Time

2013-07-27 Thread Andy Lee
On Jul 27, 2013, at 11:05 PM, Scott Ribe scott_r...@elevated-dev.com wrote: On Jul 27, 2013, at 7:57 PM, Andy Lee ag...@mac.com wrote: I'm trying again, this time creating a new NSTimer each time as suggested by Scott Ribe. Will let it run a while and see if I notice any drift. FYI, I

Re: view based NSTable View - button not firing

2013-07-24 Thread Andy Lee
This sounds familiar. I remember something wasn't working in a view-based table and I was baffled until I read somewhere that I needed to set its delegate. Usually I make a note to myself about stuff like this, but I can't find the exact link that led me to this discovery. Perhaps one of

[MEET] CocoaHeadsNYC this Thursday

2013-07-10 Thread Andy Lee
When: Thursday, July 11, 2013, 6:30-7:45PM, followed by dinner at Spice, at 8th and 22nd (*not* the other Spice nearby). What: Our guest Michele Titolo has kindly volunteered to give a talk entitled Mastering the Project File: Do you frequently hear yourself say Don't touch the project file!,

Re: The cost of using objects rather than plain C variables

2013-07-08 Thread Andy Lee
On Jul 8, 2013, at 1:08 PM, Boyd Collier bcolli...@cox.net wrote: Your suggestion sounded worth learning about, but it appears that there's no such creature as NSPointerValue. I'm guessing Jens meant +[NSValue valueWithPointer:]. Did you perhaps mean NSPointerArray? I'm guessing not,

Re: The cost of using objects rather than plain C variables

2013-07-08 Thread Andy Lee
On Jul 8, 2013, at 12:30 PM, Vincent Habchi vi...@macports.org wrote: On 8 juil. 2013, at 18:04, Jens Alfke j...@mooseyard.com wrote: On Jul 7, 2013, at 1:37 PM, Frederick Bartram bartr...@acm.org wrote: Have you tried using NSData to store C-arrays? No, since my initial problem was to be

Re: redo: action not in First Responder

2013-07-02 Thread Andy Lee
On Jul 2, 2013, at 1:53 PM, Steve Mills smi...@makemusic.com wrote: On Jul 2, 2013, at 12:10:22, Quincey Morris quinceymor...@rivergatesoftware.com wrote: There is a button, but it's obvious only after you know where it is. Select the First Responder item in the list of XIB components on

Re: Attributed strings in NSTableViews

2013-06-30 Thread Andy Lee
On Jun 30, 2013, at 2:44 PM, Kyle Sluder k...@ksluder.com wrote: On Jun 30, 2013, at 6:04 AM, Peter Hudson peter.hud...@me.com wrote: I then append a second attributed string to the first - with very similar attributes as the first. After this, when the row is selected, the system no

Re: NSSplitView similar to Xcode's editor/debug area split view

2013-06-28 Thread Andy Lee
Hi Chuck, On Jun 26, 2013, at 8:30 PM, Chuck Soper chu...@veladg.com wrote: 2. How should I animate the showing or hiding of the 'debug area' view? I do by sending setFrame: to the two subviews' animator proxies instead of to the view itself. // Assumes the split view has two subviews, one

Re: Changing Subview Order Prevents Dragging

2013-05-13 Thread Andy Lee
On May 13, 2013, at 11:38 PM, Quincey Morris quinceymor...@rivergatesoftware.com wrote: On May 13, 2013, at 19:41 , Graham Cox graham@bigpond.com wrote: When you call -removeFromSuperview, the view is deleted, as there are no more references to it. The other methods are not called

Re: Changing Subview Order Prevents Dragging

2013-05-13 Thread Andy Lee
On May 14, 2013, at 12:53 AM, Roland King r...@rols.org wrote: [...] - (void) mouseDown: (NSEvent*) event { NSView* superView = [self superview]; [self removeFromSuperview]; //[superView addSubview: self]; } ...then dealloc does in fact get called. But if I uncomment that one

  1   2   3   4   5   6   7   8   9   >