Re: Unusual Conditional Formatting

2016-09-07 Thread Frank D. Engel, Jr.
I am starting to think as well that I will need to create a new class for my value and type and work it out that way. I will give that a try. Thank you! On 9/7/2016 13:14, David Duncan wrote: On Sep 6, 2016, at 3:10 PM, Frank D. Engel, Jr. wrote: I am trying to set up what is apparently a

Re: Unusual Conditional Formatting

2016-09-07 Thread Frank D. Engel, Jr.
Tried adding the suggested KVO code - does not seem to have made a difference. Already had #2 - not sure that #1 is practical in this situation. On 9/7/2016 05:25, Jonathan Mitchell wrote: A couple of suggestions. Here is what I have so far: I used a category on NSNumber to add a "valueType

Re: C callbacks with NSNotificationCenter?

2016-09-07 Thread Graham Cox
> On 8 Sep 2016, at 3:44 AM, Andreas Falkenhahn wrote: > > How can I access "IMPORTANT_DATA_PTR" from within the block above? You already did it. Variables are captured from the scope where the block is declared and “magically” get referenced within the block. So what you’ve written should w

Re: C callbacks with NSNotificationCenter?

2016-09-07 Thread Alastair Houghton
> On 7 Sep 2016, at 22:11, Jens Alfke wrote: > > >> On Sep 7, 2016, at 10:03 AM, Alastair Houghton >> wrote: >> >> All of it can. Objective-C is just C with some syntactic sugar on top. > > There’s a large amount of semantic sugar too, i.e. the runtime libraries. (If > you think the run

Re: C callbacks with NSNotificationCenter?

2016-09-07 Thread Jens Alfke
> On Sep 7, 2016, at 10:03 AM, Alastair Houghton > wrote: > > All of it can. Objective-C is just C with some syntactic sugar on top. There’s a large amount of semantic sugar too, i.e. the runtime libraries. (If you think the runtime part must be trivial, go read some of Mike Ash’s posts a

Re: What difference exist from where a method will be called?

2016-09-07 Thread Jens Alfke
> On Sep 7, 2016, at 1:18 PM, Raimond Hettrich wrote: > > Now when this method will be called by a button press the array will be > printed out correctly. ... > But if the method will be called from the drawRect method, the array will be > printed out without the contend. Then in the drawRec

Re: How to silently use Proxy authentication credentials from Keychain, like Safari, Mail, etc.

2016-09-07 Thread Jens Alfke
> On Sep 6, 2016, at 5:36 AM, Motti Shneor > wrote: > > All my app does, is use KeyChain APIs to read proxy user/password. I believe > securityd agent/daemon is the one to prompt user for permission. It runs > under user ‘root’ - much like my own daemon. Yes, but

Re: How to silently use Proxy authentication credentials from Keychain, like Safari, Mail, etc.

2016-09-07 Thread Jens Alfke
> On Sep 6, 2016, at 5:36 AM, Motti Shneor wrote: > > All my app does, is use KeyChain APIs to read proxy user/password. I believe > securityd agent/daemon is the one to prompt user for permission. It runs > under user ‘root’ - much like my own daemon. Yes, but root isn’t a normal user accou

What difference exist from where a method will be called?

2016-09-07 Thread Raimond Hettrich
Dear all, there is a thing i can’t understand. In my class I have an NSMutableArray as a instance variable and a property. With the init method the array will be created with alloc / init. When my tableView has rows an information for each row will be added as object to my array. Then I have a

Re: Mixing Swift and Objective-C protocols

2016-09-07 Thread Quincey Morris
On Sep 7, 2016, at 02:43 , Gerriet M. Denkmann wrote: > > But I cannot put it into my switch statement. The compiler says: Cannot > assign value of type ‘ObjC!’ to type 'BitField?' > How can I convince the compiler that the ObjC really implements the BitField > protocol? This isn’t how it work

Re: C callbacks with NSNotificationCenter?

2016-09-07 Thread Andreas Falkenhahn
On 07.09.2016 at 18:09 Andreas Falkenhahn wrote: > As a C programmer I'm trying to avoid Objective C whenever and wherever > possible. I think this might be prone to misunderstanding: What I meant was that I'm trying to avoid writing classes whenever and wherever possible. I don't mind using Ob

Re: C callbacks with NSNotificationCenter?

2016-09-07 Thread Andreas Falkenhahn
On 07.09.2016 at 18:33 じょいすじょん wrote: > Have you considered Core Foundation? I absolutely love Core Foundation! As you might know I'm currently migrating a Carbon project to a Cocoa one and lots of it is of course in Core Foundation and I can just re-use those parts. It's really great that lots

Re: C callbacks with NSNotificationCenter?

2016-09-07 Thread Andreas Falkenhahn
Hi Fritz, On 07.09.2016 at 18:35 Fritz Anderson wrote: >> On 7 Sep 2016, at 11:09 AM, Andreas Falkenhahn >> wrote: >> As a C programmer I'm trying to avoid Objective C whenever and wherever >> possible. >> The good thing is that I can do most interaction with Cocoa from normal C >> function

Re: Unusual Conditional Formatting

2016-09-07 Thread David Duncan
> On Sep 6, 2016, at 3:10 PM, Frank D. Engel, Jr. wrote: > > I am trying to set up what is apparently a somewhat unusual behavior: > > I have a formatter which I want to behave differently depending on an > attribute of the value coming in, and on a user preference that can be > toggled in th

Re: C callbacks with NSNotificationCenter?

2016-09-07 Thread Alastair Houghton
On 7 Sep 2016, at 17:09, Andreas Falkenhahn wrote: > > As a C programmer I'm trying to avoid Objective C whenever and wherever > possible. Don’t. Where there’s an Objective-C equivalent, it’ll be less error prone, shorter to write and easier to debug. > The good thing is that I can do most i

Re: C callbacks with NSNotificationCenter?

2016-09-07 Thread Jonathan Mitchell
> Of course, I can't use this code in a normal C function because there are > references to "self" and the selector thing doesn't look like it's compatible > to > C. So I could just subclass AVPlayerItem and voila, everything's fine. I forgot to say that as long as your c function is in a .m file

Re: C callbacks with NSNotificationCenter?

2016-09-07 Thread dangerwillrobinsondanger
It's not Toll Free bridged. And Fritz, you contribute so much to folks, nobody would blink if you missed anything. Sent from my iPhone > On Sep 8, 2016, at 1:41 AM, Fritz Anderson wrote: > > “dangerwillrobinsondanger” correctly points to Core Foundation. I’m > embarrassed to have forgotten

Re: C callbacks with NSNotificationCenter?

2016-09-07 Thread Fritz Anderson
“dangerwillrobinsondanger” correctly points to Core Foundation. I’m embarrassed to have forgotten — it should be very helpful to you, assuming it mixes with AVFoundation. > On 7 Sep 2016, at 11:33 AM, じょいすじょん > wrote: > > Have you considered Core Foundation? > > https://developer.apple.com/l

Re: C callbacks with NSNotificationCenter?

2016-09-07 Thread Fritz Anderson
> On 7 Sep 2016, at 11:09 AM, Andreas Falkenhahn wrote: > > As a C programmer I'm trying to avoid Objective C whenever and wherever > possible. > The good thing is that I can do most interaction with Cocoa from normal C > functions. > I only had to write very few classes. Most of the Cocoa stu

Re: C callbacks with NSNotificationCenter?

2016-09-07 Thread じょいすじょん
Have you considered Core Foundation? https://developer.apple.com/library/ios/documentation/CoreFoundation/Reference/CFNotificationCenterRef/ It is all C Another alternative is to look at the Objective-C runtime library routines. You can do a lot with the language from C... > On 2016 Sep 8, at 1:

Re: C callbacks with NSNotificationCenter?

2016-09-07 Thread Jonathan Mitchell
> On 7 Sep 2016, at 17:09, Andreas Falkenhahn wrote: > > > Still, I'm wondering: Is it also possible to have NSNotificationCenter call > a C function for me whenever the notification triggers? Can this somehow > be achieved or am I forced to use full Objective C here? > I would go about this b

C callbacks with NSNotificationCenter?

2016-09-07 Thread Andreas Falkenhahn
As a C programmer I'm trying to avoid Objective C whenever and wherever possible. The good thing is that I can do most interaction with Cocoa from normal C functions. I only had to write very few classes. Most of the Cocoa stuff can be done from normal C functions just fine. Now I'd like to subs

Re: Drawing issue with translucent borderless NSWindow, initial content half stays

2016-09-07 Thread Sean McBride
On Tue, 30 Aug 2016 21:03:20 -0500, Ken Thomases said: >On Aug 30, 2016, at 10:10 AM, Sean McBride wrote: >> >> I have a drawing bug in my app, and reduced it to a toy app. >Basically, I create an NSBorderlessWindowMask type window who's content >view draws a translucent rounded rect. Its only

Re: How to set up my NSViews?

2016-09-07 Thread Andreas Falkenhahn
On 06.09.2016 at 21:30 Ken Thomases wrote: > On Sep 6, 2016, at 1:38 PM, Andreas Falkenhahn wrote: >> On 06.09.2016 at 18:51 Ken Thomases wrote: >>> On Sep 6, 2016, at 11:41 AM, Andreas Falkenhahn >>> wrote: My NSWindow contains an NSView which I use to draw custom graphics to. It

Re: How to set up my NSViews?

2016-09-07 Thread Andreas Falkenhahn
On 06.09.2016 at 21:22 Kyle Sluder wrote: > On Tue, Sep 6, 2016, at 01:38 PM, Andreas Falkenhahn wrote: >> On 06.09.2016 at 18:51 Ken Thomases wrote: >> > On Sep 6, 2016, at 11:41 AM, Andreas Falkenhahn >> > wrote: >> >> My NSWindow contains an NSView which I use to draw custom graphics to. It

Re: How to set up my NSViews?

2016-09-07 Thread Andreas Falkenhahn
On 06.09.2016 at 20:12 Richard Charles wrote: > Use AVPlayerLayer which is a subclass of CALayer. Set your parent > NSView as a layer backed view or as a layer hosting view. This > process can be a little confusing. > Refer to Setting Up Layer Objects. > https://developer.apple.com/library/mac/d

Re: Odd File Truncation

2016-09-07 Thread Roland King
> On 7 Sep 2016, at 19:19, Peter Hudson wrote: > > > ___ The file truncation seems to have spread to mail messages !!! ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requ

Re: Odd File Truncation

2016-09-07 Thread Peter Hudson
___ 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.co

Re: Odd File Truncation

2016-09-07 Thread Charles Jenkins
I have a Time Capsule and find it very unreliable. It simply won’t stay mounted as a Time Machine volume. I would never save a file directly to it. Can you not save the original locally and then sync with the Time Capsule? On Wed, Sep 7, 2016 at 3:56 AM, Peter Hudson wrote: > Hi All > > One of m

Mixing Swift and Objective-C protocols

2016-09-07 Thread Gerriet M. Denkmann
I have several Swift classes CclassA, ClassB), all implementing the BitField protocol: protocol BitField { init?(limit: UInt64, verbose: Int) } My AppDelegate Swift class has: var a: BitField? switch mm { case .A:a = ClassA(limit: maxp, verbose: verbose ) c

Re: Window Opened Notification?

2016-09-07 Thread dangerwillrobinsondanger
> On Sep 7, 2016, at 6:09 PM, Dave wrote: > > I’m already using Accessibility but the notification I get when a window is > created is posted to too late for it to help in this case. > > I’m also using Event Taps, I want to be able to stop events being fired to > the window until I have recei

Re: Unusual Conditional Formatting

2016-09-07 Thread Jonathan Mitchell
A couple of suggestions. > Here is what I have so far: I used a category on NSNumber to add a > "valueType" attribute as described at > http://nshipster.com/associated-objects/. > > The formatter checks this and the user preference when formatting an incoming > value. It sets some instance va

Re: Window Opened Notification?

2016-09-07 Thread Dave
Hi, I’m already using Accessibility but the notification I get when a window is created is posted to too late for it to help in this case. I’m also using Event Taps, I want to be able to stop events being fired to the window until I have received and procesed the Window Created Accessibility N

Odd File Truncation

2016-09-07 Thread Peter Hudson
Hi All One of my apps saves its’ files to an Airport Time Capsule. Bog standard doc based app - using the usual framework methods to save its data. This works extremely well. And then, one day, the file that was saved was 20 bytes long instead of the usual 5 MBytes. I’m sure there are a host of