Re: Processing mouse clicks using Quartz events

2011-02-16 Thread Kyle Sluder
On Feb 15, 2011, at 11:23 PM, Tomáš Znamenáček 
wrote:

> I have a system utility application that needs to be triggered by a mouse 
> click on certain UI elements. In all applications, not just mine. When the 
> application notices the right kind of a mouse click, I want to “steal” the 
> event to prevent it from being processed by the system and do something of my 
> own.
> 
> I looked into NSEvent global monitoring, but that does not allow me to modify 
> the events. Is there another way to monitor and change the system mouse 
> events?

Sounds like you want a Quartz event tap filter. You can create one using 
CGEventTapCreate. Though I'm kind of curious how you're able to determine the 
user is clicking on something interesting in arbitrary applications, and what 
that interesting thing may be.

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

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


Re: rewriting observed keyPath

2011-02-16 Thread Remco Poelstra

Op 15 feb 2011, om 23:59 heeft Quincey Morris het volgende geschreven:

> On Feb 15, 2011, at 11:27, Kyle Sluder wrote:
> 
>> As long as -current and -preset0 return the same object, and that
>> object is KVO-compliant for @"parameters", then observing
>> @"current.parameters" and @"preset0.parameters" are equivalent.
> 
> Kyle beat me to the punch on this part of the answer, but there's one 
> additional point -- the preferences controller *also* needs to be KVO 
> compliant with "current", otherwise changing "current" will leave observers 
> of "current.parameters" out of date. The OP's originally posted attempt at an 
> implementation of the "current" property wasn't KVO compliant, but the 
> version I suggested was.
> 

Thanks for the insights. It works fine now.
Leaves me wondering how that KVO registering works, how does the runtime now 
that it's the same path that is monitored? Especially in the situation where 
the full keyPath might not yet exist. You can still register for it and be 
notified as soon as it's created.

Regards,

Remco Poelstra

___

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

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


Re: Key equivalents for non-menu items

2011-02-16 Thread John Joyce

On Feb 16, 2011, at 1:58 PM, Randy Widell wrote:

> On 2/15/11 8:20 PM, mlist0...@gmail.com wrote:
>> On Feb 15, 2011, at 7:36 PM, Randy Widell wrote:
>> 
>>> I would like to have a keyboard shortcut that tags a location on the 
>>> waveforms at the location of the mouse cursor.  These commands do not make 
>>> any sense in the main menu...they could go there, but they would be clutter.
>> Why do you think they wouldn't make sense in the main menu? That's where we 
>> put them in SoundEdit 16.
>> 
>> A design point: you should not have any operations that can't be invoked 
>> using a mouse. So you should have a button or menu for these commands of 
>> yours.
>> 
>> _murat
> Given the number of tags users add over several hundred pages, it is much 
> faster to just point with the mouse, hit a key, and have the software enter a 
> tag with a default length that can be modified later if need be.  If all the 
> keyboard shortcuts for adding/deleting tags and paging are single 
> letters/numbers grouped for one hand, that leaves the other hand free to 
> point.
> 
> They'll go into context menus for sure, but no one would use them in the main 
> menu.
One thing Mac users frequently do is use the menu bar as a source of keyboard 
shortcuts.


___

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

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


Re: Processing mouse clicks using Quartz events

2011-02-16 Thread Tomáš Znamenáček
Kyle Sluder wrote:

> Sounds like you want a Quartz event tap filter. You can create one using 
> CGEventTapCreate.

That’s exactly what I am doing, but as I wrote, I found it hard to filter a 
whole mouse click event, since the tap filter only receives the low-level event 
types. When I receive a mouse down event, I have to wait for the corresponding 
mouse up event to see if the mouse is being dragged (which I do not want to 
filter) or simply clicked (which I do want to filter). And I’d hate to delay 
all mouse down events in the system just because of this.

> Though I'm kind of curious how you're able to determine the user is clicking 
> on something interesting in arbitrary applications, and what that interesting 
> thing may be.

I’m playing with the accessibility API. (Sorry for sounding so mysterious, I 
was trying to keep the question general.) Right now I am trying to detect a 
mouse click on a window title. The code works, but I have hard time 
differentiating between the click and a drag.

T. 
___

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

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


Re: Contextual menu commands in the Finder

2011-02-16 Thread Norbert M. Doerner
That is indeed incredibly lame of the very weak Services API 
structure, but the only way to do it today.


We can only hope that many bug reports (bugreporter.apple.com !!) 
will help Apple to massively improve these context menus soon to 
bring them back to the usefulness of the Carbon time.


I did file an enhancement bug two years ago, please do so as well.

So I gather that now that the new 64-bit Finder doesn't support the 
old CM plugin API, the only way to add commands to the Finder's 
contextual menus is with the services API. The problem I'm having 
with doing it as a service is that the commands I want to add should 
only apply to files in certain locations, and it looks like I can 
only filter by file type. Is there no way to filter by location too?


It looks pretty lame to have to let the commands always appear, and 
then tell the user afterwards, "No, sorry, you can't really do this 
to that file."


--
David Catmull
uncom...@uncommonplace.com


--
Norbert M. Doerner
CEO, West-Forest-Systems
In der Trift 13
56459 Langenhahn, Germany
Fon: +49 (2663) 91 70 128   (Central European Time Zone...)
Fax: +49 (2663) 91 70 126
AIM (iChat), Skype: cdfinderceo
Twitter: http://www.twitter.com/cdfinder
Facebook:
http://www.facebook.com/pages/CDFinder-The-Search-Is-Over/173297504827
---
CDFinder - The Search Is Over!  http://www.cdfinder.de/
Catalog and organize your photos, songs, videos, disks, data, anything...
NEW:  CDFinder 5.7.1 - Catalog iPhone Movie Geotags - Import 
DiskLibrary database.
  Also catalogs MS Word, Quark XPress, Adobe InDesign 
Illustrator. And more!

---
___

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

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


Re: rewriting observed keyPath

2011-02-16 Thread Quincey Morris
On Feb 16, 2011, at 00:19, Remco Poelstra wrote:

> Leaves me wondering how that KVO registering works, how does the runtime now 
> that it's the same path that is monitored?

Actually, there's no magic involved* -- it's kind of obvious**, in the sense 
that it has to work this way***, even if the process is a bit complicated. If 
you're interested, here are the gory details:

Let's say you tell object A to observe object B on key path "x.y.z". That 
causes the following observations to be set up:

#1. A internally observes B on key "x"
#2. A internally observes the current value of object B.x (call it X1) 
on key "y"
#3. A internally observes the current value of object X1.y (call it Y1) 
on key "z"

with the proviso that this chain of observations ends early if any of the 
objects is nil. (For example, if X1 is nil, A just observes B on "x" and that's 
all.)

