Re: Is there a pattern for creating an object with global scope?

2013-04-13 Thread Jens Alfke
On Apr 13, 2013, at 10:02 PM, Allan Odgaard wrote: >> C++ static initializers are evil, though, at least the ones that run code. >> They run super early, in an undefined order, with no way to specify >> dependencies between them; so if you’re not careful they can slow down >> launch and/or ca

Re: Is there a pattern for creating an object with global scope?

2013-04-13 Thread Allan Odgaard
On Apr 14, 2013, at 10:51, Jens Alfke wrote: > C++ static initializers are evil, though, at least the ones that run code. > They run super early, in an undefined order, with no way to specify > dependencies between them; so if you’re not careful they can slow down launch > and/or cause weird n

Re: Followup - Re: Is there a pattern for creating an object with global scope?

2013-04-13 Thread Steve Mills
On Apr 13, 2013, at 23:08:41, YT wrote: > int gFoobar = 42; > > Then reference it elsewhere as: > > extern int gFoobar; > > I understand that solution and its working for me right now. I have a PreRun > Class that defines the object and I instantiate in main.m just before the > line > retu

Followup - Re: Is there a pattern for creating an object with global scope?

2013-04-13 Thread YT
First just to clear a distraction... I didn't want to actually create my own version of Preferences. In fact that was a mistake to even mention it. Sorry, I was flailing in my mind trying to describe what I was struggling with and out came Preferences as an example. Totally throw away the

Re: multiple profiles in preferences mechanism

2013-04-13 Thread Jens Alfke
On Apr 13, 2013, at 7:39 AM, Nick Rogers wrote: > But the problem is I need to have profiles (or rather Presets) for > preferences. Each preset would have the same set of preferences. > I am thinking of a table view on left where presets could be added/removed > and on right there would be UI

Re: Is there a pattern for creating an object with global scope?

2013-04-13 Thread Jens Alfke
On Apr 13, 2013, at 6:38 AM, Scott Ribe wrote: >> YT wants to create an object, which isn’t as straightforward because you >> can’t have an object literal in Objective-C. Instead you declare a global >> pointer and initialize it early on. > > Oh, right, I work in Objective-C++, so I don't hav

Re: get return value from NSUserUnixTask

2013-04-13 Thread Ken Thomases
On Apr 13, 2013, at 5:41 PM, Rainer Standke wrote: > I have a sandboxed Mac app that I want to write user script for (which could > run outside of the sandbox). I am trying to write that script as a stand-lone > Unix executable. I have that called as a NSUserUnixTask, and I can see that > it ru

get return value from NSUserUnixTask

2013-04-13 Thread Rainer Standke
Hello all, I have a sandboxed Mac app that I want to write user script for (which could run outside of the sandbox). I am trying to write that script as a stand-lone Unix executable. I have that called as a NSUserUnixTask, and I can see that it runs. However my sandboxed app doesn't get a retur

Re: multiple profiles in preferences mechanism

2013-04-13 Thread Nick Rogers
Thanks for the valuable input. Thanks, Nick On 13-Apr-2013, at 9:26 PM, Jerry Krinock wrote: > > On 2013 Apr 13, at 07:39, Nick Rogers wrote: > >> Is it possible to save the same set of preferences with different profiles >> in the system provided mechanism or do I have to come up with a sc

Re: multiple profiles in preferences mechanism

2013-04-13 Thread Jerry Krinock
On 2013 Apr 13, at 07:39, Nick Rogers wrote: > Is it possible to save the same set of preferences with different profiles in > the system provided mechanism or do I have to come up with a scheme of my own > (I guess I'd then be storing preferences in a plist in app bundle)? I don't think that

Can Deactivation be Prevented When Launching Popover?

2013-04-13 Thread Gordon Apple
We have a view-based tableView, each row containing a few controls and a text field. Using a hover-view, mousing over a row launches a popover to the side of the applicable row, containing information only (no interaction). We subclassed NSPopover to set acceptsFirstResponder to NO to prevent the

multiple profiles in preferences mechanism

2013-04-13 Thread Nick Rogers
Hi, I wish to use NSUserDefaultsController to ease up on writing glue code as well as for its features. But the problem is I need to have profiles (or rather Presets) for preferences. Each preset would have the same set of preferences. I am thinking of a table view on left where presets could be

Re: Is there a pattern for creating an object with global scope?

2013-04-13 Thread Scott Ribe
On Apr 12, 2013, at 10:08 PM, Jens Alfke wrote: > YT wants to create an object, which isn’t as straightforward because you > can’t have an object literal in Objective-C. Instead you declare a global > pointer and initialize it early on. Oh, right, I work in Objective-C++, so I don't have that l

Re: Is there a pattern for creating an object with global scope?

2013-04-13 Thread Tom Davie
On 13 Apr 2013, at 13:45, Uli Kusterer wrote: > On 13.04.2013, at 06:08, Jens Alfke wrote: >> On Apr 12, 2013, at 6:54 PM, Scott Ribe wrote: >> >>> Yes, extremely easy, just "create" the var, as in: >>> >>> int gFoobar = 42; >> >> YT wants to create an object, which isn’t as straightforward

Re: Is there a pattern for creating an object with global scope?

2013-04-13 Thread Uli Kusterer
On 13.04.2013, at 06:08, Jens Alfke wrote: > On Apr 12, 2013, at 6:54 PM, Scott Ribe wrote: > >> Yes, extremely easy, just "create" the var, as in: >> >> int gFoobar = 42; > > YT wants to create an object, which isn’t as straightforward because you > can’t have an object literal in Objective-