Let's suppose the value of Y1.z changes (KVO compliantly, of course). Object A 
gets notified internally that Y1 changed for property "z", which it then 
reports to your 'observeValueForKeyPath:ofObject:change:context:' as a change 
to B on its "x.y.z" key path.

(If you didn't set up the observation explicitly, but are using bindings, then 
"you" means the binding, because the binding set up the observation.)

There's an important fact to notice here, that relates to your original 
question. Your 'observeValueForKeyPath:ofObject:change:context:' will report 
the change to Y1.z *no matter how that change came about*. Specifically, if 
B.current is also X1, and B.x.y.z got changed, you'll get told that B changed 
for key path "current.y.z" if that's the observation you registered for, or 
that B changed for key path "x.y.z" if that's the observation you registered 
for. (Notice that this isn't where your original design failed. For that, 
you'll have to read on.)

--

Let's suppose the value of B.x changes, from X1 to X2. Object A gets notified 
internally. It removes the observation of X1 on key path "y.z" (which removes 
#2 and #3), and adds an observation of X2 on key path "y.z" (which adds a new 
#2 and #3). As in the previous case, it then reports a change to B's "x.y.z" 
key path to your 'observeValueForKeyPath:ofObject:change:context:'.

If you work through the details, you'll see that this process works fine even 
if some of B.x, B.x.y or B.x.y.z are nil, or change to or from nil -- the only 
difference is that there are fewer of the internal observations. (B can't be 
nil, though, otherwise you'd have sent 'addObserver:...' to a nil receiver, and 
so no observation would ever have been registered. This is sometimes an 
annoyance, because B might be nil during A's initialization, which is where 
you'd like to add observations. One way around this is to have A observe its 
own "b" property, and use *that* notification to add or remove the rest of the 
observations. Or, sometimes, B will be known to exist at A's 'awakeFromNib' 
time, which is why observations are often set up there rather than in 
initialization.)

Back to your original problem one more time. If B.x changes, but you actually 
observed B on key path "current.y.z", what happens? Well, apparently nothing -- 
the triggering KVO notification is for property "x", but you aren't registered 
for a sequence of internal observations starting from key "x", so you miss out 
on this change, and any subsequent changes to B.x.y or B.x.y.z. That's why your 
original design failed.

So how come it works now? Consider what happens when property "current" is 
dependent on property "x" and is KVO compliant. Then, if B.x changes, a 
*second* KVO notification is produced for property "current", and *that* causes 
your observation of key path "current.y.z" to be triggered. It works, not 
because there's anything different about the observations, but because KVO 
essentially *transfers* the change notification from one key path to another.

General rule: If you get the KVO compliance right, everything will work.

--

Your statement:

> Especially in the situation where the full keyPath might not yet exist. You 
> can still register for it and be notified as soon as it's created.


is only *very* approximate. The key path (which is merely a string, like 
"x.y.z") *always* exists -- it's the chain of object values that the key path 
represents that might not fully exist due to nil values. You're not notified as 
soon as anything is "created", but as soon as anything in the chain of object 
values changes. In the so-called "created" case, you're just seeing an observed 
value change from nil to non-nil.

-- 

* TBH, I'm not sure there isn't any magic.

** Obviously, I'm using the word "obvious" in a non-obvious sense.

*** My description of how it works is conceptual -- the actual implementation 
is unknown.

 I've done my best to be precisely accurate, but it's easy to make mistakes 
when talking about KVC and KVO. It's possible that anything or everything in my 
descript

Re: rewriting observed keyPath

2011-02-16 Thread Remco Poelstra

Op 16 feb 2011, om 11:39 heeft Quincey Morris het volgende geschreven:

> On Feb 16, 2011, at 00:19, Remco Poelstra wrote:
> 
>> Leaves me wondering how that KVO registering works, how does the runtime now 
>> that it's the same path that is monitored?
> 
> Actually, there's no magic involved* -- it's kind of obvious**, in the sense 
> that it has to work this way***, even if the process is a bit complicated. If 
> you're interested, here are the gory details:

Thanks! That enlightens!

Regards,

Remco Poelstra

___

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

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


How to optimize image loading during core animation?

2011-02-16 Thread Gabriel Zachmann
I am implementing a screensaver that is basically a photo show.
The photos are animated using Core Animation (nothing complicated).

The problem now is that when the screensaver switches to the next photo, the 
animation judders.
The judder happens, as far as I can tell, only with large images, e.g., 7 MB 
JPEGs.

(You can find an excerpt of my code at the end of this post.)

I suspect this is because I load the image at the beginning of a photo switch, 
which can take a lot of CPU power, which could cause a decrease in frame rate 
for my screensaver, which in turn would cause the judder, because Core 
Animation probably tries to make the animation "travel" the same "distance" for 
a given time span, but with less frames in-between.

So, the first question is: is my suspicion correct, or could it be any other 
reason?

The next question, the, is: what can I do against it?

One idea I was toying with is to load the images half-way between an image 
switch.
But would that really help? Wouldn't that just cause the judder to occur at 
that time (note that the photos are always animated!)

So, what else could I do?
Can I somehow load images half-way between image switches *and* tell the OS to 
use only very little CPU power for it?

I am sort of hesitant to fork another thread just for the image loading, 
because the screensaver already runs in several threads parallel, when the user 
has several monitors attached to their Mac ...
(Or would that be painless?)

Any and all ideas, hints, pointers, examples, and suggestions will be highly 
appreciated!

Best regards,
Gabriel.

PS:
Here is an excerpt of my code

- (void) animateOneFrame
{
if ( time is not up yet )
return;

// load new image from disk
NSURL * url = [NSURL fileURLWithPath: [self absolutePathFor: filename_] 
isDirectory: NO];
...
CGImageSourceRef sourceRef = CGImageSourceCreateWithURL( (CFURLRef) url, 
NULL );
CFDictionaryRef fileProps = CGImageSourceCopyPropertiesAtIndex( sourceRef, 
0, NULL );
... [check whether image is eligible for display; if not, return]
CGImageRef imageRef = CGImageSourceCreateImageAtIndex( sourceRef, 0, NULL );
CFRelease(sourceRef);
...
// do garbage collection a bit later, to prevent judder
[NSTimer scheduledTimerWithTimeInterval: 2.3 target: self selector: 
@selector(doGarbageCollection:) userInfo: nil repeats: NO];

CALayer * newlayer = [self makeImageLayer: imageRef fromSize: startsize 
toSize: endsize withOrientation: img_orientation];
// swap the old and the new layer
[CATransaction begin];
[CATransaction setValue: [NSNumber numberWithFloat: fading_duration] 
forKey: kCATransactionAnimationDuration  ];
[mainLayer_ replaceSublayer: currentLayer_ with: newlayer];
currentLayer_ = newlayer;
[CATransaction commit];
}



Der Liebende ist nicht blind, sondern sieht mehr.

   http://zach.in.tu-clausthal.de






smime.p7s
Description: S/MIME cryptographic signature
___

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

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

Re: Binding to an NSMutableArray

2011-02-16 Thread Lorenzo Thurman
On Wed, Feb 16, 2011 at 12:23 AM, Stephen J. Butler <
stephen.but...@gmail.com> wrote:

> On Wed, Feb 16, 2011 at 12:05 AM, Stephen J. Butler
>  wrote:
> > It works, I just wrote up an example. But unfortunately my
> > universities file storage is crapping out and I can't share it at the
> > moment.
>
> Ahh ha, figured it out. Here's my example:
>
> https://netfiles.uiuc.edu/xythoswfs/webui/_xy-40162946_2-t_hawvqdYX
>


Binding an arraycontroller to an arraycontroller, nice!
Thanks, its working perfectly now.

-- 
"My break-dancing days are over, but there's always the funky chicken"
--The Full Monty
___

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

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


Re: Community Suggestions on Encryption

2011-02-16 Thread Brad Stone
Jean - thanks to your tip I was able to find this code at 
http://pastie.org/966473.  It works very well (I tried to paste it below but it 
was too big) for NSString ivars.  

What I'm working on now is to try to figure out how to encrypt/decrypt an 
NSData iVar. 

I have an NSData ivar which is binded to an NSTextView.  The text view is rich 
text, the user can drag in jpgs, changes fonts, styles, etc..  If I send it to 
this code, encrypt it and decrypt it, I get back chinese characters.  I don't 
think the approach is to store the text separately from the rest of the rich 
text data so I'm investigating how I can write similar code for NSData.

On Feb 15, 2011, at 10:52 AM, Jean-Daniel Dupas wrote:

> 
> Le 15 févr. 2011 à 16:35, Brad Stone a écrit :
> 
>> I've been doing a lot of hunting to find a simple way for me to encrypt an 
>> NSString and NSData.  I've found a bunch of useful blogs like Cocoa Nut 
>> (http://cocoa-nut.de/?tag=encryption, Deusty:Using OpenSSL in Cocoa 
>> (http://deusty.blogspot.com/2007/01/using-openssl-in-cocoa.html) and the 
>> SSCrypto site (http://septicus.com/products/opensource/).  The thing is 
>> however that these, among others I've found (like "cocoa-ae"s from 2009), 
>> are dated.  The SSCrypto files haven't been updated since 2006 and these 
>> blogs are of similar age.
>> 
>> My question is simple: can I get this done without having to dive deep into 
>> the world of OpenSSL?  If so, how?
>> 
>> I have about four NSString iVars and one NSData iVar I want to encrypt.  I 
>> wrote my own test code to encrypt/decrypt an NSString on the fly and have it 
>> work with core data transparently to the user.  I'm at the point now where I 
>> need to replace that test code with something real.  From all I've read, 
>> OpenSSL is the way to go but I've also read it's very difficult to 
>> implement.  I know nothing about it.  What initially attracted me to 
>> SSCrypto is that it's simple (i.e. NSData *decryptedText = [crypto 
>> decrypt:@"aes256"]) but I'm worried about using something relatively old and 
>> using a third party framework.
>> 
> 
> For AES (and SHA, and HMAC), use CommonCrypto API which is part of libSystem.
> 
> man CCCryptor for details. (or search in Xcode doc).
> 
> -- Jean-Daniel
> 
> 
> 
> 

___

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

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


Re: Contextual menu commands in the Finder

2011-02-16 Thread Gregory Weston
David Catmull wrote:

> So I gather that now that the new 64-bit Finder doesn't support the old CM 
> plugin API, the only way to add commands to the Finder's contextual menus is 
> with the services API. The problem I'm having with doing it as a service is 
> that the commands I want to add should only apply to files in certain 
> locations, and it looks like I can only filter by file type. Is there no way 
> to filter by location too? 
> 
> It looks pretty lame to have to let the commands always appear, and then tell 
> the user afterwards, "No, sorry, you can't really do this to that file."


Yeah, it is pretty lame. Abstractly I understand and sympathize with Apple's 
move here, but we as software developers lost flexibility and power that not 
only degrades the user experience but in some cases makes our software 
impossible to re-create. Services are not offered for the context menu on a 
Finder window background, for example. And I'm still not sure why someone 
thought it was a good idea for volume to be a subclass of folder in the UTI 
hierarchy instead of a peer (and a subclass of container).
___

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

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


Re: Tracking a EXC_BAD_ACCESS when zombies don't work

2011-02-16 Thread Keith Blount
Many thanks for the reply, Sean, much appreciated. Unfortunately still no joy, 
though. I had already tried setting the CFZombieLevel to 3 (and other values - 
sorry, I should have mentioned that), but according to the tech notes, since 
10.5 Core Foundation types are covered by NSZombie anyway (which is probably 
why I couldn't find anything on CFZombieLevel newer than five years old), so I 
don't think adding CFZombieLevel is adding anything over NSZombieEnabled.

The "Hamster Emporium" (!) article looked hopeful, but unfortunately everything 
I've looked at seems to assume you can get some useful information from the 
console - either a selector name using NSZombies or a bad memory address - and 
then proceeds from there, and I'm getting neither. The console reports nothing 
more useful than this, no matter what I try:

tar(7728) malloc: stack logs being written into 
/tmp/stack-logs.7728.tar.XYgOka.index
tar(7728) malloc: stack logs deleted from /tmp/stack-logs.7728.tar.XYgOka.index
Program received signal:  “EXC_BAD_ACCESS”.

(I have MallocStackLogging turned on as well as NSZombieEnabled.)

And the backtrace doesn't help either:

#261968 0x98d06f38 in CFRelease
#261969 0x98d06f38 in CFRelease
#261970 0x98d06f38 in CFRelease
#261971 0x98d33c6d in _CFAutoreleasePoolPop
#261972 0x9867d0aa in NSPopAutoreleasePool
#261973 0x9867cfd2 in -[NSAutoreleasePool drain]
#261974 0x986c4596 in _NSAppleEventManagerGenericHandler
#261975 0x91450f58 in aeDispatchAppleEvent
#261976 0x91450e57 in dispatchEventAndSendReply
#261977 0x91450d61 in aeProcessAppleEvent
#261978 0x9519d389 in AEProcessAppleEvent
#261979 0x93b9a9ca in _DPSNextEvent
#261980 0x93b99fce in -[NSApplication 
nextEventMatchingMask:untilDate:inMode:dequeue:]
#261981 0x93b5c247 in -[NSApplication run]
#261982 0x93b542d9 in NSApplicationMain
#261983 0x0003513a in main at main.m:23

(Those CFReleases at the top go on and on and on when they appear - other times 
they don't appear at all.)

And everything I turn up on EXC_BAD_ACCESS from searches just provides 
NSZombieEnabled as the answer (unsurprisingly given that it's always worked for 
me in the past, as I say).

I am still slowly working my way through every technique listed in the tech 
note you linked to, though, having gone through it and tried the obvious ones 
first.

Thanks again,
Keith

--- On Tue, 2/15/11, Sean McBride  wrote:

> From: Sean McBride 
> Subject: Re: Tracking a EXC_BAD_ACCESS when zombies don't work
> To: "Keith Blount" , cocoa-dev@lists.apple.com
> Date: Tuesday, February 15, 2011, 8:55 PM
> On Tue, 15 Feb 2011 12:41:51 -0800,
> Keith Blount said:
> 
> >I'm trying to debug an EXC_BAD_ACCESS crash in my
> application and am
> >tearing my hair out trying to find the cause. I have
> NSZombieEnabled set
> >to YES, but this isn't providing me with any
> information (using
> >NSZombieEnabled is always one of the first things I try
> with crashes
> >like this one, and usually it leads to the culprit
> after a bit of work).
> >I've read that zombies don't always help find
> EXC_BAD_ACCESS (for
> >instance if a variable hasn't been initialised or if
> it's a CF type,
> >although I'm not sure if the latter is still true), so
> presumably this
> >is why it's returning nothing for me.
> >
> >So, all I have to go on is an EXC_BAD_ACCESS, and a
> backtrace that seems
> >to be different every time and usually contains none of
> my own methods.
> >For instance:
> 
> Have you read:
> 
> 
> specifically the CFZombie stuff?
> 
> and
> 
>  objc_explain_So_you_crashed_in_objc_msgSend.html>
> 
> Might help...
> 
> --
> 
> Sean McBride, B. Eng         
>        s...@rogue-research.com
> Rogue Research           
>            
> www.rogue-research.com
> Mac Software Developer         
>     Montréal, Québec, Canada
> 
> 
> 



___

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

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


Re: Animation doesn't reach end value

2011-02-16 Thread Matt Neuburg
On Tue, 15 Feb 2011 14:47:26 +0100, Florian Ebeling  
said:
>I try to create a view which creates an effect that is similar to the
>Find Indicator in NSTextView. To achieve that there is a view with
>text which is animated using CAAnimation objects registered via
>setAnimations:. The animated properties are frameSize, frameOrigin and
>animatedFontSize, but the triggering property is the "hidden"
>property. The whole effect works and looks almost as I imagined it,
>but there is one problem: the properties do not reach the final value

Show your code. That way, others can test, reproduce, consider. In your email 
as it stands there is nothing to respond to. m.

--
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.apeth.net/matt/default.html#applescriptthings___

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

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


Re: Tracking a EXC_BAD_ACCESS when zombies don't work

2011-02-16 Thread Bruce Cresanta
A big clue is in your backtrace:

#261968 0x98d06f38 in CFRelease
#261969 0x98d06f38 in CFRelease
#261970 0x98d06f38 in CFRelease
#261971 0x98d33c6d in _CFAutoreleasePoolPop
#261972 0x9867d0aa in NSPopAutoreleasePool
#261973 0x9867cfd2 in -[NSAutoreleasePool drain]
#261974 0x986c4596 in _NSAppleEventManagerGenericHandler
#261975 0x91450f58 in aeDispatchAppleEvent
#261976 0x91450e57 in dispatchEventAndSendReply
#261977 0x91450d61 in aeProcessAppleEvent
#261978 0x9519d389 in AEProcessAppleEvent
#261979 0x93b9a9ca in _DPSNextEvent
#261980 0x93b99fce in -[NSApplication 
nextEventMatchingMask:untilDate:inMode:dequeue:]
#261981 0x93b5c247 in -[NSApplication run]
#261982 0x93b542d9 in NSApplicationMain
#261983 0x0003513a in main at main.m:23



//
#261971 0x98d33c6d in _CFAutoreleasePoolPop results in  EXC_BAD_ACCESS when you 
release a variable marked as autorelease.   Go back through your code and make 
sure you manually haven't released an autoreleased variable.

Bruce





On Feb 16, 2011, at 11:27 AM, Keith Blount wrote:

> And the backtrace doesn't help either:
> 
> #261968   0x98d06f38 in CFRelease
> #261969   0x98d06f38 in CFRelease
> #261970   0x98d06f38 in CFRelease
> #261971   0x98d33c6d in _CFAutoreleasePoolPop
> #261972   0x9867d0aa in NSPopAutoreleasePool
> #261973   0x9867cfd2 in -[NSAutoreleasePool drain]
> #261974   0x986c4596 in _NSAppleEventManagerGenericHandler
> #261975   0x91450f58 in aeDispatchAppleEvent
> #261976   0x91450e57 in dispatchEventAndSendReply
> #261977   0x91450d61 in aeProcessAppleEvent
> #261978   0x9519d389 in AEProcessAppleEvent
> #261979   0x93b9a9ca in _DPSNextEvent
> #261980   0x93b99fce in -[NSApplication 
> nextEventMatchingMask:untilDate:inMode:dequeue:]
> #261981   0x93b5c247 in -[NSApplication run]
> #261982   0x93b542d9 in NSApplicationMain
> #261983   0x0003513a in main at main.m:23

___

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

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


Re: Tracking a EXC_BAD_ACCESS when zombies don't work

2011-02-16 Thread Keith Blount
Hi Bruce,

Many thanks for the reply. Unfortunately that's a little trickier than it 
sounds - my app has around 200,000 lines of code. :) That said, I know that the 
trigger is page layout mode but I've already been through the page layout code 
(and the page-layout-switching code) several times checking for an 
over-release, and there's nothing obvious in there. Given that NSZombieEnabled 
isn't coming up with anything, I'm thinking it could be an un-initiated 
variable somewhere, but again I've been through the classes that seem to be 
part of the trigger and have found nothing untoward.

It's particularly tricky as this crasher does not affect many users and I've 
only now been able to reproduce it, thanks to a user sending me a problem file, 
after three months of knowing it was lurking from reports generated from my 
app's built-in crash reporter. It seems to be down to a particular way a table 
is arranged in an NSTextView in my page layout code, but even then it doesn't 
always happen, and of course the page layout trigger may be a red herring. 
Today I separated the page layout code out into a separate Xcode project, 
placed all of the code and the problem document that seemed to be triggering 
the crash into the separate app... And of course it refused to crash.

The debugging continues...

Thanks again!
All the best,
Keith

--- On Wed, 2/16/11, Bruce Cresanta  wrote:

> From: Bruce Cresanta 
> Subject: Re: Tracking a EXC_BAD_ACCESS when zombies don't work
> To: "Keith Blount" 
> Cc: cocoa-dev@lists.apple.com, "Sean McBride" 
> Date: Wednesday, February 16, 2011, 6:52 PM
> A big clue is in your backtrace:
> 
> #261968    0x98d06f38 in CFRelease
> #261969    0x98d06f38 in CFRelease
> #261970    0x98d06f38 in CFRelease
> #261971    0x98d33c6d in
> _CFAutoreleasePoolPop
> #261972    0x9867d0aa in
> NSPopAutoreleasePool
> #261973    0x9867cfd2 in -[NSAutoreleasePool
> drain]
> #261974    0x986c4596 in
> _NSAppleEventManagerGenericHandler
> #261975    0x91450f58 in
> aeDispatchAppleEvent
> #261976    0x91450e57 in
> dispatchEventAndSendReply
> #261977    0x91450d61 in
> aeProcessAppleEvent
> #261978    0x9519d389 in
> AEProcessAppleEvent
> #261979    0x93b9a9ca in _DPSNextEvent
> #261980    0x93b99fce in -[NSApplication
> nextEventMatchingMask:untilDate:inMode:dequeue:]
> #261981    0x93b5c247 in -[NSApplication
> run]
> #261982    0x93b542d9 in NSApplicationMain
> #261983    0x0003513a in main at main.m:23
> 
> 
> 
> //
> #261971    0x98d33c6d in
> _CFAutoreleasePoolPop results in  EXC_BAD_ACCESS when
> you release a variable marked as
> autorelease.   Go back through your code and
> make sure you manually haven't released an autoreleased
> variable.
> 
> Bruce
> 
> 
> 
> 
> 
> On Feb 16, 2011, at 11:27 AM, Keith Blount wrote:
> 
> > And the backtrace doesn't help either:
> > 
> > #261968    0x98d06f38 in CFRelease
> > #261969    0x98d06f38 in CFRelease
> > #261970    0x98d06f38 in CFRelease
> > #261971    0x98d33c6d in
> _CFAutoreleasePoolPop
> > #261972    0x9867d0aa in
> NSPopAutoreleasePool
> > #261973    0x9867cfd2 in
> -[NSAutoreleasePool drain]
> > #261974    0x986c4596 in
> _NSAppleEventManagerGenericHandler
> > #261975    0x91450f58 in
> aeDispatchAppleEvent
> > #261976    0x91450e57 in
> dispatchEventAndSendReply
> > #261977    0x91450d61 in
> aeProcessAppleEvent
> > #261978    0x9519d389 in
> AEProcessAppleEvent
> > #261979    0x93b9a9ca in _DPSNextEvent
> > #261980    0x93b99fce in
> -[NSApplication
> nextEventMatchingMask:untilDate:inMode:dequeue:]
> > #261981    0x93b5c247 in
> -[NSApplication run]
> > #261982    0x93b542d9 in
> NSApplicationMain
> > #261983    0x0003513a in main at
> main.m:23
> 
> 



___

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

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


Re: Tracking a EXC_BAD_ACCESS when zombies don't work

2011-02-16 Thread Sean McBride
On Wed, 16 Feb 2011 11:17:27 -0800, Keith Blount said:

>The debugging continues...

You could try valgrind too:


It works decently on Mac OS now (though no Obj-C GC support still)...

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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


Determine if other process is running 32 or 64 bits

2011-02-16 Thread Jerry Krinock
I need my app to determine if *another* app is running in 32-bit or 64-bit 
mode.  I have found that I can do that with this unix command:

   ps -ax -o flags -o command | grep TargetAppExecutableName

The 3rd least significant bit of the 'flags' is 'LP64', which is 1 for a 64-bit 
process and 0 for a 32-bit process.

Is there a better way to do this?  I tried the processMode returned in the 
ProcessInfoRec GetProcessInfo(), but it has no 32/64 bit distinction.

Thanks,

Jerry Krinock

___

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

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


Re: Determine if other process is running 32 or 64 bits

2011-02-16 Thread Ken Thomases
On Feb 16, 2011, at 1:44 PM, Jerry Krinock wrote:

> I need my app to determine if *another* app is running in 32-bit or 64-bit 
> mode.  I have found that I can do that with this unix command:
> 
>   ps -ax -o flags -o command | grep TargetAppExecutableName
> 
> The 3rd least significant bit of the 'flags' is 'LP64', which is 1 for a 
> 64-bit process and 0 for a 32-bit process.
> 
> Is there a better way to do this?  I tried the processMode returned in the 
> ProcessInfoRec GetProcessInfo(), but it has no 32/64 bit distinction.

If it's actually an application, and you can target 10.6, use 
-[NSRunningApplication executableArchitecture].

Otherwise, you can use sysctl() as illustrated in this Tech Q&A 
. Somewhere in 
the kinfo_proc is the flag you're looking for.  This came up previously on 
Apple's mailing lists, so search the archives.

Regards,
Ken

___

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

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


Re: Determine if other process is running 32 or 64 bits

2011-02-16 Thread Sean McBride
On Wed, 16 Feb 2011 11:44:22 -0800, Jerry Krinock said:

>I need my app to determine if *another* app is running in 32-bit or 64-
>bit mode.  I have found that I can do that with this unix command:
>
>   ps -ax -o flags -o command | grep TargetAppExecutableName
>
>The 3rd least significant bit of the 'flags' is 'LP64', which is 1 for a
>64-bit process and 0 for a 32-bit process.
>
>Is there a better way to do this?  I tried the processMode returned in
>the ProcessInfoRec GetProcessInfo(), but it has no 32/64 bit distinction.

NSRunningApplication executableArchitecture

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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


Receiving global window events?

2011-02-16 Thread Mr. Gecko
Hello. I'm trying to have my application receive events of windows from other 
applications. I have tried carbon events, I may be doing it wrong, but it 
doesn't work. For an example, if I wanted to watch for when an window minimizes 
to the dock, I'll use the following.
EventTypeSpec eventType;
eventType.eventClass = kEventClassWindow;
eventType.eventKind = kEventWindowCollapsing;
InstallEventHandler(GetEventMonitorTarget(), NewEventHandlerUPP(testEvent), 1, 
&eventType, self, NULL);

I would expect this to work as it works for keyboard and mouse events. I would 
also like to be able to get an event when the window closes, and maximizes 
(zooms). I see events for this in the carbon events, but I am guessing you must 
use GetWindowEventTarget to get the events for the window you want it from.

Thanks for any help,
Mr. Gecko

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

Re: Receiving global window events?

2011-02-16 Thread Eric Schlegel

On Feb 16, 2011, at 12:21 PM, Mr. Gecko wrote:

> eventType.eventClass = kEventClassWindow;
> eventType.eventKind = kEventWindowCollapsing;
> 
> I would expect this to work as it works for keyboard and mouse events.

From CarbonEvents.h:

/*
 *  GetEventMonitorTarget()
 *  
 *Currently, the event monitor supports the following event kinds:
 *kEventRawKeyDown, kEventRawKeyUp, kEventRawKeyRepeat,
 *kEventRawKeyModifiersChanged, kEventMouseDown, kEventMouseUp,
 *kEventMouseMoved, kEventMouseDragged, kEventMouseWheelMoved,
 *kEventTabletPoint, and kEventTabletProximity.

The event monitor target does not support window-class events. It is not 
possible to install a Carbon event handler on the event target for a window of 
another process.

The only supported way to detect window events in other processes is to use the 
accessibility API. In this case, you'd want to use some of these notifications:

kAXWindowMiniaturizedNotification
kAXWindowDeminiaturizedNotification

and kAXUIElementDestroyedNotification for detecting when a window closes.

-eric

___

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

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


System Prefs trying to relaunch in 32bit mode

2011-02-16 Thread Trygve Inda
I am building a System Pref Pane.

I target ppc ppc64 i386 and x86_64... Lipo -info confirms these are all in
the binary, but System Preferences launches in 32bit mode when I try to
install my pane.

In a previous project it works, so I am not sure what is happening.

The error reported is:

2011-02-16 21:05:49.803 System Preferences[64108:a0f] dlopen_preflight
failed with dlopen_preflight(/Users/trygve/Library/PreferencePanes/
MyProduct.prefPane/Contents/MacOS/MyProduct): no suitable image found.  Did
find:

/Users/trygve/Library/PreferencePanes/MyProduct.prefPane/Contents/MacOS/MyPr
oduct: GC capability mismatch for /Users/trygve/Library/PreferencePanes/
MyProduct.prefPane

Console says mach-O, but wrong architecture.


___

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

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


Re: System Prefs trying to relaunch in 32bit mode

2011-02-16 Thread Kyle Sluder
2011/2/16 Trygve Inda :
> The error reported is:
>
> 2011-02-16 21:05:49.803 System Preferences[64108:a0f] dlopen_preflight
> failed with dlopen_preflight(/Users/trygve/Library/PreferencePanes/
> MyProduct.prefPane/Contents/MacOS/MyProduct): no suitable image found.  Did
> find:
>
> /Users/trygve/Library/PreferencePanes/MyProduct.prefPane/Contents/MacOS/MyPr
> oduct: GC capability mismatch for /Users/trygve/Library/PreferencePanes/
> MyProduct.prefPane

This error message tells you what you need to know: you need to build
your 64-bit pref pane as GC-capable.

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

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


Re: Question about split view

2011-02-16 Thread Matt Neuburg
>On Sun, 16 Jan 2011 18:35:45 -0500, Phillip Mills  
>said:
>>I see a problem with the following scenario:
>>1) Start with the template project for a split view
>>2) Add a function where a modal view can be shown over it using a style of 
>>UIModalPresentationFullScreen
>>3) Run in portrait mode
>>4) While the modal view is being shown, trigger a memory warning
>>5) Dismiss the modal view
>>
>>The result is that the 'Events' button that brings up the popover root 
>>controller is no longer displayed.  The view has been reloaded, but the 
>>callback that sets up the 'Events' button hasn't been activated.

I've just been looking into this (sorry it took so long for me to get around to 
it) and it's exactly as you said. The sequence of events is very 
straightforward:

* The detail view is initially loaded as the app starts up. viewDidLoad is 
called if you've implemented it. This is your chance to configure the toolbar

* 
splitViewController:willHideViewController:withBarButtonItem:forPopoverController:
 is called, and it inserts the popover-summoning button into the UIToolbar

* The modal view covers the screen

* The memory warning takes place

* The detail view is not visible, so it is unloaded and the reference to it is 
nillified, and viewDidUnload is called

* The modal view is dismissed

* The detail view is reloaded. So, the view including the UIToolbar is brought 
in from the nib, and viewDidLoad is called if you've implemented it. This is 
your chance to configure the toolbar again

* That's all - 
splitViewController:willHideViewController:withBarButtonItem:forPopoverController:
 is, as you say, *not* called again - and therefore the popover-summoning 
button is never added to the toolbar that just got loaded fresh (and empty) 
from the nib.

The same thing, by the way, is true of the text in the middle of the detail 
view. This is supposed to say "row 4" or whatever row of the master view you 
tapped on, but if the detail view is unloaded and reloaded, that info is not 
restored.

So, I think what you've discovered is well worth pointing out, but one could 
argue that it isn't a bug. It would be wrong to call willHideViewController 
again, surely. It's just that, if you add something to the app that allows view 
unloading to take place, you have to cover your bases. A solution might be 
something like this:

- (void)viewDidUnload {
[super viewDidUnload];
self.toolbarItems = self.toolbar.items; // property with retain policy
}

- (void)viewDidLoad {
[super viewDidLoad];
if (self.toolbarItems) {
self.toolbar.items = self.toolbarItems;
self.toolbarItems = nil;
}
}

m.

--
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.apeth.net/matt/default.html#applescriptthings___

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

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


Re: Receiving global window events?

2011-02-16 Thread Mr. Gecko
My guess is I'll have to keep track of applications starting and get their pid 
to do everything. I was kinda hoping for a register for all, but it doesn't 
seem to have it.
AXObserverRef observer;
AXObserverCreate(0, testEvent, &observer);
AXObserverAddNotification(observer, NULL, kAXWindowMiniaturizedNotification, 
self);
Or am I just doing it wrong?

On Feb 16, 2011, at 2:50 PM, Eric Schlegel wrote:

> The only supported way to detect window events in other processes is to use 
> the accessibility API. In this case, you'd want to use some of these 
> notifications:
> 
> kAXWindowMiniaturizedNotification
> kAXWindowDeminiaturizedNotification
> 
> and kAXUIElementDestroyedNotification for detecting when a window closes.
> 
> -eric
> 



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

Two Newbie Questions

2011-02-16 Thread Bruce Cresanta
Hello,

I have two newbie questions.


I have an NSTableView set up to a datasource of a single array.   When I run my 
code, I get two columns (the default in IB) instead of just one with the data 
duplicated in each column.I only want one column, how best to achieve this?

Secondly,

NSButton can be set up to perform a selector in IB on click.How do 
you set Target/Action for a button in code?

Thanks,

Bruce
___

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

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


Re: Two Newbie Questions

2011-02-16 Thread Sherm Pendley
On Wed, Feb 16, 2011 at 5:56 PM, Bruce Cresanta  wrote:
>
> I have an NSTableView set up to a datasource of a single array.   When I run 
> my code, I get two columns (the default in IB) instead of just one with the 
> data duplicated in each column.    I only want one column, how best to 
> achieve this?

Select the table view in IB, then change its "Columns" attribute in
the "Attributes" pane of the inspector panel.

>        NSButton can be set up to perform a selector in IB on click.    How do 
> you set Target/Action for a button in code?

It's pretty rare that you'd need to, so I have to ask the obligatory
question: Are you sure you want to do that? If you tell us what you're
trying to accomplish, we might be able to help you find a way to do it
that doesn't involve setting up the target & action in code.

That said:

  [theButton setTarget:aTarget]; // Set the target to nil to send an
action to the responder chain
  [theButton setAction:@selector(doAction:)]; // Don't forget the colon...

sherm--

-- 
Cocoa programming in Perl:
http://camelbones.sourceforge.net
___

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

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


Re: Two Newbie Questions

2011-02-16 Thread Bruce Cresanta
Hi Sherm,

About my second question.I've written a custom control that 
currently has and icon tracked by a tracking area to perform an action.   I 
would like to change it to a regular button without setting up my custom 
control to be compatible with IB.

Thanks,

Bruce

On Feb 16, 2011, at 4:15 PM, Sherm Pendley wrote:

> On Wed, Feb 16, 2011 at 5:56 PM, Bruce Cresanta  wrote:
>> 
>> I have an NSTableView set up to a datasource of a single array.   When I run 
>> my code, I get two columns (the default in IB) instead of just one with the 
>> data duplicated in each column.I only want one column, how best to 
>> achieve this?
> 
> Select the table view in IB, then change its "Columns" attribute in
> the "Attributes" pane of the inspector panel.
> 
>>NSButton can be set up to perform a selector in IB on click.How 
>> do you set Target/Action for a button in code?
> 
> It's pretty rare that you'd need to, so I have to ask the obligatory
> question: Are you sure you want to do that? If you tell us what you're
> trying to accomplish, we might be able to help you find a way to do it
> that doesn't involve setting up the target & action in code.
> 
> That said:
> 
>  [theButton setTarget:aTarget]; // Set the target to nil to send an
> action to the responder chain
>  [theButton setAction:@selector(doAction:)]; // Don't forget the colon...
> 
> sherm--
> 
> -- 
> Cocoa programming in Perl:
> http://camelbones.sourceforge.net

___

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

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


Re: Two Newbie Questions

2011-02-16 Thread Nick Zitzmann

On Feb 16, 2011, at 3:56 PM, Bruce Cresanta wrote:

> I have an NSTableView set up to a datasource of a single array.   When I run 
> my code, I get two columns (the default in IB) instead of just one with the 
> data duplicated in each column.I only want one column, how best to 
> achieve this?

You can set the number of columns in the table view in IB's table view 
inspector. If you're clicking on the table view and seeing the inspector for a 
scroll view instead, try clicking again. Table views are normally enclosed 
inside a scroll view.

>   NSButton can be set up to perform a selector in IB on click.How do 
> you set Target/Action for a button in code?

Did you see the -setTarget: and -setAction: methods in the headers or 
documentation?

Nick Zitzmann


___

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

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


Re: Two Newbie Questions

2011-02-16 Thread Graham Cox

On 17/02/2011, at 10:17 AM, Bruce Cresanta wrote:

> I would like to change it to a regular button without setting up my custom 
> control to be compatible with IB.


As long as it's a view of some kind you don't need to do anything special to be 
compatible with IB - just set the class of the object to your custom class. It 
won't be WYSIWYG in IB, but if it has IBOutlets you can connect them in IB and 
they'll work. This includes target/action.

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

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


Re: Two Newbie Questions

2011-02-16 Thread Bruce Cresanta
Graham,

I thought there was a long process to make the control even visible to 
IB?   I could create a custom view and set the class, but that wouldn't show 
the button would it?

Thanks,

Bruce 

On Feb 16, 2011, at 4:51 PM, Graham Cox wrote:

> 
> On 17/02/2011, at 10:17 AM, Bruce Cresanta wrote:
> 
>> I would like to change it to a regular button without setting up my custom 
>> control to be compatible with IB.
> 
> 
> As long as it's a view of some kind you don't need to do anything special to 
> be compatible with IB - just set the class of the object to your custom 
> class. It won't be WYSIWYG in IB, but if it has IBOutlets you can connect 
> them in IB and they'll work. This includes target/action.
> 
> --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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Determine if other process is running 32 or 64 bits

2011-02-16 Thread Jerry Krinock

On 2011 Feb 16, at 12:05, Ken Thomases wrote:

> If it's actually an application, and you can target 10.6, use 
> -[NSRunningApplication executableArchitecture].

Thanks, but need 10.5 support.

> Otherwise, you can use sysctl() as illustrated in this Tech Q&A 
> . Somewhere in 
> the kinfo_proc is the flag you're looking for.

Maybe, but if so it's not documented:

struct kinfo_proc {
structextern_proc kp_proc;/* proc structure */
structeproc {
structproc *e_paddr;/* address of proc */
structsession *e_sess;/* session pointer */
struct_pcred e_pcred;/* process credentials */
struct_ucred e_ucred;/* current credentials */
struct vmspace e_vm;/* address space */
pid_te_ppid;/* parent process id */
pid_te_pgid;/* process group id */
shorte_jobc;/* job control counter */
dev_te_tdev;/* controlling tty dev */
pid_te_tpgid;/* tty process group id */
structsession *e_tsess;/* tty session pointer */
#defineWMESGLEN7
chare_wmesg[WMESGLEN+1];/* wchan message */
segsz_t e_xsize;/* text size */
shorte_xrssize;/* text rss */
shorte_xccount;/* text references */
shorte_xswrss;
int32_te_flag;
#defineEPROC_CTTY0x01/* controlling tty vnode active */
#defineEPROC_SLEADER0x02/* session leader */
#defineCOMAPT_MAXLOGNAME12
chare_login[COMAPT_MAXLOGNAME];/* short setlogin() name */
#if CONFIG_LCTX
pid_te_lcid;
int32_te_spare[3];
#else
int32_te_spare[4];
#endif
} kp_eproc;
};


>  This came up previously on Apple's mailing lists, so search the archives.

Couldn't find anything in there.  I found several people using kinfo_proc to 
get all kinds of process info, like this:

http://www.nightproductions.net/dsprocessesinfo_m.html

but nobody comes up with the running architecture.

I suppose I could spend hours searching all three of Apple's open-source sites:

http://opensource.apple.com/
http://www.apple.com/opensource/
http://www.macosforge.org/

to see if I could find the some code that fills in a kinfo_proc, but since the 
answer may in the end be "no", I'm going to forget this and use 'ps -ax -o 
flags' as I originally suggested.  At least I have a proof-of-concept demo with 
that.

Thanks for the ideas, guys.

Jerry

___

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

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


Re: Two Newbie Questions

2011-02-16 Thread Graham Cox

On 17/02/2011, at 10:53 AM, Bruce Cresanta wrote:

>   I thought there was a long process to make the control even visible to 
> IB?   I could create a custom view and set the class, but that wouldn't show 
> the button would it?


No, it would show a blank green rectangle (if it's a NSView subclass) or a 
standard button (if it's a NSButton subclass), but the point is you can set its 
properties, outlets, and so on, and at runtime it would use your custom class, 
so would appear as you want it. Just set the class in the 'Class' section of 
the 'View Identity' tab in the Inspector.

You only need to create an IB plug-in if you want it WYSIWYG in IB, or if it 
has special settings that you wish to set in IB and not in code.

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

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


Re: Determine if other process is running 32 or 64 bits

2011-02-16 Thread Greg Parker
On Feb 16, 2011, at 3:59 PM, Jerry Krinock wrote:
> On 2011 Feb 16, at 12:05, Ken Thomases wrote:
> 
>> If it's actually an application, and you can target 10.6, use 
>> -[NSRunningApplication executableArchitecture].
> 
> Thanks, but need 10.5 support.
> 
> I suppose I could spend hours searching all three of Apple's open-source 
> sites:
> 
> http://opensource.apple.com/
> http://www.apple.com/opensource/
> http://www.macosforge.org/
> 
> to see if I could find the some code that fills in a kinfo_proc, but since 
> the answer may in the end be "no", I'm going to forget this and use 'ps -ax 
> -o flags' as I originally suggested.  At least I have a proof-of-concept demo 
> with that.

`top` knows about 64-bit processes and is available at opensource.apple.com. 
Try libtop_p_cputype() in libtop.c.

Be warned that top often does things that are not supported. You should call 
-[NSRunningApplication executableArchitecture] on 10.6+ and do whatever top 
does on 10.5 only.


-- 
Greg Parker gpar...@apple.com Runtime Wrangler


___

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

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


Re: Question about split view

2011-02-16 Thread Matt Neuburg
Actually, now that I think of it, an even simpler, more sweeping solution is to 
make the split view controller your own UISplitViewController subclass, and 
implement didReceiveMemoryWarning to return immediately:

- (void) didReceiveMemoryWarning {
return;
}

Now the detail view will never be unloaded and the problem won't arise. I did 
sort of suggest this the last time we discussed this topic; I just didn't spell 
it all the way out. m.


On Wed, 16 Feb 2011 13:42:28 -0800, Matt Neuburg  said:
>>On Sun, 16 Jan 2011 18:35:45 -0500, Phillip Mills  
>>said:
>>>I see a problem with the following scenario:
>>>1) Start with the template project for a split view
>>>2) Add a function where a modal view can be shown over it using a style of 
>>>UIModalPresentationFullScreen
>>>3) Run in portrait mode
>>>4) While the modal view is being shown, trigger a memory warning
>>>5) Dismiss the modal view
>>>
>>>The result is that the 'Events' button that brings up the popover root 
>>>controller is no longer displayed.  The view has been reloaded, but the 
>>>callback that sets up the 'Events' button hasn't been activated.
>
>I've just been looking into this (sorry it took so long for me to get around 
>to it) and it's exactly as you said. The sequence of events is very 
>straightforward:
>
>* The detail view is initially loaded as the app starts up. viewDidLoad is 
>called if you've implemented it. This is your chance to configure the toolbar
>
>* 
>splitViewController:willHideViewController:withBarButtonItem:forPopoverController:
> is called, and it inserts the popover-summoning button into the UIToolbar
>
>* The modal view covers the screen
>
>* The memory warning takes place
>
>* The detail view is not visible, so it is unloaded and the reference to it is 
>nillified, and viewDidUnload is called
>
>* The modal view is dismissed
>
>* The detail view is reloaded. So, the view including the UIToolbar is brought 
>in from the nib, and viewDidLoad is called if you've implemented it. This is 
>your chance to configure the toolbar again
>
>* That's all - 
>splitViewController:willHideViewController:withBarButtonItem:forPopoverController:
> is, as you say, *not* called again - and therefore the popover-summoning 
>button is never added to the toolbar that just got loaded fresh (and empty) 
>from the nib.
>
>The same thing, by the way, is true of the text in the middle of the detail 
>view. This is supposed to say "row 4" or whatever row of the master view you 
>tapped on, but if the detail view is unloaded and reloaded, that info is not 
>restored.
>
>So, I think what you've discovered is well worth pointing out, but one could 
>argue that it isn't a bug. It would be wrong to call willHideViewController 
>again, surely. It's just that, if you add something to the app that allows 
>view unloading to take place, you have to cover your bases. A solution might 
>be something like this:
>
>- (void)viewDidUnload {
>[super viewDidUnload];
>self.toolbarItems = self.toolbar.items; // property with retain policy
>}
>
>- (void)viewDidLoad {
>[super viewDidLoad];
>if (self.toolbarItems) {
>self.toolbar.items = self.toolbarItems;
>self.toolbarItems = nil;
>}
>}
>
>m.

--
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.apeth.net/matt/default.html#applescriptthings___

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

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


Webkit failing on release build

2011-02-16 Thread Bruce Cresanta
Hello,

I'm trying to run the release target of a project using webkit.It 
results in the following error:


dyld: Symbol not found: 
__ZN3JSC23objectProtoFuncToStringEPNS_9ExecStateEPNS_8JSObjectENS_7JSValueERKNS_7ArgListE
  Referenced from: 
/System/Library/Frameworks/WebKit.framework/Versions/A/Frameworks/WebCore.framework/Versions/A/WebCore
  Expected in: 
/AREASResearchBuild/Release/JavaScriptCore.framework/Versions/A/JavaScriptCore
 in 
/System/Library/Frameworks/WebKit.framework/Versions/A/Frameworks/WebCore.framework/Versions/A/WebCore





Does anyone have any ideas?

Thanks,

Bruce

___

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

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


Re: Receiving global window events?

2011-02-16 Thread Eric Schlegel

On Feb 16, 2011, at 2:07 PM, Mr. Gecko wrote:

> My guess is I'll have to keep track of applications starting and get their 
> pid to do everything. I was kinda hoping for a register for all, but it 
> doesn't seem to have it.

No, sorry, there's no way to register for notifications across all processes. 
You need to register for specific process IDs.

-eric

___

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

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


Re: How to optimize image loading during core animation?

2011-02-16 Thread Tomáš Znamenáček
Hello, 

since no one replied so far, I’d take a try. I’m not much familiar with desktop 
Cocoa, but on iOS we have to be careful to keep longer actions from the main 
thread, since delays in the main thread block the UI. Isn’t this about the same 
issue? Image loading would be the first thing I would move into a background 
thread. Can you use GCD? It’s a perfect fit for such producer/consumer tasks.

T. 
___

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

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