Re: How to track all keyboard event?

2008-03-17 Thread Andrew Farmer

On 17 Mar 08, at 16:05, frank.gongpengjun wrote:
I am porting a game onto Mac OS X, I need to track all keyboard  
event even it is not for me. How can I achieve that goal?


By "game", do you mean "keyboard logger"? This is intentionally not  
made easy in OS X; keyboard input to certain sources (password fields  
in particular) is deliberately not made available to other  
applications to maintain security.


If you really are working on a game, though, Thomases' suggestion of  
overriding -sendEvent: is probably the way to go if you're writing a  
Cocoa application. There's also GetKeys() if you're working with  
Carbon, although you should probably head over to carbon-dev if that's  
the case.

___

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 [EMAIL PROTECTED]


Re: make a window not draggable in spaces

2008-03-17 Thread Cocoa Developer
Thank you to all.
My application is a full screen video application, if we move in spaces, it
does not fit completely on that space. If we come out of space, it takes
fullscreen again.

We cannot do any modification to window properties in spaces.

Is there a way ?

Regards,
Basavaraj



On Tue, Mar 18, 2008 at 4:01 AM, Roy Lovejoy <[EMAIL PROTECTED]> wrote:

>
> On Mar 17, 2008, at 1:45 PM, Michael Watson wrote:
>
> > Why do you want to do this?
>
> so that exposé & spaces doesn't get majorly confused when you're using
> an overlay and/or grouped window.
> currently, exposé & spaces will ignore the fact that you've grouped
> windows together.. if you do drawing on a grouped overlay window, with
> the express desire for them to be joined, those two apps will treat
> the windows as separate entities & do their voodoo to each one
> separately.
> (rip them appart in Exposé, or put them in different spaces in spaces)
>
> > I would be pretty annoyed if I couldn't drag a window from space to
> > space if it appeared in my zoomed-out spaces.
>
> no, actually, you wouldn't be annoyed, since this work around is
> normally for an OVERLAY window or an otherwise GROUPED window, which
> under normal circumstances doesn't have a drag UI.
>
> in other words, the end user doesn't realize it's something draggable
> to begin with...
>
> the OP seems left the bit about why he doesn't want the window
> draggable, but since its been one of the major headaches in Spaces &
> window management, it's quite forgiveable..
>
>
> ___
>
> 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/imcocoadeveloper%40gmail.com
>
> This email sent to [EMAIL PROTECTED]
>
___

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 [EMAIL PROTECTED]


Re: interface builder 3 question

2008-03-17 Thread varun
>
> On Mar 17, 2008, at 10:55 PM, Kyle Sluder wrote:
>
>> I assume you mean you want to specify the class of the instance,
>> because "specifying the NSObject's superclass" is a nonsensical
>> statement.  The field you're looking for is on the Identity pane of
>> the Inspector
>
> LOL. Sorry, I shouldn't try and do this stuff so late at night!  I
> meant "specifying the new class' superclass".
>
> I did use the Identity Pane to change the class from NSObject to
> another class that doesn't exist, but how do I tell Interface Builder
> that the new class I'm specifying and intend to have it generate the
> files for is a subclass of NSObject, or whatever class I want it use
> as the superclass?  I used to be able to use the class hierarchy,
> right click on NSObject, or NSView or whatever and select create
> subclass, and then instantiate the subclass. I'm able to create an
> instance, but I don't know how to tell it that the instance I'm
> creating should be a new class, or how it fits in the class hierarchy.
>
> I hope I made more sense that time. Thanks,
> Jeff
>

I probably shouldn't try to answer e-mails this late at night myself, but
hopefully this help.

Starting with Interface Builder 3, it is suggested that you don't define
your class in IB and have it generate the code.  Instead you define it in
XCode and IB will stay in sync with those changes.  Look here:

http://developer.apple.com/documentation/DeveloperTools/Conceptual/IB_UserGuide/ConnectionsandBindings/chapter_6_section_3.html


I hope that helps,

Varun

___

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 [EMAIL PROTECTED]


Re: Confused about CFRunLoop

2008-03-17 Thread Eric Schlegel


On Mar 17, 2008, at 7:53 PM, Brian Greenstone wrote:


[[NSApplication sharedApplication] run];

That actually works!  My timer fires off like it should, yet  
everything else works too.  I can still access the menus, and window  
still receive click events.  Unfortunately, there's no way to exit  
that event loop as far as I can tell.  I tried this...


CFRunLoopStop(CFRunLoopGetCurrent());

... but that did nothing.

So, can someone explain the correct way to install a Timer, have the  
system keep working like normal, and then be able to quit that event  
loop from the timer's callback?


I think you want to replace QuitApplicationEventLoop with [NSApp  
stop]. Then you can use either CFRunLoopTimer or NSTimer and  
everything else will work properly.


-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 [EMAIL PROTECTED]


Re: Confused about CFRunLoop

2008-03-17 Thread Kyle Sluder
On Tue, Mar 18, 2008 at 12:01 AM, Brian Greenstone <[EMAIL PROTECTED]> wrote:
> Cocoa is really only necessary for GUI based apps

We seem to have not made any progress.  Until you change that
misconception, this is going to be rather difficult.  Back when this
OS was known as NEXTSTEP and Core Foundation didn't exist things
seemed to work just fine...

>  Both block any user input, so there's no way to use menu's or controls
>  in any windows.  This has nothing to do with Cocoa vs. C or whatever
>  since they both do the exact same thing.

You're right, which is why you should re-read what I said.  You're
doing it wrong.  It is a very, very rare thing to create your own run
loop.  If you do, you better know what you're doing; in this case,
what you're doing is throwing yourself into a modal loop that prevents
AppKit from dispatching your events.  If you read the docs, you will
see that run loops exit when all their input sources have been
detached.  All your events come in from the Window Server on an input
source which is attached to your main run loop.  *If you create your
own run loop these events will never be dequeued, as the main run loop
is waiting for yours to finish.*

--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 [EMAIL PROTECTED]


Re: Confused about CFRunLoop

2008-03-17 Thread Rob Keniger


On 18/03/2008, at 2:04 PM, Rob Keniger wrote:

Works great and it sounds like it will do what you want. The trick  
is to set the run loop mode correctly, you can probably do something  
equivalent with the CF calls if you like. I like my Obj-C gibberish  
so I avoid CF if possible ;-)



I checked the docs and it looks like you should be able to just pass  
kCFRunLoopCommonModes as the run loop mode in CFRunLoopAddTimer() to  
do the same thing.


--
Rob Keniger



___

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 [EMAIL PROTECTED]


Re: NSView enterFullScreenMode:withOptions: woes; window levels

2008-03-17 Thread Brian Christensen

On Mar 17, 2008, at 4:51 , Sean McBride wrote:


Hi all,

Is anyone using the new NSView full screen methods in 10.5?

I have a window which contains a 'group view', it is basically an  
NSView

that contains two subviews: a button, and an custom NSView that draws
pretty pictures.  The button displays a floating palette (NSPanel).

My ultimate goal is to make the 'group view' full screen but allow the
floating palette to be above it.

If I do:

NSDictionary* options = [NSDictionary
 dictionaryWithObjectsAndKeys:
  [NSNumber numberWithInt:kCGNormalWindowLevel],
   NSFullScreenModeWindowLevel, nil];
[groupView enterFullScreenMode:[NSScreen mainScreen]
 withOptions:options];
NSLog (@"level %d", [[groupView window] level]);

Then it does go fullscreen, but the window level is
kCGMaximumWindowLevel-1, not kCGNormalWindowLevel.  As such, my panel
(at kCGFloatingWindowLevel) is invisible.

Am I doing something wrong here?  Shouldn't the window level be what I
told it to be?


I am unsure why this is even presented as an option for the mode  
dictionary. To my knowledge the CGDirectDisplay API (which is what the  
enterFullScreenMode: method is using under the hood) does not support  
specifying your own shielding window level. The result is that the  
window hosting your NSView is going to have to be promoted to a window  
level that is equal to or higher than the result of  
CGShieldingWindowLevel(). Otherwise it would be covered by the  
blanking window created by the display API.


You might alternately try to set the window level on your floating  
palette instead, ie. [paletteWindow setLevel:kCGMaximumWindowLevel].


/brian



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 [EMAIL PROTECTED]

Re: Confused about CFRunLoop

2008-03-17 Thread Rob Keniger


On 18/03/2008, at 1:26 PM, Brian Greenstone wrote:

I was using NSTimer originally, but I was having the exact same  
problem since NSTimer is really just a CFRunLoopTimerRef according  
to the docs.  As far as I can tell, using NS calls to do this is  
just a more complicated way than simply calling CF directly to do it  
without all that Obj-C gibberish.


That being said, I'm really not trying to do anything funky.  I'm  
just trying to setup a Timer that will fire at 60 times/second to  
call my game's main loop.  Each time it fires, the passes thru the  
game's main loop once.  When the game is done, I exit the loop to  
return to the game's menu or high-scores screen.  The logic worked  
great with those old Carbon calls, and everything is actually  
working now with these CF run loop calls too, it's just that I'm not  
getting mouse or keyboard events when I enter the loop.  They're  
being blocked.  So, the big question is really:  how do I enter a CF  
run loop and keep getting keyboard and mouse events?



I don't use CFRunLoop, but I use this code to create a timer that does  
not get stopped by keyboard/mouse events:


theTimer=[NSTimer timerWithTimeInterval:0.1 target:self  
selector:@selector(doStuff:) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:theTimer  
forMode:NSRunLoopCommonModes];


Works great and it sounds like it will do what you want. The trick is  
to set the run loop mode correctly, you can probably do something  
equivalent with the CF calls if you like. I like my Obj-C gibberish so  
I avoid CF if possible ;-)


--
Rob Keniger



___

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 [EMAIL PROTECTED]


Re: Confused about CFRunLoop

2008-03-17 Thread Brian Greenstone
Cocoa is really only necessary for GUI based apps, but I'm doing games  
which are almost 99.9% custom code with no Mac OS X GUI.  Ergo, I  
really don't have any need for Cocoa other than the basic window and  
OpenGL initialization.  After that I just use Core Foundation for  
everything else.  Like I say, tho, according to the docs, a CF run  
loop is the same exact thing as an NS run loop.  It's just a matter of  
if you prefer calling a C function or an Obj-C class.  They both do  
the same thing, and both act like modal run loops when I start them.   
Both block any user input, so there's no way to use menu's or controls  
in any windows.  This has nothing to do with Cocoa vs. C or whatever  
since they both do the exact same thing.


I know that there is a way to do what I want to do because I've read  
that RunApplicationEventLoop() is just CFRunLoopRun() with some extra  
work on top of it to make it run non-modally.  So, what I just need to  
figure out is what RunApplicationEventLoop() is doing to do that.  I  
doubt it's anything magical, it's probably just some additional  
combination of CF calls, but I can't figure out what those calls are :(


Oh well...

Thanks,

-Brian




On Mar 17, 2008, at 10:52 PM, Kyle Sluder wrote:


I really can't find a better way to say this, so here it goes: the
"Obj-C gibberish" you refer to is an entire object-oriented platform,
and is *the* canonical way to develop applications for OS X.  It seems
you don't fully understand what Cocoa is, and that might be the root
of your problems.  As MC Lars would say, "I hate to say it, but
welcome to the future."  This is cocoa-dev after all.

That said, for what you're doing, you would not create a run loop and
run it yourself.  Creating a new run loop will, as you surmised, send
yourself into what amounts to a modal loop.  Events (mouse, keyboard,
ink, Apple Events...) come in from the window server and get queued in
some input that's attached to the main thread's run loop.  If you're
spinning in your own run loop, your main run loop will never get the
opportunity to process and dispatch those events.  So you will need to
create a timer (NSTimer or CFRunLoopTimerRef) and schedule it on the
existing run loop in the modes you need.


__
Brian Greenstone
President & CEO[EMAIL PROTECTED]
Pangea Software, Inc.  http://www.pangeasoft.net
12405 John Simpson Ct. voice/fax:  (512)266-9991
Austin, TX 78732
__




___

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 [EMAIL PROTECTED]


Re: interface builder 3 question

2008-03-17 Thread Kyle Sluder
On Mon, Mar 17, 2008 at 11:01 PM, Jeff LaMarche <[EMAIL PROTECTED]> wrote:
>  LOL. Sorry, I shouldn't try and do this stuff so late at night!  I
>  meant "specifying the new class' superclass".

Oh.  You don't.  IB3 is a different beast.  Instead, you write your
code in Xcode and then switch to IB and instantiate it.  If your nib
belongs to a project, there's no loading of files or any code
generation going on.  IB3 reads and parses your header files on the
fly, noting changes as they occur.

Check out the IB3 getting started guide; it does a decent job
explaining some of the fundamental differences between IB2 and IB3.

--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 [EMAIL PROTECTED]


Re: Confused about CFRunLoop

2008-03-17 Thread Kyle Sluder
On Mon, Mar 17, 2008 at 11:26 PM, Brian Greenstone <[EMAIL PROTECTED]> wrote:
> I was using NSTimer originally, but I was having the exact same
>  problem since NSTimer is really just a CFRunLoopTimerRef according to
>  the docs.  As far as I can tell, using NS calls to do this is just a
>  more complicated way than simply calling CF directly to do it without
>  all that Obj-C gibberish.

I really can't find a better way to say this, so here it goes: the
"Obj-C gibberish" you refer to is an entire object-oriented platform,
and is *the* canonical way to develop applications for OS X.  It seems
you don't fully understand what Cocoa is, and that might be the root
of your problems.  As MC Lars would say, "I hate to say it, but
welcome to the future."  This is cocoa-dev after all.

That said, for what you're doing, you would not create a run loop and
run it yourself.  Creating a new run loop will, as you surmised, send
yourself into what amounts to a modal loop.  Events (mouse, keyboard,
ink, Apple Events...) come in from the window server and get queued in
some input that's attached to the main thread's run loop.  If you're
spinning in your own run loop, your main run loop will never get the
opportunity to process and dispatch those events.  So you will need to
create a timer (NSTimer or CFRunLoopTimerRef) and schedule it on the
existing run loop in the modes you need.

--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 [EMAIL PROTECTED]


Re: Confused about CFRunLoop

2008-03-17 Thread Brian Greenstone
I was using NSTimer originally, but I was having the exact same  
problem since NSTimer is really just a CFRunLoopTimerRef according to  
the docs.  As far as I can tell, using NS calls to do this is just a  
more complicated way than simply calling CF directly to do it without  
all that Obj-C gibberish.


That being said, I'm really not trying to do anything funky.  I'm just  
trying to setup a Timer that will fire at 60 times/second to call my  
game's main loop.  Each time it fires, the passes thru the game's main  
loop once.  When the game is done, I exit the loop to return to the  
game's menu or high-scores screen.  The logic worked great with those  
old Carbon calls, and everything is actually working now with these CF  
run loop calls too, it's just that I'm not getting mouse or keyboard  
events when I enter the loop.  They're being blocked.  So, the big  
question is really:  how do I enter a CF run loop and keep getting  
keyboard and mouse events?


Thanks!

-Brian


On Mar 17, 2008, at 10:10 PM, Jeff LaMarche wrote:


Brian:

Welcome to Cocoa.  It's a different, different approach than the old  
Toolbox or Carbon stuff.


Is there a reason that NSTimer wouldn't work for you? I know you  
work primarily in games (I lost many hours to Xenocide back in the  
day, and a few other of your creations as well), so maybe NSTimer  
can't do what you need, but it's quite unusual to manually create a  
run loop in Cocoa. Your application main method launches the main  
thread's run loop, and when you create new threads, they get a run  
loop automatically as well.


Maybe if you explain a little more about what you need the timer to  
do, I could offer a better suggestion.


Sorry I'm not more help,
Jeff


__
Brian Greenstone
President & CEO[EMAIL PROTECTED]
Pangea Software, Inc.  http://www.pangeasoft.net
12405 John Simpson Ct. voice/fax:  (512)266-9991
Austin, TX 78732
__




___

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 [EMAIL PROTECTED]


Re: Modifying glyph storage in NSLayoutManager

2008-03-17 Thread Martin Wierschin
I have some text items whose glyphs cannot be determined until  
layout. The text string might contain a marker to draw the current  
page number, or to sequentially number paragraphs, etc. The glyphs  
can be determined only by the layout manager; different layout  
managers for the same text storage might display different page  
numbers, for example.


One alternative to the glyph generator is to subclass  
NSTextAttachment. The attachment cell can query the text container /  
layout manager for any information it needs during cell frame  
calculation and drawing.


~Martin

___

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 [EMAIL PROTECTED]


Re: NSButtonCell doesn't visually update during trackMouse:inRect:ofView:untilMouseUp:

2008-03-17 Thread Ben Lachman
So my view is a NSControl subclass and after playing with this some  
it seems you have to do one more thing.  If you're going to have a  
control handle multiple cells (in my case button cells) you have to  
call setCell: for the correct cell in mouseDown: and then let super  
handle the mouse event.  This seems to work much better than trying  
to handle the event yourself.


Does this sound right to you Ken?

In any case I think there should really be more info on how to  
subclass NSControl and NSCell.  The developer docs are really sparse  
on this. I filed a bug asking for a guide on this topic (rdar:// 
5804311).


->Ben
--
Ben Lachman
Acacia Tree Software

http://acaciatreesoftware.com

[EMAIL PROTECTED]
740.590.0009

On Mar 17, 2008, at 4:25 PM, Ken Ferry wrote:

On Mon, Mar 17, 2008 at 8:49 AM, glenn andreas <[EMAIL PROTECTED]>  
wrote:


 On Mar 17, 2008, at 1:42 AM, Ben Lachman wrote:


I have a few NSButtonCells that I'm using in a custom view.  I need
them to track the mouse during clicks and do this by calling
NSCell's trackMouse:inRect:ofView:untilMouseUp:.  This works fine
except that the button cells never update their graphical state by
highlighting or whatever.  However if I call performClick: on them
the button updates as it should.  Is the only solution to this to
implement mouse tracking at the view instead of at the cell level?



 You need to set the control view of the cell to your view and then
 implement the appropriate [update|draw]cell[inside]: methods in your
 view.


Or, a bit more specifically, setControlView: will fail to store
anything if the passed view is not an NSControl.  You can use an
NSCell to purely stamp out drawing in an NSView, but more complicated
interaction requires the view to be an NSControl, so that the cell can
message the control in various ways.  It isn't just updateCell:.

Ken Ferry
Cocoa Frameworks


 Basically a cell expects to be inside a control and needs to be
 able to tell that control to draw itself (and thus redraw the cell).
 One would think that the parameters to trackMouse would be  
sufficient
 to have the cell handle this by itself, but since a control could  
have
 a background behind the cell, it's really up to the control to  
decide

 how to redraw the cell.


___

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 [EMAIL PROTECTED]


Re: interface builder 3 question

2008-03-17 Thread Jeff LaMarche


On Mar 17, 2008, at 10:55 PM, Kyle Sluder wrote:


I assume you mean you want to specify the class of the instance,
because "specifying the NSObject's superclass" is a nonsensical
statement.  The field you're looking for is on the Identity pane of
the Inspector


LOL. Sorry, I shouldn't try and do this stuff so late at night!  I  
meant "specifying the new class' superclass".


I did use the Identity Pane to change the class from NSObject to  
another class that doesn't exist, but how do I tell Interface Builder  
that the new class I'm specifying and intend to have it generate the  
files for is a subclass of NSObject, or whatever class I want it use  
as the superclass?  I used to be able to use the class hierarchy,  
right click on NSObject, or NSView or whatever and select create  
subclass, and then instantiate the subclass. I'm able to create an  
instance, but I don't know how to tell it that the instance I'm  
creating should be a new class, or how it fits in the class hierarchy.


I hope I made more sense that time. Thanks,
Jeff

___

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 [EMAIL PROTECTED]


Re: Confused about CFRunLoop

2008-03-17 Thread Kyle Sluder
On Mon, Mar 17, 2008 at 10:53 PM, Brian Greenstone <[EMAIL PROTECTED]> wrote:
> I'm trying to convert some old Carbon code over to Cocoa, and one of
>  the things I'm doing is converting my old run-loop timers.  I used to
>  use the following code:

Are you sure you want to be creating your own run loops?  Every Cocoa
thread has a default run loop which you can get with +[NSRunLoop
currentRunLoop], and the main thread's run loop is running by default
(technically, this is what happens when you call -[NSApplication run],
which NSApplicationMain() does for you).

If all you're trying to do is create a scheduled timer, use +[NSTimer
scheduledTimerWithTimeInterval:invocation:repeats:] or one of the
other NSTimer class methods.

--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 [EMAIL PROTECTED]


Re: interface builder 3 question

2008-03-17 Thread Kyle Sluder
On Mon, Mar 17, 2008 at 10:45 PM, Jeff LaMarche <[EMAIL PROTECTED]> wrote:
> So, as I said in an earlier post, I'm getting back into Cocoa
>  development after a little hiatus. I was working in IB today. Boy,
>  it's changed, and for the better, but I can't figure out how to do
>  something I used to do in Interface Builder. I want to create an
>  instance of a custom NSObject subclass, which I've been able to do,
>  but I can't figure out how to specify the superclass.

I assume you mean you want to specify the class of the instance,
because "specifying the NSObject's superclass" is a nonsensical
statement.  The field you're looking for is on the Identity pane of
the Inspector.

--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 [EMAIL PROTECTED]


NSMatrix

2008-03-17 Thread Matthew Miller
I am a complete and total new person to coca and I need to create a
horizontal Matrix of cells to house icons of applicationp URLs from a table.
I totally don't know how to do this. If you would like to help me, please
put what I have to do in full detailed steps. Thank you very much.

-- 
- Matt Miller -
___

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 [EMAIL PROTECTED]


Confused about CFRunLoop

2008-03-17 Thread Brian Greenstone
I'm trying to convert some old Carbon code over to Cocoa, and one of  
the things I'm doing is converting my old run-loop timers.  I used to  
use the following code:


InstallEventLoopTimer(..);  
RunApplicationEventLoop();
..
QuitApplicationEventLoop();

That always worked fine, so now I'm trying to do it this way:

CFRunLoopTimerCreate(..);
CFRunLoopAddTimer(..);
CFRunLoopRun();

Unfortunately, these CF run loops behave differently.  When I call  
CFRunLoopRun, my timer does fire off like it should, but it appears to  
be running in a modal loop where I do not have access to the menu bar,  
and my windows no longer receive any mouse click events et.al.  So, as  
an experiment, I tried replacing the CFRunLoopRun() with:


[[NSApplication sharedApplication] run];

That actually works!  My timer fires off like it should, yet  
everything else works too.  I can still access the menus, and window  
still receive click events.  Unfortunately, there's no way to exit  
that event loop as far as I can tell.  I tried this...


CFRunLoopStop(CFRunLoopGetCurrent());

... but that did nothing.

So, can someone explain the correct way to install a Timer, have the  
system keep working like normal, and then be able to quit that event  
loop from the timer's callback?



Thanks,

-Brian




___

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 [EMAIL PROTECTED]


interface builder 3 question

2008-03-17 Thread Jeff LaMarche
So, as I said in an earlier post, I'm getting back into Cocoa  
development after a little hiatus. I was working in IB today. Boy,  
it's changed, and for the better, but I can't figure out how to do  
something I used to do in Interface Builder. I want to create an  
instance of a custom NSObject subclass, which I've been able to do,  
but I can't figure out how to specify the superclass. I can, of  
course, generate the files and then go manually insert the superclass  
in the class declaration, but it seems to me that I must be  
overlooking it, or doing something stupid.


If anyone could point me to how I can specify the parent class of a  
new class in IB, I would appreciate it.


Thanks much
Jeff

___

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 [EMAIL PROTECTED]


Re: NSDate from xsd:dateTime / ISO 8601

2008-03-17 Thread Jens Alfke


On 17 Mar '08, at 4:30 PM, Nathan Vander Wilt wrote:

This works, BUT...I had to edit the format a bit because my time  
strings (in this sample!) did not have the decimal seconds. However,  
I wouldn't be surprised to see input with sub-second precision. How  
can I specify optional format parts?


I don't think you can. You can work around it by trying both formats  
in sequence. (No joke — you should see the date parsing code in  
PubSub. It tries about 30 different date formats one after the other,  
to handle all the crazy mistakes people make in generating RSS feeds.)


As it is, I might as well get rid of the hasSuffix checking and put  
a quoted 'Z' in the format, since that is actually far less likely  
to change than the seconds part in this case


You can do that, but then of course you'll fail to parse dates that do  
have a timezone...


—Jens

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 [EMAIL PROTECTED]

Re: How to track all keyboard event?

2008-03-17 Thread Ken Thomases

On Mar 17, 2008, at 6:05 PM, frank.gongpengjun wrote:

I am porting a game onto Mac OS X, I need to track all keyboard  
event even it is not for me. How can I achieve that goal?


I'm not sure what you mean by "it is not for me".

If you need to see all keyboard events sent to your application,  
without having them processed through NSResponder and friends, you  
can subclass NSApplication and override -sendEvent:.


If you need to see all keyboard events including those sent to other  
applications, you will have to install a Quartz Event Tap.  Look up  
CGEventTapCreate.


-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 [EMAIL PROTECTED]


Re: NSDate from xsd:dateTime / ISO 8601

2008-03-17 Thread Nathan Vander Wilt

Does -dateWithString: really not support the
"international [standard!] string representation" of
ISO 8601?? What's the right way to convert such an
xsd:dateTime to an NSDate?


+[NSDate dateWithString:] is, I think, configured to recognize one  
particular date format, which depends on your system locale. It's  
not very useful. What you want to do is customize an  
NSDateFormatter object to recognize your format, and then parse  
using it.


Here's some code I wrote recently. [...]


Thanks, I'd forgotten about NSDateFormatter. I took your code  
snippets and made the following function:


NSDate* dateFromISO8601(NSString* str) {



I should note for posterity's sake that this function is poorly named:  
ISO 8601 is a versatile format with many representation options. I did  
come across http://boredzo.org/iso8601parser/, which is a category on  
NSCalendarDate that looks like it tries to cover everything. It takes  
a very low level, state machine(ish) approach to the problem.


I've killed an entire afternoon on this already, so for now I'll stick  
with a format of @"-MM-dd'T'HH:mm:ss'Z'". Unless I can prove I'll  
never get a file with sub-second date precision (or some other  
allowable variation of xsd:dateTime), I'll have to revisit this  
eventually. NSXML does seem to be able to take an NSCalendarDate as an  
objectValue (http://developer.apple.com/documentation/Cocoa/Conceptual/NSXML_Concepts/Articles/TransformObjectValues.html 
), but I can only find this for emitted XML, and not during reading. I  
still hope this functionality is already in Cocoa somewhere, but it's  
looking less likely.


thanks,
-natevw
___

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 [EMAIL PROTECTED]


Re: Apple Events and automatic AutoReleasePool managment

2008-03-17 Thread Ken Thomases

On Mar 17, 2008, at 4:25 PM, Andy Klepack wrote:

I'm seeing this problem in some AE handlers installed via  
AEInstallEventHandler. There are no warnings about a pool not  
existing, but the app memory usage grows and grows. Wrapping the  
handler in a pool creation and release appears to solve this.


Your question is valid, and you appear to have found the answer for  
yourself.  Just one FYI:


Have you considered using -[NSAppleEventManager  
setEventHandler:andSelector:forEventClass:andEventID:] instead of  
AEInstallEventHandler?  I suspect Cocoa will take care of the  
autorelease pool for you in that case.


Cheers,
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 [EMAIL PROTECTED]


Re: Prevent application activation after dragging items to the Dock icon?

2008-03-17 Thread Ken Thomases

On Mar 17, 2008, at 2:36 AM, Peter Maurer wrote:

Cocoa applications tend to come to the foreground automatically  
whenever I drag files to their Dock icon. Sometimes, however, I'd  
prefer my application to stay in the background and just start  
working on the file, while giving feedback through the Dock icon.


But this isn't supposed to be a background-only process -- ideally,  
activation behavior would depend on the type of the file(s) I just  
dragged to the Dock.


(You might think such behavior would confuse users. But I do think  
it would be useful in situations where users drag lots of items to  
the application's Dock icon, because they want them to be dealt  
with sequentially. And this kind of non-standard behavior would  
certainly only be an option.)


So is anyone aware of a way to prevent an application from  
activating in these situations -- similar to sending  
preventWindowOrdering to keep windows in the background after mouse  
clicks?


Your best bet might be to perform something like:

[[NSApplication sharedApplication] hide:self];
	[[NSApplication sharedApplication] performSelector:@selector 
(unhideWithoutActivation) withObject:nil afterDelay:0.05];


That will have the effect of shunting the calling application to the  
back of the application z-order.


-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 [EMAIL PROTECTED]


Re: NSDate from xsd:dateTime / ISO 8601

2008-03-17 Thread Nathan Vander Wilt

Does -dateWithString: really not support the
"international [standard!] string representation" of
ISO 8601?? What's the right way to convert such an
xsd:dateTime to an NSDate?


+[NSDate dateWithString:] is, I think, configured to recognize one  
particular date format, which depends on your system locale. It's  
not very useful. What you want to do is customize an NSDateFormatter  
object to recognize your format, and then parse using it.


Here's some code I wrote recently. [...]


Thanks, I'd forgotten about NSDateFormatter. I took your code snippets  
and made the following function:


NSDate* dateFromISO8601(NSString* str) {
static NSDateFormatter* sISO8601 = nil;
if (!sISO8601) {
sISO8601 = [[NSDateFormatter alloc] init];
[sISO8601 setTimeStyle:NSDateFormatterFullStyle];
		[sISO8601 setDateFormat:@"-MM-dd'T'HH:mm:ssZZZ"];	// NOTE:  
problem!

}
if ([str hasSuffix:@"Z"]) {
		str = [[str substringToIndex:(str.length-1)]  
stringByAppendingString:@"GMT"];

}
return [sISO8601 dateFromString:str];
}

This works, BUT...I had to edit the format a bit because my time  
strings (in this sample!) did not have the decimal seconds. However, I  
wouldn't be surprised to see input with sub-second precision. How can  
I specify optional format parts?


As it is, I might as well get rid of the hasSuffix checking and put a  
quoted 'Z' in the format, since that is actually far less likely to  
change than the seconds part in this case. I'd hate to have to go in  
search of a RegEx library or something similarly beyond the scope of  
this one line (ideally) of code, just to process a date in an ISO  
standard date format. Don't property lists store dates in 8601 format?


thanks,
-natevw

___

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 [EMAIL PROTECTED]


Re: reading data from a UDP port - questions

2008-03-17 Thread Benjamin Stiglitz
(2) But in any case, NSString doesn't mind embedded null bytes.  
(It's not null-terminated like a C string; the string object  
remembers the length separately.) That doesn't mean you should store  
binary data in an NSString, though. NSData is better for that.


NSString isn’t really too happy with embedded NULLs. See the  
documentation for the initWith___: methods, which are littered with  
the statement “must not contain NULL.”


-Ben___

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 [EMAIL PROTECTED]


How to track all keyboard event?

2008-03-17 Thread frank.gongpengjun

Hi,

I am porting a game onto Mac OS X, I need to track all keyboard event  
even it is not for me. How can I achieve that goal?


Regards
Frank Gong (Pengjun Gong)






___

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 [EMAIL PROTECTED]


Re: NSDate from xsd:dateTime / ISO 8601

2008-03-17 Thread Jens Alfke


On 17 Mar '08, at 3:20 PM, Nathan Vander Wilt wrote:


Does -dateWithString: really not support the
"international [standard!] string representation" of
ISO 8601?? What's the right way to convert such an
xsd:dateTime to an NSDate?


+[NSDate dateWithString:] is, I think, configured to recognize one  
particular date format, which depends on your system locale. It's not  
very useful. What you want to do is customize an NSDateFormatter  
object to recognize your format, and then parse using it.


Here's some code I wrote recently. This sets up the date formatter,  
which only needs to be done once:


static NSDateFormatter *sISO8601 = [[NSDateFormatter alloc] init];
...
sISO8601.timeStyle = NSDateFormatterFullStyle;
sISO8601.dateFormat = @"-MM-dd'T'HH:mm:ss.SSSZZZ";

Then you parse a date from a string like:

NSDate *date = [sISO8601 dateFromString: str];

Actually, looking at my code, there's a gotcha where the  
NSDateFormatter doesn't seem to understand the "Z" suffix. The best  
workaround I could find was this kludge:

// Formatters don't undnerstand "Z" timezone, so replace it with "GMT":
if( [str hasSuffix: @"Z"] )
	   str = [[str substringToIndex: str.length-1]  
stringByAppendingString: @"GMT"];

Do that just before the -dateFromString call.

—Jens

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 [EMAIL PROTECTED]

Re: make a window not draggable in spaces

2008-03-17 Thread Roy Lovejoy


On Mar 17, 2008, at 1:45 PM, Michael Watson wrote:


Why do you want to do this?


so that exposé & spaces doesn't get majorly confused when you're using  
an overlay and/or grouped window.
currently, exposé & spaces will ignore the fact that you've grouped  
windows together.. if you do drawing on a grouped overlay window, with  
the express desire for them to be joined, those two apps will treat  
the windows as separate entities & do their voodoo to each one  
separately.

(rip them appart in Exposé, or put them in different spaces in spaces)

I would be pretty annoyed if I couldn't drag a window from space to  
space if it appeared in my zoomed-out spaces.


no, actually, you wouldn't be annoyed, since this work around is  
normally for an OVERLAY window or an otherwise GROUPED window, which  
under normal circumstances doesn't have a drag UI.


in other words, the end user doesn't realize it's something draggable  
to begin with...


the OP seems left the bit about why he doesn't want the window  
draggable, but since its been one of the major headaches in Spaces &  
window management, it's quite forgiveable..



___

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 [EMAIL PROTECTED]


Re: Apple Events and automatic AutoReleasePool managment

2008-03-17 Thread Jens Alfke


On 17 Mar '08, at 2:25 PM, Andy Klepack wrote:

In the case of C callbacks wouldn't it be the case that an  
autorelease pool would exist (that of the main thread) but that it  
would not be emptied once the callback completes? You wouldn't see  
any warnings if that were the case.


You're right, that can happen. So I shouldn't have been so sanguine  
about the pool. It's better to put it in (just two lines of code, and  
not a performance hit unless your callback is being invoked incredibly  
often.)


—Jens

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 [EMAIL PROTECTED]

NSDate from xsd:dateTime / ISO 8601

2008-03-17 Thread Nathan Vander Wilt
I'm trying to convert a date formatted as a valid
xsd:dateTime format, which is a subset of ISO 8601. I
though I had it when I saw that that -[NSDate
dateWithString:] takes an "international string
representation format". But when I feed it a string
like @"2007-07-01T01:33:01Z", I get back nil.

Does -dateWithString: really not support the
"international [standard!] string representation" of
ISO 8601?? What's the right way to convert such an
xsd:dateTime to an NSDate?

thanks,
-natevw


  

¡Capacidad ilimitada de almacenamiento en tu correo!
No te preocupes más por el espacio de tu cuenta con Correo Yahoo!:  

http://correo.espanol.yahoo.com/
___

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 [EMAIL PROTECTED]


RE: Apple Events and automatic AutoReleasePool managment

2008-03-17 Thread Andy Klepack
Thanks Jens, that's some really useful information.

In the case of C callbacks wouldn't it be the case that an autorelease pool 
would exist (that of the main thread) but that it would not be emptied once the 
callback completes? You wouldn't see any warnings if that were the case. 
Essentially any objects autoreleased in the callback would be placed in that 
pool, but since the callback exits without somehow making it known that the 
pool should empty the app's memory footprint grows until something prompts the 
empty to occur.

I'm seeing this problem in some AE handlers installed via 
AEInstallEventHandler. There are no warnings about a pool not existing, but the 
app memory usage grows and grows. Wrapping the handler in a pool creation and 
release appears to solve this.

-Andy
-Original Message-
From: Jens Alfke [mailto:[EMAIL PROTECTED]
Sent: Monday, March 17, 2008 12:35 PM
To: Andy Klepack
Cc: cocoa-dev@lists.apple.com
Subject: Re: Apple Events and automatic AutoReleasePool managment


On 17 Mar '08, at 11:38 AM, Andy Klepack wrote:

> Does an 'event cycle' then include anything dispatched from a run
> loop source? For instance, if I was to create a kqueue, create a run
> loop source for it, and add that to the main run loop, does an
> AutoReleasePool automatically get created before the handler is
> called and destroyed after it returns?

In general, Objective-C callback methods are invoked with an
autorelease pool in place. There are exceptions, though (the code that
runs in a new NSThread is one example). But C callbacks invoked from
CoreFoundation or lower levels won't have autorelease pools.

So your kqueue callback needs to create its own autorelease pool,
because it's a C callback called from CoreFoundation (CFRunloop).

> What about for invocations that result from DO communication in
> which the incoming port is registered on the main run loop?

DO puts an autorelease pool on the stack before it calls into your
objects.

It's not that critical to make the right decision here immediately,
though. If you leave out an autorelease pool where one is needed,
you'll get lots of console warnings telling you so, and you can go
back and put one in. If you put in an autorelease pool where it isn't
needed, it's a tiny performance hit but won't hurt anything.

What's more important is to wrap all C callbacks in an @try block to
catch all exceptions. Throwing an exception out of your callback past
exception-unaware C code is practically guaranteed to mangle system
state and cause hard-to-debug crashes soon thereafter.

It's also important to catch exceptions in the top-level method of a
thread, since an uncaught exception without any handler on the stack
will cause your whole process to abort.

-Jens
___

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 [EMAIL PROTECTED]


Re: Creating Custom Views in Interface Builder

2008-03-17 Thread Sean McBride
On 3/15/08 12:48 PM, Rob Keniger said:

>There's a trap for young players in the docs: watch out if you are
>creating a GC-only app. Classes instantiated via IB3 plugins MUST be
>compliant with the traditional retain/release mechanism, you can't
>create a plugin for a class that relies on Garbage Collection.

Also worth noting that IB3 plugins must also be 32 bit, though this is
probably less of a problem in practice.  Still, if you plan to write 64
bit and GC only, IB3 plugins can be somewhat annoying to support.

--

Sean McBride, B. Eng [EMAIL PROTECTED]
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 [EMAIL PROTECTED]


NSView enterFullScreenMode:withOptions: woes; window levels

2008-03-17 Thread Sean McBride
Hi all,

Is anyone using the new NSView full screen methods in 10.5?

I have a window which contains a 'group view', it is basically an NSView
that contains two subviews: a button, and an custom NSView that draws
pretty pictures.  The button displays a floating palette (NSPanel).

My ultimate goal is to make the 'group view' full screen but allow the
floating palette to be above it.

If I do:

NSDictionary* options = [NSDictionary
  dictionaryWithObjectsAndKeys:
  [NSNumber numberWithInt:kCGNormalWindowLevel],
NSFullScreenModeWindowLevel, nil];
[groupView enterFullScreenMode:[NSScreen mainScreen]
  withOptions:options];
NSLog (@"level %d", [[groupView window] level]);

Then it does go fullscreen, but the window level is
kCGMaximumWindowLevel-1, not kCGNormalWindowLevel.  As such, my panel
(at kCGFloatingWindowLevel) is invisible.

Am I doing something wrong here?  Shouldn't the window level be what I
told it to be?

I poked around, and found the private function to set window level, and
it is called, but I'm not sure how to tell what parameter it is being passed.

#0  0x9211ace3 in CGSSetWindowLevel ()
#1  0x9224ff36 in createShieldWindow ()
#2  0x9224fb7f in _CGDisplayCaptureWithPsnAndOptions ()
#3  0x92261257 in _CGCaptureAllDisplaysWithPsnAndOptions ()
#4  0x92261117 in CGCaptureAllDisplaysWithOptions ()
#5  0x92444b7c in CGCaptureAllDisplays ()
#6  0x96ac6dca in +[NSScreen(_NSFullScreenSupport) _captureAllScreens:] ()
#7  0x96ac7464 in -[NSView(NSFullScreenMode)
enterFullScreenMode:withOptions:] ()

Thanks,

--

Sean McBride, B. Eng [EMAIL PROTECTED]
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 [EMAIL PROTECTED]


Re: make a window not draggable in spaces

2008-03-17 Thread Michael Watson
Why do you want to do this? I would be pretty annoyed if I couldn't  
drag a window from space to space if it appeared in my zoomed-out  
spaces.



--
m-s


On 17 Mar, 2008, at 06:28, Cocoa Developer wrote:


Hi,
How to make a window not draggable in spaces.
I used to set NSBorderlessWindowMask mask while creating window,  
when set

Full screen.
But spaces neglect this mask and allow to drag around.

Thank you,
Bas
___

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/mikey-san 
%40bungie.org


This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: Return the value to a pop up window

2008-03-17 Thread Rob Napier
On Mon, Mar 17, 2008 at 9:00 AM, Cocoa <[EMAIL PROTECTED]> wrote:
> I am trying to sodosomething more than the tutorial - Objective-C
>  tutorial.pdf
>
>  It's a Currency Converter application
>
>  the part of the code is below:
>
>  float amount;
> converter = [[Converter alloc]init];
> [converter setSourceCurrencyAmount:[dollarField floatValue]];
> [converter setRate:[rateField floatValue]];
> amount= [converter convertCurrency];
>
> [amountField setFloatValue:amount];
> [rateField selectText:self];
>
>
>  amountField is a NSTextField, amount is a (float) returning answer.
>
>  Can I declare a NSWindow in IB and build a connection from it to the
>  action?

Assuming the above is the action in question, it should generally be
tied either to the input NSTextField or an NSButton. This is not the
kind of action an NSWindow would generally be involved in.

Please spend some time carefully considering your questions. The
readers of this list may often not know what you're talking about when
you refer to "tutorial.pdf" or "the tutorial." There are many out
there. You should explain what you are trying to achieve and what is
failing or what you do not understand. You can certainly declare an
NSWindow in IB and connect it to an action (the question you asked).
It is unlikely that you want to here (the question I believe you
meant).

-Rob

-- 
"Those who would give up essential liberty to purchase a little
temporary safety, deserve neither liberty nor safety." -- B. Franklin,
Printer
___

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 [EMAIL PROTECTED]


Re: NSButtonCell doesn't visually update during trackMouse:inRect:ofView:untilMouseUp:

2008-03-17 Thread Ken Ferry
On Mon, Mar 17, 2008 at 8:49 AM, glenn andreas <[EMAIL PROTECTED]> wrote:
>
>  On Mar 17, 2008, at 1:42 AM, Ben Lachman wrote:
>
>  > I have a few NSButtonCells that I'm using in a custom view.  I need
>  > them to track the mouse during clicks and do this by calling
>  > NSCell's trackMouse:inRect:ofView:untilMouseUp:.  This works fine
>  > except that the button cells never update their graphical state by
>  > highlighting or whatever.  However if I call performClick: on them
>  > the button updates as it should.  Is the only solution to this to
>  > implement mouse tracking at the view instead of at the cell level?
>
>
>  You need to set the control view of the cell to your view and then
>  implement the appropriate [update|draw]cell[inside]: methods in your
>  view.

Or, a bit more specifically, setControlView: will fail to store
anything if the passed view is not an NSControl.  You can use an
NSCell to purely stamp out drawing in an NSView, but more complicated
interaction requires the view to be an NSControl, so that the cell can
message the control in various ways.  It isn't just updateCell:.

Ken Ferry
Cocoa Frameworks

>  Basically a cell expects to be inside a control and needs to be
>  able to tell that control to draw itself (and thus redraw the cell).
>  One would think that the parameters to trackMouse would be sufficient
>  to have the cell handle this by itself, but since a control could have
>  a background behind the cell, it's really up to the control to decide
>  how to redraw the cell.
>
>
>  Glenn Andreas  [EMAIL PROTECTED]
>    wicked fun!
>  quadrium | prime : build, mutate, evolve, animate : the next
>  generation of fractal art
>
>
>
>
>
>  ___
>
>  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/kenferry%40gmail.com
>
>  This email sent to [EMAIL PROTECTED]
>
___

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 [EMAIL PROTECTED]


Equivalent to Carbon's TransitionWindow(); using genie when opening an NSWindow

2008-03-17 Thread Sean McBride
Hi all,

I'd like to use the genie effect (or similar) when opening and closing
an NSWindow.  Carbon has an API named TransitionWindow() for this task,
but it's 32-bit only.  I've searched the archives and it seems there is
no Cocoa equivalent?  Is this still so, even in 10.5?  Could Core
Animation accomplish this?

Thanks,

--

Sean McBride, B. Eng [EMAIL PROTECTED]
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 [EMAIL PROTECTED]


Re: strange "lockFocus sent to a view whose window is deferred" error with an NSOutlineView on Tiger: SOLVED

2008-03-17 Thread Martin Redington


I overrode -[NSTableView setFrameSize:] in my outline view class, so  
that it only calls super if the size has really changed.


This seems to fix the issue - setFrameSize: gets called a few times  
as I add the view - the first few times the values haven't changed.  
By the time they do change, the view's window seems to have been set.



On 17 Mar 2008, at 19:12, Martin Redington wrote:



I overrode lockFocus, and stuck a breakpoint on it.

#0  0x004f87ea in -[MyOutlineView lockFocus] at MyOutlineView.m:75
#1	0x93310315 in -[NSView  
_recursiveDisplayAllDirtyWithLockFocus:visRect:]

#2  0x9332238f in _recursiveDisplayInRect2
#3  0x9083eac0 in CFArrayApplyFunction
#4	0x93310633 in -[NSView  
_recursiveDisplayAllDirtyWithLockFocus:visRect:]
#5	0x9330f493 in -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisib 
leRectForView:topView:]
#6	0x9330e382 in -[NSView  
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:]

#7  0x9330dcae in -[NSView displayIfNeeded]
#8  0x933043ab in -[NSClipView _immediateScrollToPoint:]
#9  0x9343bd92 in -[NSScrollView scrollClipView:toPoint:]
#10 0x932cf34f in -[NSClipView _scrollTo:animate:]
#11 0x932cee3b in -[NSClipView _scrollTo:]
#12 0x932cecc3 in -[NSClipView _reflectDocumentViewFrameChange]
#13 0x932acc75 in -[NSView _postFrameChangeNotification]
#14 0x932cdd75 in -[NSControl setFrameSize:]
#15 0x933a256d in -[NSTableView setFrameSize:]
#16 0x933a0c82 in -[NSTableView tile]
#17 0x933a09d5 in -[NSTableView _tileAndRedisplayAll]
#18 0x932aa113 in -[NSView _setSuperview:]
#19 0x933a3f86 in -[NSTableView _setSuperview:]
#20 0x932a9d51 in -[NSView addSubview:]
#21 0x932c72cf in -[NSClipView setDocumentView:]
#22 0x932c70d0 in -[NSScrollView setDocumentView:]
#23	0x00091f2b in -[MyController(Private) setOutlineView:] at  
MyController.m:3967


When lockFocus is called, the MyOutlineView has its superview set,  
but not its window.


Its possible that window is set lazily, and this is normal, but it  
seems to be non-nil every time it gets past that point without  
erroring.


The other odd thing is that I don't see lockFocus get called at all  
on -[NSScrollView setDocumentView:] when there's no error, or when  
my other outline view gets set.


Presumably, something in the state of that outline view is kicking  
off the redraw before the view is ready.



On 17 Mar 2008, at 17:45, Martin Redington wrote:



On 17 Mar 2008, at 17:07, Michael Nickerson wrote:



On Mar 17, 2008, at 9:06 AM, Martin Redington wrote:



I'm seeing the following error

2008-03-17 12:42:11.916 MyApp[11155] *** Assertion failure in - 
[MyOutlineView lockFocus], AppKit.subproj/NSView.m:3248
2008-03-17 12:42:11.917 MyApp[11155] lockFocus sent to a view  
whose window is deferred and does not yet have a corresponding  
platform window




You usually run into this error when a view tries to draw to a  
window that hasn't been displayed at all yet.  I don't know if  
this is the case for you, since you're talking about swapping  
views, though - are you actually swapping out windows when you do  
this?


Anyway, you can try to make the window non-deferred (you can  
deselect the checkbox for that in IB) and see if you get the  
error then.  Doing that makes the window make a connection to the  
window server when it's created rather than when it's first  
displayed.


The window is a single window app. Making the window non-deferred  
makes no difference.




If that doesn't help, is the scroll view you're adding the  
outline view to part of the view hierarchy when you do that?   
Maybe there was a bug in Tiger where the scroll view tried to  
display the document view immediately when it's set and if it's  
not actually part of a window I suppose this might pop up.   
That's all just a guess, though.


Yep. The scrollview is the place holder for the views, so that's  
always in place.


I'll try and get a test case together - with a bit of luck I'll  
find a workaround while I'm doing that.


___

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/m.redington% 
40ucl.ac.uk


This email sent to [EMAIL PROTECTED]



___

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/m.redington% 
40ucl.ac.uk


This email sent to [EMAIL PROTECTED]



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post

CoreData: Incompatible model configuration problem...

2008-03-17 Thread Martin Linklater
Hi. My Core Data Application is producing 'Incompatible model  
configuration' errors which don't make sense to me Anyone got any  
ideas ...?


My Application contains 4 data models - OptDataDump, Market, Local and  
EVEAPI. Each of the entities in the data models are set to have the  
configuration matching their respective models. So all the entities in  
the 'OptDataDump' model are set to have 'OptDataDump' as their  
configuration, all Local entities have the configuration 'Local'  etc...


These models are combined into one MOM, which is then used to create 4  
separate physical stores. The stores break down like this:


OptDataDump - SQLite
Local - SQLite
EVEAPI - XML
Market - SQLite

My problem is that when I change the model in the 'Local' data model I  
get errors when I add persistent stores for the OptDataDump and Market  
models. Yet these two data models have not changed. Is this normal ?


if (![persistentStoreCoordinator  
addPersistentStoreWithType:NSSQLiteStoreType  
configuration:@"OptDataDump" URL:dataDumpURL options:nil error:&error])

{
[[NSApplication sharedApplication] presentError:error];		<<  
ERROR !

}
if (![persistentStoreCoordinator  
addPersistentStoreWithType:NSXMLStoreType configuration:@"EVEAPI"  
URL:EVEAPIURL options:nil error:&error])

{
[[NSApplication sharedApplication] presentError:error];
}
if (![persistentStoreCoordinator  
addPersistentStoreWithType:NSSQLiteStoreType configuration:@"Market"  
URL:marketURL options:nil error:&error])

{
[[NSApplication sharedApplication] presentError:error];		<<  
ERROR !

}
if (![persistentStoreCoordinator  
addPersistentStoreWithType:NSSQLiteStoreType configuration:@"Local"  
URL:localURL options:nil error:&error])

{
[[NSApplication sharedApplication] presentError:error];
}


Creating the OptDataDump data takes about 2 hours on my machine so I  
really don't want to have to keep on regenerating it every time I  
change the data model in a different store...


Splitting my data into separate physical stores should mean that I can  
change one without the others complaining, yes ? But this seems to be  
a false assumption...


Can anyone help explain this behavior ?

Thanks.


___

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 [EMAIL PROTECTED]


Re: In receiver application, getting file passed in from NSWorkspace openFile:withApplication:

2008-03-17 Thread Jens Alfke


On 17 Mar '08, at 12:00 PM, Ryan Chapman wrote:

Is there any way to get this information from within a command-line  
utility?
In my case, I have a command-line utility wrapped up in an  
application bundle, so I
really don't need any GUI stuff, but I thought I could use the Cocoa  
classes

to get the filename sent without launching a GUI.


You need to register AppleEvent handlers to get the open-document  
event when your process is launched. If you don't have NSApplication  
doing it for you, then you need to use NSAppleEventManager (which is  
in Foundation) to set up handlers and process the event.


—Jens

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 [EMAIL PROTECTED]

Re: Apple Events and automatic AutoReleasePool managment

2008-03-17 Thread Jens Alfke


On 17 Mar '08, at 11:38 AM, Andy Klepack wrote:

Does an 'event cycle' then include anything dispatched from a run  
loop source? For instance, if I was to create a kqueue, create a run  
loop source for it, and add that to the main run loop, does an  
AutoReleasePool automatically get created before the handler is  
called and destroyed after it returns?


In general, Objective-C callback methods are invoked with an  
autorelease pool in place. There are exceptions, though (the code that  
runs in a new NSThread is one example). But C callbacks invoked from  
CoreFoundation or lower levels won't have autorelease pools.


So your kqueue callback needs to create its own autorelease pool,  
because it's a C callback called from CoreFoundation (CFRunloop).


What about for invocations that result from DO communication in  
which the incoming port is registered on the main run loop?


DO puts an autorelease pool on the stack before it calls into your  
objects.


It's not that critical to make the right decision here immediately,  
though. If you leave out an autorelease pool where one is needed,  
you'll get lots of console warnings telling you so, and you can go  
back and put one in. If you put in an autorelease pool where it isn't  
needed, it's a tiny performance hit but won't hurt anything.


What's more important is to wrap all C callbacks in an @try block to  
catch all exceptions. Throwing an exception out of your callback past  
exception-unaware C code is practically guaranteed to mangle system  
state and cause hard-to-debug crashes soon thereafter.


It's also important to catch exceptions in the top-level method of a  
thread, since an uncaught exception without any handler on the stack  
will cause your whole process to abort.


—Jens

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 [EMAIL PROTECTED]

Re: Modifying glyph storage in NSLayoutManager

2008-03-17 Thread Ross Carter
Thank you immensely, Douglas. I've now got something working if I need  
to insert one or two glyphs, but it crashes on three or more glyphs.


You're right, I need to fix my code for invoking the actual glyph  
replacement. For now, let's assume that the attributedString contains  
only one character with an attribute designating it as a dynamic text  
marker. (There will always be only one character per marker).


I'm not 100% sure which method to override in the typesetter, but I  
assume something like this is appropriate (viz., insert or replace  
glyphs in layout manager and then call super):


- (NSUInteger)getGlyphsInRange:(NSRange)glyphsRange glyphs:(NSGlyph  
*)glyphBuffer characterIndexes:(NSUInteger *)charIndexBuffer  
glyphInscriptions:(NSGlyphInscription *)inscribeBuffer elasticBits: 
(BOOL *)elasticBuffer bidiLevels:(unsigned char *)bidiLevelBuffer {
	NSRange charRange = [layoutManager  
characterRangeForGlyphRange:glyphsRange actualGlyphRange:NULL];	

NSRange effRange = NSMakeRange(charRange.location, 0);
while (NSMaxRange(effRange) < NSMaxRange(charRange)) {
NSUInteger charIndex = NSMaxRange(effRange);
		NSNumber *dynText = [attributedString  
attribute:kDynamicTextAttributeName atIndex:charIndex  
effectiveRange:&effRange];

if (dynText != nil) {
			// Grab the glyph range for the char; it might already be correct  
length.
			NSRange dynTextGlyphRange = [layoutManager  
glyphRangeForCharacterRange:NSMakeRange(effRange.location, 1)  
actualCharacterRange:NULL];

// for testing, use an arbitrary array of glyphs:
NSUInteger newGlyphsLength = 2;
NSUInteger newGlyphs[2] = {59, 60};
NSUInteger i;
for (i = 0; i < newGlyphsLength; i++) {
if (i < dynTextGlyphRange.length) {
	[layoutManager replaceGlyphAtIndex:(dynTextGlyphRange.location +  
i) withGlyph:newGlyphs[i]];

} else {
	[layoutManager insertGlyph:newGlyphs[i] atGlyphIndex: 
(dynTextGlyphRange.location + i) characterIndex:effRange.location];
	//[layoutManager setCharacterIndex:effRange.location  
forGlyphAtIndex:(dynTextGlyphRange.location + i)];

}
}
}
}
	return [super getGlyphsInRange:(NSRange)glyphsRange glyphs:(NSGlyph  
*)glyphBuffer characterIndexes:(NSUInteger *)charIndexBuffer  
glyphInscriptions:(NSGlyphInscription *)inscribeBuffer elasticBits: 
(BOOL *)elasticBuffer bidiLevels:(unsigned char *)bidiLevelBuffer];

}

This works fine, as I said, unless newGlyphsLength > 2. The call to  
setCharacterIndex:forGlyphAtIndex: is remmed because I get the same  
error with or without it. The error is: !!!  
_NSLayoutTreeSetLocationForGlyphRange invalid glyph range {3,6}


Here's the relevant portion of the backtrace:

#0  0x90f09245 in CFGetTypeID ()
#1  0x966c2aa6 in TTypesetterRunArray::RelayoutRun ()
#2  0x966c29aa in TTypesetter::MakeLineConsistent ()
#3  0x966b0d17 in TTypesetter::FinishLineFill ()
#4  0x966ad796 in CTTypesetterCreateLine ()
#5  0x902a74a4 in -[NSATSLineFragment  
layoutForStartingGlyphAtIndex:characterIndex:minPosition:maxPosition:lineFragmentRect 
:] ()
#6  0x902a5f21 in -[NSATSTypesetter  
_layoutLineFragmentStartingWithGlyphAtIndex:characterIndex:atPoint:renderingContext 
:] ()

#7  0x902de87a in -[NSATSTypesetter layoutParagraphAtPoint:] ()
#8  0x90286f60 in -[NSTypesetter  
_layoutGlyphsInLayoutManager:startingAtGlyphIndex:maxNumberOfLineFragments:maxCharacterIndex:nextGlyphIndex:nextCharacterIndex 
:] ()
#9  0x90873d3a in -[NSTypesetter  
layoutCharactersInRange:forLayoutManager:maximumNumberOfLineFragments 
:] ()
#10 0x905ef494 in -[NSATSTypesetter  
layoutCharactersInRange:forLayoutManager:maximumNumberOfLineFragments 
:] ()
#11 0x902dc416 in -[NSLayoutManager(NSPrivate)  
_fillLayoutHoleForCharacterRange:desiredNumberOfLines:isSoft:] ()

#12 0x9041b646 in _NSFastFillAllLayoutHolesForGlyphRange ()
#13 0x902e9fea in -[NSLayoutManager  
textContainerForGlyphAtIndex:effectiveRange:] ()

#14 0x903cdf11 in -[NSTextView(NSSharing) didChangeText] ()
#15 0x0004b1ff in -[RCTextManager  
replaceSelectionWithAttributedString:replaceAllAttributes:undoActionName:filterAttributes 
:] (self=0x10d4da0, _cmd=0x7496c, attrString=0x12641d0,  
replaceAllAttrs=0 '\000', actionName=0x84f70, flag=0 '\000') at /Users/ 
ross/Documents/MyApp/Controller Classes/RCTextManager.m:287
#16 0x0005b9a6 in -[Document(Document_Menus) menuInsertPageNumber:]  
(self=0x104e510, _cmd=0x117a40, sender=0x1014730) at /Users/ross/ 
Documents/MyApp/Controller Classes/Document_Menus.m:143


Should I take a different approach?


On Mar 17, 2008, at 1:00 PM, Douglas Davidson wrote:



On Mar 17, 2008, at 9:31 AM, Ross Carter wrote:



What is the correct approach to take when you need NSLayoutManager  
to make on-the-fly adjustments to t

Re: Python/Ruby for Cocoa (was: Simple question)

2008-03-17 Thread Sherm Pendley
On Mon, Mar 17, 2008 at 2:39 PM, Paul Sargent <[EMAIL PROTECTED]> wrote:

>
> On 17 Mar 2008, at 17:46, Hamish Allan wrote:
>
> > If you're cutting your programming teeth on Cocoa, you might find that
> > Python or Ruby is gentler.
>
> I'm not sure I agree. Two problems for me.
>
> * Cocoa isn't a seamless fit with either python or ruby, so there are
> little corner cases around that don't feel quite right. Method naming,
> for example, reads correctly in Objective C, but not in Python. In
> fact it can get quite confusing.
>
> * The documentation for Cocoa on Python and Ruby is far less bountiful
> than for Objective C, so you end up reading Objective C documents and
> translating them to Python or Ruby.
>
> I really like Python (in particular) as a teaching language, but I
> wouldn't teach cocoa with it.


I completely agree - and I wrote CamelBones, the Cocoa/Perl bridge. It is,
and always has been, my opinion that language bridges are not an adequate
substitute for learning Cocoa's native language, Objective-C. What they are
*great* for is giving additional options to a skilled programmer who's
already familiar with both Cocoa and a scripting language. Someone who tries
to use them as a means to avoid Objective-C is just setting themselves up
for a lot of frustration.

sherm--
___

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 [EMAIL PROTECTED]


Re: Prevent application activation after dragging items to the Dock icon?

2008-03-17 Thread Jens Alfke


On 17 Mar '08, at 10:42 AM, Jean-Daniel Dupas wrote:


Why no?  The documentation says:

«These events are sent whenever the Finder reactivates an already  
running application because someone double-clicked it again or used  
the dock to activate it.»


That means "clicked on its icon in the Dock". I.e the actions that are  
used to launch an app with no documents. It does not apply to opening  
documents, even if the Dock is involved.


—Jens

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 [EMAIL PROTECTED]

Re: strange "lockFocus sent to a view whose window is deferred" error with an NSOutlineView on Tiger

2008-03-17 Thread Martin Redington


I overrode lockFocus, and stuck a breakpoint on it.

#0  0x004f87ea in -[MyOutlineView lockFocus] at MyOutlineView.m:75
#1	0x93310315 in -[NSView  
_recursiveDisplayAllDirtyWithLockFocus:visRect:]

#2  0x9332238f in _recursiveDisplayInRect2
#3  0x9083eac0 in CFArrayApplyFunction
#4	0x93310633 in -[NSView  
_recursiveDisplayAllDirtyWithLockFocus:visRect:]
#5	0x9330f493 in -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisible 
RectForView:topView:]
#6	0x9330e382 in -[NSView  
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:]

#7  0x9330dcae in -[NSView displayIfNeeded]
#8  0x933043ab in -[NSClipView _immediateScrollToPoint:]
#9  0x9343bd92 in -[NSScrollView scrollClipView:toPoint:]
#10 0x932cf34f in -[NSClipView _scrollTo:animate:]
#11 0x932cee3b in -[NSClipView _scrollTo:]
#12 0x932cecc3 in -[NSClipView _reflectDocumentViewFrameChange]
#13 0x932acc75 in -[NSView _postFrameChangeNotification]
#14 0x932cdd75 in -[NSControl setFrameSize:]
#15 0x933a256d in -[NSTableView setFrameSize:]
#16 0x933a0c82 in -[NSTableView tile]
#17 0x933a09d5 in -[NSTableView _tileAndRedisplayAll]
#18 0x932aa113 in -[NSView _setSuperview:]
#19 0x933a3f86 in -[NSTableView _setSuperview:]
#20 0x932a9d51 in -[NSView addSubview:]
#21 0x932c72cf in -[NSClipView setDocumentView:]
#22 0x932c70d0 in -[NSScrollView setDocumentView:]
#23	0x00091f2b in -[MyController(Private) setOutlineView:] at  
MyController.m:3967


When lockFocus is called, the MyOutlineView has its superview set,  
but not its window.


Its possible that window is set lazily, and this is normal, but it  
seems to be non-nil every time it gets past that point without erroring.


The other odd thing is that I don't see lockFocus get called at all  
on -[NSScrollView setDocumentView:] when there's no error, or when my  
other outline view gets set.


Presumably, something in the state of that outline view is kicking  
off the redraw before the view is ready.



On 17 Mar 2008, at 17:45, Martin Redington wrote:



On 17 Mar 2008, at 17:07, Michael Nickerson wrote:



On Mar 17, 2008, at 9:06 AM, Martin Redington wrote:



I'm seeing the following error

2008-03-17 12:42:11.916 MyApp[11155] *** Assertion failure in - 
[MyOutlineView lockFocus], AppKit.subproj/NSView.m:3248
2008-03-17 12:42:11.917 MyApp[11155] lockFocus sent to a view  
whose window is deferred and does not yet have a corresponding  
platform window




You usually run into this error when a view tries to draw to a  
window that hasn't been displayed at all yet.  I don't know if  
this is the case for you, since you're talking about swapping  
views, though - are you actually swapping out windows when you do  
this?


Anyway, you can try to make the window non-deferred (you can  
deselect the checkbox for that in IB) and see if you get the error  
then.  Doing that makes the window make a connection to the window  
server when it's created rather than when it's first displayed.


The window is a single window app. Making the window non-deferred  
makes no difference.




If that doesn't help, is the scroll view you're adding the outline  
view to part of the view hierarchy when you do that?  Maybe there  
was a bug in Tiger where the scroll view tried to display the  
document view immediately when it's set and if it's not actually  
part of a window I suppose this might pop up.  That's all just a  
guess, though.


Yep. The scrollview is the place holder for the views, so that's  
always in place.


I'll try and get a test case together - with a bit of luck I'll  
find a workaround while I'm doing that.


___

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/m.redington% 
40ucl.ac.uk


This email sent to [EMAIL PROTECTED]



___

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 [EMAIL PROTECTED]


Re: In receiver application, getting file passed in from NSWorkspace openFile:withApplication:

2008-03-17 Thread Ryan Chapman
Is there any way to get this information from within a command-line utility?


In my case, I have a command-line utility wrapped up in an application bundle, 
so I 
really don't need any GUI stuff, but I thought I could use the Cocoa classes
to get the filename sent without launching a GUI.


- Original Message 
From: Jens Alfke <[EMAIL PROTECTED]>
To: Ryan Chapman <[EMAIL PROTECTED]>
Cc: cocoa-dev@lists.apple.com
Sent: Monday, March 17, 2008 1:06:09 PM
Subject: Re: In receiver application, getting file passed in from NSWorkspace 
openFile:withApplication:


On 17 Mar '08, at 9:56 AM, Ryan Chapman wrote:

> In MaxPostProcessing.app, how can I determine the file that was the  
> parameter passed to openFile:  ??

In your class that's the NSApplication's delegate, implement the method

- (BOOL)application:(NSApplication *)sender openFile:(NSString  
*)filename;

—Jens




___

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 [EMAIL PROTECTED]


Re: Python/Ruby for Cocoa (was: Simple question)

2008-03-17 Thread Paul Sargent


On 17 Mar 2008, at 17:46, Hamish Allan wrote:


If you're cutting your programming teeth on Cocoa, you might find that
Python or Ruby is gentler.


I'm not sure I agree. Two problems for me.

* Cocoa isn't a seamless fit with either python or ruby, so there are  
little corner cases around that don't feel quite right. Method naming,  
for example, reads correctly in Objective C, but not in Python. In  
fact it can get quite confusing.


* The documentation for Cocoa on Python and Ruby is far less bountiful  
than for Objective C, so you end up reading Objective C documents and  
translating them to Python or Ruby.


I really like Python (in particular) as a teaching language, but I  
wouldn't teach cocoa with it.

___

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 [EMAIL PROTECTED]


Re: Best Way To Lookup From a Huge Table

2008-03-17 Thread James Hober

To me, "best" large table lookup comes down to a tradeoff:

1) If I can load all the data into memory, using say a hash table,  
then the initial load time will be somewhat significant but the  
lookups will be near instantaneous.


2) If I can look up the data from an ordered persistent store, the  
initial load time can be extremely short but the look up times a  
little longer because of disk access, yet still pretty fast if the  
store is organized and searched efficiently.


I had a situation where I had about 170,000 unique strings that  
mapped to 170,000 other strings.


My first implementation used Objective-C++ and a C++ STL map to do  
the lookup (solution 1).   Depending on the machine, it took on the  
order of 2 to 7 seconds of time during the app launch to load the C++  
map.


My current implementation uses a Core Data SQLite data base (solution  
2).  I have a separate Foundation Tool that creates the SQLite store,  
indexes it and vacuums it.  The user app launches very quickly and  
the Core Data lookups are on the order of .01 seconds or less.  Note  
that the data rarely if ever changes so I don't have to worry about  
the store gradually becoming fragmented and less efficient.


There are also other ways to do solution 2) as at least one other  
person mentioned: For example, you can create a custom random access  
file with records of a fixed length and do your own binary search of  
them.


But basically you have to decide whether 1) or 2) is best for your  
situation.


James

On 13 Mar 2008, at 21:11, Karan Lyons wrote:


What's the best way to lookup something from a huge table?
I'm trying to write a piece of code that checks weather data given
a zipcode. But I first need to change that zipcode into another
format in order for it to work with the online service I'm querying.
For example:

1) User inputs zipcode 02139.
2) Application looks up zipcode in table and finds that 02139 is
USMA0007
3) Application uses code USMA0007 to query the online service.

The table itself is pretty simple: It's just two columns, one with
every zipcode in the US, and the other with the corresponding
weather code. But there are 41,805 zipcodes in the US, so I'm not
sure of the best way to implement this. The table only needs to be
queried once, after that I can store the weather code in memory.
What's the best way to do this? Thanks for your help!

Namaste,
Karan___


___

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 [EMAIL PROTECTED]


Apple Events and automatic AutoReleasePool managment

2008-03-17 Thread Andy Klepack
The Memory Management Programming Guide 
(http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Concepts/AutoreleasePools.html#//apple_ref/doc/uid/2047)
 states "The Application Kit automatically creates a pool at the beginning of 
an event cycle (or event-loop iteration), such as a mouse down event, and 
releases it at the end, so your code normally does not have to worry about 
them".

Does an 'event cycle' then include anything dispatched from a run loop source? 
For instance, if I was to create a kqueue, create a run loop source for it, and 
add that to the main run loop, does an AutoReleasePool automatically get 
created before the handler is called and destroyed after it returns? What about 
for invocations that result from DO communication in which the incoming port is 
registered on the main run loop?

I'm also unclear on whether incoming Apple Events are dispatched in the same 
way as other events. Is their entrance represented as yet another run loop 
source or is it a separate mechanism? What does this imply about the existence 
of an AutoReleasePool during the callback? Does it make a difference if the 
handler was registered via AEInstallEventHandler and NSAppleEventManager's 
setEventHandler?

Many thanks,
-Andy

___

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 [EMAIL PROTECTED]


Re: strange "lockFocus sent to a view whose window is deferred" error with an NSOutlineView on Tiger

2008-03-17 Thread Martin Redington


On 17 Mar 2008, at 17:07, Michael Nickerson wrote:



On Mar 17, 2008, at 9:06 AM, Martin Redington wrote:



I'm seeing the following error

2008-03-17 12:42:11.916 MyApp[11155] *** Assertion failure in - 
[MyOutlineView lockFocus], AppKit.subproj/NSView.m:3248
2008-03-17 12:42:11.917 MyApp[11155] lockFocus sent to a view  
whose window is deferred and does not yet have a corresponding  
platform window




You usually run into this error when a view tries to draw to a  
window that hasn't been displayed at all yet.  I don't know if this  
is the case for you, since you're talking about swapping views,  
though - are you actually swapping out windows when you do this?


Anyway, you can try to make the window non-deferred (you can  
deselect the checkbox for that in IB) and see if you get the error  
then.  Doing that makes the window make a connection to the window  
server when it's created rather than when it's first displayed.


The window is a single window app. Making the window non-deferred  
makes no difference.




If that doesn't help, is the scroll view you're adding the outline  
view to part of the view hierarchy when you do that?  Maybe there  
was a bug in Tiger where the scroll view tried to display the  
document view immediately when it's set and if it's not actually  
part of a window I suppose this might pop up.  That's all just a  
guess, though.


Yep. The scrollview is the place holder for the views, so that's  
always in place.


I'll try and get a test case together - with a bit of luck I'll find  
a workaround while I'm doing that.


___

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 [EMAIL PROTECTED]


NSTreeController & NSOutlineView bindings w/ Core Data

2008-03-17 Thread Ian Kennedy
I'm hoping this is simple, but everything I read makes it seem much  
more complicated than I think it should be.


I have this simple model: 
http://img.skitch.com/20080317-8wxj68njnsek652bnwaahm3t5b.png

In IB I instantiated an NSTreeController bound to the application  
delegate with a path of managedObjectContext. I set the entity to  
Course, checked 'Prepares Content' and added a key path for Children  
to 'sections'.


I can add courses, sections, and coursefiles, and the outlineview  
seems to recognize that the Course contains a Section, but it tells me  
that the entity Section is not kvc compliant for the key sections: http://img.skitch.com/20080317-qkmratwtpkfqx47rhqrtey4nqy.png


I've noted in the docs that:
 "All child objects for the tree must be key-value-coding compliant  
for the same child key path. If necessary you should implement  
accessor methods in your model classes, or categories on those  
classes, that map the child key to the appropriate class-specific  
method name."


I have set up NSManagedObject subclasses for each of my model objects.  
However, I am not able to find an example of which accessor methods I  
should add to map the children


Any help would be much appreciated, I've been struggling with this for  
days.


Thanks in advance,
Ian Kennedy
___

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 [EMAIL PROTECTED]


Re: Simple question

2008-03-17 Thread Hamish Allan
On Mon, Mar 17, 2008 at 2:56 PM, Rob Napier <[EMAIL PROTECTED]> wrote:

> While K&R is certainly the gold standard reference, I wouldn't
>  recommend it as the book to learn the language.

I thought K&R was great for learning C, but unlike the OP, I had
programmed in other languages (e.g. assembler!) beforehand.

If you're cutting your programming teeth on Cocoa, you might find that
Python or Ruby is gentler.

Hamish
___

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 [EMAIL PROTECTED]


Re: Prevent application activation after dragging items to the Dock icon?

2008-03-17 Thread Jean-Daniel Dupas


Le 17 mars 08 à 18:01, Jens Alfke a écrit :



On 17 Mar '08, at 9:26 AM, Ryan Poling wrote:


applicationShouldHandleReopen:hasVisibleWindows:


No, that delegate call controls what happens if your app is double- 
clicked when it's already running. Some apps respond to this by  
opening a new untitled document, for consistency in behavior.


Why no?  The documentation says:

«These events are sent whenever the Finder reactivates an already  
running application because someone double-clicked it again or used  
the dock to activate it.»___


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 [EMAIL PROTECTED]


NSPanel mimic menu behavior

2008-03-17 Thread cai qin
Hi All,

I'm using a NSPanel to mimic menu in Tiger these days. I think most of the
job has been done except one small problem.
What I want to do is that implementing something just behaves like a
popUpButton.
OK let's get into the point.
I got a popUpButton, and I override its cell

@implementation MyPopUpButtonCell
 //setting panel frame which makes the panel attach to the popUpButton and
makes the panel on the Screen, then panel orderFrontRegardless
- (void) attachPopUpPanelMenu:(MyMenuPanel *)menuPanel inView:(NSView*)cv;
// panel orderOut
- (void) dismissPanelMenu;

@end


@implementation MyMenuPanel //subclass of NSPanel

- (id)initWithContentRect:(NSRect)contentRect
styleMask:(int)windowStyle backing:(NSBackingStoreType)bufferingType
defer:(BOOL)deferCreation

{

 self = [super initWithContentRect:contentRect

   styleMask:windowStyle

 backing:bufferingType

defer:deferCreation];

 if(self)

 {

  [self setLevel:NSPopUpMenuWindowLevel];

  [self setHasShadow:YES];

  [self setWorksWhenModal:YES];

 }

 return self;

}
/**
* tracking Mouse Event . In my custom loop , to get every event in the
queue. * check the event position , if happened in myMenuPanel dispatch the
event , finish loop , popUpButtonCell dismiss the panel
 * if event happened outside window , finish loop , popUpButtonCell dismiss
the panel
* I don't need the menu highlight staff , so I don't start or handling
the NSPeriodic
event.
 * So everything works good . But if I switch the App to others . My
menuPanel will be hided . because the NSPanel
 * hideOnDeactivate. The problem is , my App ,still is on active . I
think the reason is event tracking loop is still on
 * It hasn't quit. So , I need find something when myPanelMenu be hidden
to stop the loop.
 * Is there any suggestion on this?
*/

- (void) trackingMouseEvent:(NSEvent *) theEvent

{

 unsigned eventMask = NSLeftMouseDownMask|NSLeftMouseUpMask|NSLeftMouseDragged;

 eventMask |= NSRightMouseDraggedMask|NSRightMouseDownMask|NSRightMouseUpMask;

 eventMask |= NSOtherMouseUpMask||NSOtherMouseDraggedMask||NSOtherMouseDownMask;

 eventMask |= NSPeriodicMask;

 NSDate *date = [NSDate distantFuture];

 BOOL keepOn = YES;

 NSEvent *nextEvent;

 while(keepOn)

 {

  nextEvent = [NSApp nextEventMatchingMask:eventMask untilDate:date
inMode:NSEventTrackingRunLoopMode dequeue:YES];

  NSLog(@"%d %d %d %d %d %d %@ %d",

 [self isKeyWindow],

 [self isOpaque],

 [self isVisible],

 [NSApp isHidden],

 [NSApp isActive],

 [self canBecomeKeyWindow],

 [NSApp keyWindow],

 [[NSApp keyWindow] isMainWindow]);



  switch([nextEvent type])

  {

   case NSLeftMouseDown:

   case NSRightMouseDown:

   case NSOtherMouseDown:

//ToDo dispatch to mouseDown method

if(![nextEvent isEqual:theEvent])

{

 NSPoint location = [[self window] mouseLocationOutsideOfEventStream];

 NSPoint viewLocation = [self convertPoint:location fromView:nil];

 if([self mouse:viewLocation inRect:[self bounds]])

 {

  [self mouseDown:theEvent];

 }

 else

  keepOn = NO;

}



break;

   case NSLeftMouseUp:

   case NSRightMouseUp:

   case NSOtherMouseUp:

//ToDo dispatch to mouseUp method

if([nextEvent timestamp] - [theEvent timestamp] > 0.25)

{

 NSPoint location = [[self window] mouseLocationOutsideOfEventStream];

 NSPoint viewLocation = [self convertPoint:location fromView:nil];

 if([self mouse:viewLocation inRect:[self bounds]])

 {

  [self mouseUp:theEvent];

 }

 keepOn = NO;

}

break;

   case NSLeftMouseDragged:

   case NSRightMouseDragged:

   case NSOtherMouseDragged:

[self mouseDragged:theEvent];

break;

   default:

break;

  }





 }

}
@end
___

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 [EMAIL PROTECTED]


Re: In receiver application, getting file passed in from NSWorkspace openFile:withApplication:

2008-03-17 Thread Jens Alfke


On 17 Mar '08, at 10:06 AM, Robert Tillyard wrote:

If you're looking fot the equivalent of argc/argv you might be  
looking for...


NSProcessInfo *procInfo = [NSProcessInfo processInfo];
NSArray *args = [procInfo arguments];


But documents to be opened are never passed through argv; they're sent  
as AppleEvents and passed to the NSApplication's delegate.

There's almost never a need to access argv from a GUI app.

—Jens

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 [EMAIL PROTECTED]

Re: Distributed Objects NSPortTimeoutException

2008-03-17 Thread Tony Parker

Hello,

If you just cut & paste the code from 'main' in the chatterd server, I  
would double-check that your connection and root object are being  
retained properly in your AppController. For example, make sure  
'monitor', 'connection', 'chatterServer', and 'receivePort' are not  
autoreleased at the end of the method connected to your button. I  
tried creating a simple app based on your explanation below (on  
Leopard) and was able to get a connection successfully.


Thanks,

- Tony Parker
Cocoa Frameworks
Apple, Inc.

On Mar 16, 2008, at 10:38 PM, Mac QA wrote:


Hi,

I've been working on a project using Distributed Objects, and been
having an issue that I haven't been able to debug all week. I started
with the example code from Chapter 18 & 19 of the Advanced Mac OS X
Programming book -- its the chat server (chatterd) and chat client
(ChatterClient) programs.

http://borkware.com/corebook/second-edition-files/18-distributed-objects.tar.gz
http://borkware.com/corebook/second-edition-files/19-bonjour.tar.gz

The problem I have in my program based off this example is that when
my client tries to get the rootProxy for the connection to the server
a NSPortTimeoutException is raised with the reason "[NSPortCoder
sendBeforeTime:sendReplyPort:] timed out." I've spent the entire week
stripping out the complexities of my program and figuring out which
modification from the sample code introduces this problem. Well, I've
finally discovered what modification causes the problem, but I still
don't know why.

In the sample code the NSconnection is created inside of the main. In
my program I have a a GUI & AppController, with a button that when
pressed sends an action to a method that does the same stuff from main
in the sample code to set-up the connection. With just this
modification the sample code breaks in the same way my code breaks.

So, for those following along from the code at the URLs above, in the
chatterd project, the following

int main (int argc, const char * argv[])
{
   NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSRunLoop *runloop = [NSRunLoop currentRunLoop];
ConnectionMonitor *monitor = [[ConnectionMonitor alloc] init];
ChatterServer *chatterServer = [[ChatterServer alloc] init];
// etc..

is changed to:

int main (int argc, const char * argv[])
{
   return NSApplicationMain(argc,  (const char **) argv);
}

And an AppController is added, along with a MainMenu.nib. The nib has
a button whose action is connected to a method on the AppController.
And the contents of main from line 12 through 48 is put in that
method. Specifically, that is:

ConnectionMonitor *monitor = [[ConnectionMonitor alloc] init];
// through
[[NSNotificationCenter defaultCenter]
addObserver:monitor
   selector:@selector(connectionDidDie:)
   name:NSConnectionDidDieNotification
 object:nil];

The result ends up being that the client can no longer connect to the
server. It gets the aforementioned exception raised, yet I can't find
any reason why. Can anyone provide any suggestions?



___

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 [EMAIL PROTECTED]


Re: strange "lockFocus sent to a view whose window is deferred" error with an NSOutlineView on Tiger

2008-03-17 Thread Michael Nickerson


On Mar 17, 2008, at 9:06 AM, Martin Redington wrote:



I'm seeing the following error

2008-03-17 12:42:11.916 MyApp[11155] *** Assertion failure in - 
[MyOutlineView lockFocus], AppKit.subproj/NSView.m:3248
2008-03-17 12:42:11.917 MyApp[11155] lockFocus sent to a view whose  
window is deferred and does not yet have a corresponding platform  
window




You usually run into this error when a view tries to draw to a window  
that hasn't been displayed at all yet.  I don't know if this is the  
case for you, since you're talking about swapping views, though - are  
you actually swapping out windows when you do this?


Anyway, you can try to make the window non-deferred (you can deselect  
the checkbox for that in IB) and see if you get the error then.  Doing  
that makes the window make a connection to the window server when it's  
created rather than when it's first displayed.


If that doesn't help, is the scroll view you're adding the outline  
view to part of the view hierarchy when you do that?  Maybe there was  
a bug in Tiger where the scroll view tried to display the document  
view immediately when it's set and if it's not actually part of a  
window I suppose this might pop up.  That's all just a guess, though.


--
Darkshadow
(aka Michael Nickerson)
http://www.nightproductions.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 [EMAIL PROTECTED]


Re: In receiver application, getting file passed in from NSWorkspace openFile:withApplication:

2008-03-17 Thread Robert Tillyard
If you're looking fot the equivalent of argc/argv you might be looking  
for...


NSProcessInfo *procInfo = [NSProcessInfo processInfo];
NSArray *args = [procInfo arguments];


Regards, Rob.

On 17 Mar 2008, at 16:56, Ryan Chapman wrote:


Hi all,


I have an application that uses NSWorkspace  
openFile:withApplication: to launch another application:



[[NSWorkspace sharedWorkspace] openFile:@"/tmp/test.mp3"
withApplication:@"/Applications/ 
MaxPostProcessing.app"]



In MaxPostProcessing.app, how can I determine the file that was the  
parameter passed to openFile:  ??



I've tried using the arguments (argv) passed into main(), but only  
see "-psn_0_188462" as argv[1].
I also tried NSNotificationCenter, but am not seeing any output from  
my observer method obsMethod:(id)aNotification



Can someone point me in the right direction?


Thanks alot!


-Ryan


___

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 [EMAIL PROTECTED]


Re: In receiver application, getting file passed in from NSWorkspace openFile:withApplication:

2008-03-17 Thread Jens Alfke


On 17 Mar '08, at 9:56 AM, Ryan Chapman wrote:

In MaxPostProcessing.app, how can I determine the file that was the  
parameter passed to openFile:  ??


In your class that's the NSApplication's delegate, implement the method

- (BOOL)application:(NSApplication *)sender openFile:(NSString  
*)filename;


—Jens

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 [EMAIL PROTECTED]

Re: Simple question

2008-03-17 Thread Gregory Weston

Rob Napier wrote:

After that one, I recommend Aaron Hillegass's "Cocoa Programming  
for Mac OS X" which was
recently discussed on this list. It assumes a background in C or  
Objective-C, but is the

best book for learning Cocoa.


Seconded, with the caveat that the 3rd edition is apparently expected  
in roughly 2 months.

___

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 [EMAIL PROTECTED]


Re: Sorting arrays with strings

2008-03-17 Thread I. Savant
>  True, but obsolete.  These days (read: 10.3 and later) you can use the
>  "NSNumericSearch" option, as Malcom suggests.

  I saw that - I hadn't looked at that part of the documentation in
awhile (obviously). I've been thinking that I should take a few weeks
to skim all the documents I haven't read lately (but that I've assumed
full familiarity) and see what's changed since I've "mastered" them.
Searching strings, for example. :-)

  Now if only I could find a few weeks in which to do so. :-D

--
I.S.
___

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 [EMAIL PROTECTED]


Re: Prevent application activation after dragging items to the Dock icon?

2008-03-17 Thread Jens Alfke


On 17 Mar '08, at 9:26 AM, Ryan Poling wrote:


applicationShouldHandleReopen:hasVisibleWindows:


No, that delegate call controls what happens if your app is double- 
clicked when it's already running. Some apps respond to this by  
opening a new untitled document, for consistency in behavior.


—Jens

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 [EMAIL PROTECTED]

Re: Modifying glyph storage in NSLayoutManager

2008-03-17 Thread Douglas Davidson


On Mar 17, 2008, at 9:31 AM, Ross Carter wrote:



What is the correct approach to take when you need NSLayoutManager  
to make on-the-fly adjustments to the glyphs


Usually the glyph generator is used for default glyph generation, and  
the typesetter is used to make adjustments to the glyphs that may  
depend on layout--since it is the typesetter that is actually doing  
the layout.


However, that's not your problem here, since it looks like you haven't  
yet gotten to the generation of the dynamic text; you're just using a  
static array of newGlyphs.  The problem is that you need to inform the  
layout manager of the character index <-> glyph index mapping.  When  
you use the bulk insertion method  
insertGlyphs:length:forStartingGlyphAtIndex:characterIndex:, you get  
the default behavior of a one-to-one character->glyph mapping for  
those glyphs.  If the mapping you want isn't one-to-one, that won't be  
correct.


What you don't say is what the number of characters is that you want  
to have mapped to these three glyphs.  You're using the effective  
range of an attribute, which is a somewhat dangerous practice--the  
effective range in general is only guaranteed to be some range over  
which the attribute applies, which may or may not be what you want.   
What happens if you have two distinct occurrences of this attribute,  
say two occurrences of your page number marker, that happen to lie  
adjacent to each other?


A simple case would be if the range of characters you're mapping  
happens to be of length 1.  In that case, I believe you should just be  
able to insert the glyphs one by one, specifying in each case the  
correct glyph index and the same character index, and that should take  
care of the mapping.  If the character range is not 1, there are a  
number of cases and it gets more complicated.


For some general information on the mapping, take a look at the AppKit  
release notes for Leopard.  I included some discussion there of the  
constraints on the mapping between characters and glyphs.  Probably we  
should have more discussion in the documentation of exactly how one  
goes about setting this mapping from within the glyph generator or  
typesetter.


Douglas Davidson

___

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 [EMAIL PROTECTED]


Re: Sorting arrays with strings

2008-03-17 Thread Christopher Nebel

On Mar 15, 2008, at 6:34 AM, I. Savant wrote:

is there a way to make an array with objects such as text-12. txt,  
text-3.txt, text6.txt, text654.txt be sorted like text-3.txt,  
text-12.txt, text6.txt, text654.txt

If you understand what I mean.


http://developer.apple.com/qa/qa2004/qa1159.html


True, but obsolete.  These days (read: 10.3 and later) you can use the  
"NSNumericSearch" option, as Malcom suggests.



--Chris Nebel
AppleScript Engineering

___

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 [EMAIL PROTECTED]


In receiver application, getting file passed in from NSWorkspace openFile:withApplication:

2008-03-17 Thread Ryan Chapman
Hi all,


I have an application that uses NSWorkspace openFile:withApplication: to launch 
another application:


 [[NSWorkspace sharedWorkspace] openFile:@"/tmp/test.mp3" 
 
withApplication:@"/Applications/MaxPostProcessing.app"] 


In MaxPostProcessing.app, how can I determine the file that was the parameter 
passed to openFile:  ??


I've tried using the arguments (argv) passed into main(), but only see 
"-psn_0_188462" as argv[1].
I also tried NSNotificationCenter, but am not seeing any output from my 
observer method obsMethod:(id)aNotification


Can someone point me in the right direction?


Thanks alot!


-Ryan








int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];


Notifier *notifier = [[Notifier alloc] init];
closelog();


[pool drain];
return 0;
}




@implementation Notifier


- (void)init {
[super init];
NSNotificationCenter *notificationCtr;
notificationCtr = [[NSWorkspace sharedWorkspace] notificationCenter];
// Register for all notifications
[notificationCtr addObserver:self selector:@selector(obsMethod:) 
name:nil object:nil];
syslog(LOG_WARNING, "Notifier.m: added observer");
}


- (void)obsMethod:(id)aNotification {
syslog(LOG_WARNING, "Notification name=%s", [[aNotification name] 
cStringUsingEncoding:NSASCIIStringEncoding]);


}
 
- (void)dealloc {
NSNotificationCenter *notificationCtr;
notificationCtr = [[NSWorkspace sharedWorkspace] notificationCenter];
[notificationCtr removeObserver:self];
[super dealloc];
}
@end





___

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 [EMAIL PROTECTED]


Modifying glyph storage in NSLayoutManager

2008-03-17 Thread Ross Carter
I have some text items whose glyphs cannot be determined until layout.  
The text string might contain a marker to draw the current page  
number, or to sequentially number paragraphs, etc. The glyphs can be  
determined only by the layout manager; different layout managers for  
the same text storage might display different page numbers, for example.


Because the text storage cannot know the values to display, there is  
not necessarily a one-to-one mapping between the marker character and  
the glyphs; e.g. a page number marker might be one character and the  
page number might be “10.”


I would like to educate NSLayoutManager to assign the correct set of  
glyphs to the marker character. I expect that the best way to do this  
is by subclassing NSGlyphGenerator. Here’s one of several things I’ve  
tried:


- (void)generateGlyphsForGlyphStorage:(id < NSGlyphStorage  
>)glyphStorage

desiredNumberOfCharacters:(NSUInteger)nChars
   glyphIndex:(NSUInteger 
*)glyphIndex
   characterIndex:(NSUInteger 
*)charIndex {

NSAttributedString *attrStr = [glyphStorage attributedString];
	// Loop through attrStr looking for character with dynamicText  
attribute:

NSRange charRange = NSMakeRange(*charIndex, nChars);
NSRange effRange = NSMakeRange(charRange.location, 0);
while (NSMaxRange(effRange) < NSMaxRange(charRange)) {
NSUInteger currentCharIndex = NSMaxRange(effRange);
		NSNumber *dynamicText = [attrStr attribute:kDynamicTextAttributeName  
atIndex:currentCharIndex effectiveRange:&effRange];

if (dynamicText == nil) {
// Invoke default behavior for the range:
			[[NSGlyphGenerator sharedGlyphGenerator]  
generateGlyphsForGlyphStorage:self  
desiredNumberOfCharacters:effRange.length glyphIndex:glyphIndex  
characterIndex:charIndex];

} else {
// Insert glyphs in place of the default glyph for the 
character.
// For testing, use 3 arbitrary glyphs:
NSUInteger newGlyphsLength = 3;
NSUInteger newGlyphs[newGlyphsLength] = {70, 71, 72};
NSUInteger newGlyphIndex = *glyphIndex;
NSUInteger newCharIndex = *charIndex;   
			[glyphStorage insertGlyphs:newGlyphs length:newGlyphsLength  
forStartingGlyphAtIndex:newGlyphIndex characterIndex:newCharIndex];
			// If we invoke default behavior again, it will need these values  
for glyphIndex and charIndex (this seems to cause the errors):

*glyphIndex = newGlyphIndex + newGlyphsLength + 
effRange.length;
*charIndex = newCharIndex + effRange.length;
}   
}
}

That produces a variety of errors and warnings, including “!!!  
_NSGlyphTreeInsertGlyphs glyph index issue 1,” “!!!  
_NSGlyphTreeInsertGlyphs glyph index issue 2,” “!!!  
_NSGlyphTreeSetIntAttributeForGlyphAtIndex missing glyphs,” “!!!  
_NSGlyphTreeInsertGlyphs invalid char index,” and others.


What is the correct approach to take when you need NSLayoutManager to  
make on-the-fly adjustments to the glyphs it returns for particular  
characters?___


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 [EMAIL PROTECTED]


Re: Best Way To Lookup From a Huge Table

2008-03-17 Thread Thomas Davie
I don't think this is a huge table, and hence you're probably best  
going (as others have suggested) with a hash table of some sort.  Your  
other alternative if it gets up to a larger size would be a decary  
tree.  Use each digit from the number you're looking up to index the  
tree.  Then you have a nice O(log(n)) solution, which may or may not  
be better than the amortized constant of the hash table (depending on  
the input, and the quality of your hash function).


Bob

On 13 Mar 2008, at 21:11, Karan Lyons wrote:


What's the best way to lookup something from a huge table?
	I'm trying to write a piece of code that checks weather data given  
a zipcode. But I first need to change that zipcode into another  
format in order for it to work with the online service I'm querying.  
For example:


1) User inputs zipcode 02139.
	2) Application looks up zipcode in table and finds that 02139 is  
USMA0007

3) Application uses code USMA0007 to query the online service.

	The table itself is pretty simple: It's just two columns, one with  
every zipcode in the US, and the other with the corresponding  
weather code. But there are 41,805 zipcodes in the US, so I'm not  
sure of the best way to implement this. The table only needs to be  
queried once, after that I can store the weather code in memory.

What's the best way to do this? Thanks for your help!

Namaste,
Karan___

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/tom.davie%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: Convert NSString to FSRef

2008-03-17 Thread Sean McBride
On 3/15/08 3:04 PM, Kevin Dixon said:

>I'm trying to write a method that will convert a NSString containing a
>file system URL to an FSRef
>
> *SNIP*
>
>Also, is there a better way to accomplish this?

Yes, use the NDAlias classes which provide all sort of useful code to
convert to and from: url, fsref, fsspec, path, alias, etc.  It is GC and
64 bit aware too.



--

Sean McBride, B. Eng [EMAIL PROTECTED]
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 [EMAIL PROTECTED]


Re: Prevent application activation after dragging items to the Dock icon?

2008-03-17 Thread Ryan Poling
There should be a delegate method you can implement to prevent this  
from happening.  Perhaps the following one, although it doesn't look  
quite right to me.


applicationShouldHandleReopen:hasVisibleWindows:

-Ryan




On Mar 17, 2008, at 12:36 AM, Peter Maurer wrote:

Cocoa applications tend to come to the foreground automatically  
whenever I drag files to their Dock icon. Sometimes, however, I'd  
prefer my application to stay in the background and just start  
working on the file, while giving feedback through the Dock icon.


But this isn't supposed to be a background-only process -- ideally,  
activation behavior would depend on the type of the file(s) I just  
dragged to the Dock.


(You might think such behavior would confuse users. But I do think  
it would be useful in situations where users drag lots of items to  
the application's Dock icon, because they want them to be dealt with  
sequentially. And this kind of non-standard behavior would certainly  
only be an option.)


So is anyone aware of a way to prevent an application from  
activating in these situations -- similar to sending  
preventWindowOrdering to keep windows in the background after mouse  
clicks?


Thanks!

Peter.

___

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 [EMAIL PROTECTED]


Re: CA: How to wait for an animation to finish?

2008-03-17 Thread Jens Alfke


On 16 Mar '08, at 12:07 PM, John Harper wrote:

Implicit animations are useful in many scenarios, but due to the  
simplicity of the API they don't cover everything. If there are  
things you'd like to see them extended to support please file bugs.


Thanks for your detailed answers, John.

The main problem I run into with implicit animations is that I can't  
make atomic changes to the layer hierarchy and positions.  
Specifically, in GeekGameBoard I often need to change a layer's  
superlayer without altering its onscreen position. (On a mouse-down on  
a game piece, it needs to be removed from the square that contains it  
and added to the root layer so it can be dragged all around the  
board.) The basic calls to do this* are:

[piece removeFromSuperlayer];
piece.position = newPositionRelativeToRootLayer;
[rootLayer addSublayer: piece];
Unfortunately this has the visual effect of making the piece shoot  
offscreen and then back, because the position change and the  
superlayer change don't happen simultaneously.
The way around that is to wrap a CATransaction around the whole thing  
and disable animations in it.
But if there's any animation involving that layer already in progress,  
the supposedly-non-animated layer/position change seem to screw it up,  
and the layer ends up jumping to the wrong place.


So what I need is a way to say "block until all animations have  
finished" at the start of my ChangeSuperlayer function. Or "queue  
these changes after all current animations finish". That's what I  
hoped +[CATransaction flush] would do, but doesn't.


—Jens

* http://mooseyard.com/hg/hgwebdir.cgi/GeekGameBoard/file/af9b2b929b03/Source/QuartzUtils.m 
 (see ChangeSuperlayer( ) function.)




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 [EMAIL PROTECTED]

Re: ScriptingBridgeConcepts problem

2008-03-17 Thread Christopher Nebel

On Mar 15, 2008, at 2:53 AM, Cocoa wrote:

I am reading the Scripting Bridge Concepts.pdf, when I doing this in  
the terminal i got a error


>sdef /Applications/Mail.app | sdp -fh --basename Mail ( what I type  
in the Terminal)


>sdp: unknown type name "OLD message editor".   (computer responses)

Do I need to translate the information of Mail.app to sdef format,  
and how do I do it?


That's merely a warning, and, as you might guess from the name,  
pertains to an old term that's present for compatibility with old  
scripts.  If you look, you should find the appropriate header file has  
been created.



--Chris Nebel
AppleScript Engineering

___

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 [EMAIL PROTECTED]


Re: NSButtonCell doesn't visually update during trackMouse:inRect:ofView:untilMouseUp:

2008-03-17 Thread glenn andreas


On Mar 17, 2008, at 1:42 AM, Ben Lachman wrote:

I have a few NSButtonCells that I'm using in a custom view.  I need  
them to track the mouse during clicks and do this by calling  
NSCell's trackMouse:inRect:ofView:untilMouseUp:.  This works fine  
except that the button cells never update their graphical state by  
highlighting or whatever.  However if I call performClick: on them  
the button updates as it should.  Is the only solution to this to  
implement mouse tracking at the view instead of at the cell level?



You need to set the control view of the cell to your view and then  
implement the appropriate [update|draw]cell[inside]: methods in your  
view.  Basically a cell expects to be inside a control and needs to be  
able to tell that control to draw itself (and thus redraw the cell).   
One would think that the parameters to trackMouse would be sufficient  
to have the cell handle this by itself, but since a control could have  
a background behind the cell, it's really up to the control to decide  
how to redraw the cell.



Glenn Andreas  [EMAIL PROTECTED]
  wicked fun!
quadrium | prime : build, mutate, evolve, animate : the next  
generation of fractal art




___

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 [EMAIL PROTECTED]


Re: Convert NSString to FSRef

2008-03-17 Thread Kevin Dixon
Thanks for all the feed back, its been most helpful.

-Kevin

>
> On Mar 15, 2008, at 12:04 PM, Kevin Dixon wrote:
>
>> I'm trying to write a method that will convert a NSString containing a
>> file system URL to an FSRef with the following code
>>
>> - (FSRef)stringToFSRef: (NSString*)filePath {
>>  FSRef output;
>>
>>  CFStringRef cfFilePath = CFStringCreateWithCString(NULL, [filePath
>> cString], (CFStringEncoding)8);
>
> -cString has been deprecated for a very long time; it's better to use
> UTF8String.  In this case, however, you can cast (NSString *) to
> CFStringRef.  Check the docs on toll-free bridging.
>
>>  CFURLRef url = CFCreateURLWithString(NULL, cfFilePath, NULL);
>>
>>  CFURLGetFSRef(url, &output);
>>
>>  return output;
>> }
>>
>> I am getting a warning on the CFCreateURLWithString, saying
>> "initialization makes pointer from integer without a cast"
>
> There's no such function.  You probably meant CFURLCreate... instead.
> For an easier solution, try this:
>
> NSURL *aURL = [NSURL fileURLWithPath:filePath];
> CFURLGetFSRef((CFURLRef)aURL, &output);
>
> which also fixes your CFString and CFURL leaks.
>
> Another problem is that you have no way of returning an error in case
> CFURLGetFSRef fails, so you might want to either return the FSRef by
> reference and return a BOOL or pass in a BOOL * to return a failure
> value by reference.
>
> hth,
> Adam
>

___

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 [EMAIL PROTECTED]


Re: Simple question

2008-03-17 Thread Rob Napier
While K&R is certainly the gold standard reference, I wouldn't
recommend it as the book to learn the language. Kochan's "Programming
in Objective-C" as noted by Rob Keniger is a much better introduction
to what you'll need for programming on a Mac. After that one, I
recommend Aaron Hillegass's "Cocoa Programming for Mac OS X" which was
recently discussed on this list. It assumes a background in C or
Objective-C, but is the best book for learning Cocoa.

-Rob

On Mon, Mar 17, 2008 at 9:57 AM, Kyle Sluder
<[EMAIL PROTECTED]> wrote:
> On Mon, Mar 17, 2008 at 9:33 AM, Scott Thompson <[EMAIL PROTECTED]> wrote:
>  >  I would recommend that you find a nice book on C.  I would recommend
>  >  one, but it's been a while since I've surveyed the literature.
>
>  Get "The C Programming Language" by Kernighan and Ritchie.  It is the
>  gold standard of language references.  If you're gonna go used, make
>  sure to get a white one (ANSI C), not a gray one ("classic", or "K&R"
>  C, which is obsolete).
>
>  --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/robnapier%40gmail.com
>
>  This email sent to [EMAIL PROTECTED]
>



-- 
"Those who would give up essential liberty to purchase a little
temporary safety, deserve neither liberty nor safety." -- B. Franklin,
Printer
___

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 [EMAIL PROTECTED]


Re: Simple question

2008-03-17 Thread Kyle Sluder
On Mon, Mar 17, 2008 at 9:33 AM, Scott Thompson <[EMAIL PROTECTED]> wrote:
>  I would recommend that you find a nice book on C.  I would recommend
>  one, but it's been a while since I've surveyed the literature.

Get "The C Programming Language" by Kernighan and Ritchie.  It is the
gold standard of language references.  If you're gonna go used, make
sure to get a white one (ANSI C), not a gray one ("classic", or "K&R"
C, which is obsolete).

--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 [EMAIL PROTECTED]


Re: Simple question

2008-03-17 Thread Rob Keniger


On 17/03/2008, at 11:33 PM, Scott Thompson wrote:

I would recommend that you find a nice book on C.  I would recommend  
one, but it's been a while since I've surveyed the literature.


I highly recommend "Programming in Objective-C" by Stephen Kochan. IMO  
it is by far the best introduction to Objective-C out there,  
especially for those who have never used C before.


--
Rob Keniger



___

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 [EMAIL PROTECTED]


Re: Simple question

2008-03-17 Thread Scott Thompson


On Mar 17, 2008, at 7:53 AM, Luca Ciciriello wrote:



Yes, you got it. .h stands for "header" and is the place where you  
make your declarations, .m stands for "module" and is where the  
definitions take place.


You can encounter also .mm exetension. In these file you can mix  
Objective-C an C++ language.


I would recommend that you find a nice book on C.  I would recommend  
one, but it's been a while since I've surveyed the literature.


The C derived languages (with those most relevant to Macintosh  
programming being, C, C++, Objective-C, and Objective-C++) tend to  
separate your code into two parts.  The first is the active part of  
your program, that part which "does things".  This code is placed into  
a file whose extension depends on the language you are using.  As Luca  
points out ".c" is for C source code.  ".m" is for Objective-C source  
code.  C++ source is usually found in a file ending either in ".cp" or  
".cpp".  And Objective-C++ code uses ".mm".


The header, or ".h" file doesn't typically contain active code.   
Instead, it usually contains some kind of description of the code that  
is found in the corresponding source code file.  The description lets  
other part of your program know what functionality can be found in the  
source code file.


To sum up, the source code file defines what your program can do, and  
how it can do it.  The header file declares what's available and you  
you invoke it.


Scott

___

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 [EMAIL PROTECTED]


strange "lockFocus sent to a view whose window is deferred" error with an NSOutlineView on Tiger

2008-03-17 Thread Martin Redington


I'm seeing the following error

2008-03-17 12:42:11.916 MyApp[11155] *** Assertion failure in - 
[MyOutlineView lockFocus], AppKit.subproj/NSView.m:3248
2008-03-17 12:42:11.917 MyApp[11155] lockFocus sent to a view whose  
window is deferred and does not yet have a corresponding platform window


when calling

[myScrollView setDocumentView:theOutlineView];

It's not quite that straightforward of course.

My app has four different view types (tree, browser, graphical,  
duplicates) for each volume (disk), which the user can swap between.


These views are created lazily, and swapped in and out when the user  
swaps view types, or selects a different volume using


[myScrollView setDocumentView:theOutlineView];

The views are stored in a dictionary when not in use.

When a user rescans the disk, the old data, that is displayed in the  
views in various formats, is thrown away.


I'm seeing the above problem with the duplicates view, which is an  
NSOutlineView, when I


1) swap to the duplicates outline view.
2) scan the disk (creating the data).
3) swap to a different view.
4) rescan the disk (resetting the data).
5) swap back to the duplicates view.

When the data is reset, the views data source is not changed. Rather,  
the object that the datasource grabs its data from is reset, and  
[myOutlineView reloadData] is called immediately.


At the point the error occurs, there is no actual data in the  
duplicates outline (as it generates its own dupes data, and it throws  
the exception before getting to that point second time around).


Steps 1 and 2 can be swapped with no effect on the outcome.

I don't get any problem if the duplicates NSOutlineView is visible  
when the data is reset and repopulated (i.e. if I skip step 3) -  
everything works fine.


To sum up, reloading the data while the view is offscreen seem to be  
the somehow connected to this.


I can reproduce this 100% of the time, but haven't had a chance to  
distil a redistributable test case yet. I don't get the problem at  
all on Leopard.


I'm pretty sure I'll pin it down eventually, but if anyone has seen  
anything like this, or has a workaround, that would be great. From  
the Leopard fix, I'm guessing that it was a known issue in Tiger.
















___

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 [EMAIL PROTECTED]


Return the value to a pop up window

2008-03-17 Thread Cocoa
I am trying to sodosomething more than the tutorial - Objective-C  
tutorial.pdf


It's a Currency Converter application

the part of the code is below:

float amount;
converter = [[Converter alloc]init];
[converter setSourceCurrencyAmount:[dollarField floatValue]];
[converter setRate:[rateField floatValue]];
amount= [converter convertCurrency];

[amountField setFloatValue:amount];
[rateField selectText:self];


amountField is a NSTextField, amount is a (float) returning answer.

Can I declare a NSWindow in IB and build a connection from it to the  
action?



___

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 [EMAIL PROTECTED]


RE: Simple question

2008-03-17 Thread Luca Ciciriello

Yes, you got it. .h stands for "header" and is the place where you make your 
declarations, .m stands for "module" and is where the definitions take place. 
You can encounter also .mm exetension. In these file you can mix Objective-C an 
C++ language.

Luca.

> From: [EMAIL PROTECTED]
> To: Cocoa-dev@lists.apple.com
> Date: Tue, 18 Mar 2008 00:45:17 +1300
> CC: 
> Subject: Simple question
> 
> I have studying Cocoa - objective-C by myself for a few days ( im  
> entirely new to programming). There's a question I wanna know about.
> 
> When you create a project in XCode, and add a new class, does anyone  
> know what .h file and .m respectively for?
> 
> I mean if they have their own jobs in the coding, I wanna know like .h  
> for declare the varibles and .m for implementing?
> 
> 
> 
> ___
> 
> 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/luca_ciciriello%40hotmail.com
> 
> This email sent to [EMAIL PROTECTED]

_
Free games, great prizes - get gaming at Gamesbox. 
http://www.searchgamesbox.com___

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 [EMAIL PROTECTED]


Re: Distributed Objects NSPortTimeoutException

2008-03-17 Thread Mac QA
On Mon, Mar 17, 2008 at 8:15 AM, John Pannell
<[EMAIL PROTECTED]> wrote:
>  I was on Leopard and using garbage collection.

Unfortunately this problem is occurring on Tiger.
___

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 [EMAIL PROTECTED]


Re: Distributed Objects NSPortTimeoutException

2008-03-17 Thread John Pannell

Hi there-

This may or may not apply to your situation, but I had an incident a  
few weeks ago in which I could not get DO to work with communication  
between machines using NSSocketPorts.  I was on Leopard and using  
garbage collection.  When I posted to the list, I received a response  
from an authoritative source that Leopard has a known issue with  
garbage collection and DO over sockets, and that there is presently no  
workaround, aside from moving back to managing your own memory.


Hope this helps!

John

On Mar 16, 2008, at 11:38 PM, Mac QA wrote:


Hi,

I've been working on a project using Distributed Objects, and been
having an issue that I haven't been able to debug all week. I started
with the example code from Chapter 18 & 19 of the Advanced Mac OS X
Programming book -- its the chat server (chatterd) and chat client
(ChatterClient) programs.

http://borkware.com/corebook/second-edition-files/18-distributed-objects.tar.gz
http://borkware.com/corebook/second-edition-files/19-bonjour.tar.gz

The problem I have in my program based off this example is that when
my client tries to get the rootProxy for the connection to the server
a NSPortTimeoutException is raised with the reason "[NSPortCoder
sendBeforeTime:sendReplyPort:] timed out." I've spent the entire week
stripping out the complexities of my program and figuring out which
modification from the sample code introduces this problem. Well, I've
finally discovered what modification causes the problem, but I still
don't know why.

In the sample code the NSconnection is created inside of the main. In
my program I have a a GUI & AppController, with a button that when
pressed sends an action to a method that does the same stuff from main
in the sample code to set-up the connection. With just this
modification the sample code breaks in the same way my code breaks.

So, for those following along from the code at the URLs above, in the
chatterd project, the following

int main (int argc, const char * argv[])
{
   NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSRunLoop *runloop = [NSRunLoop currentRunLoop];
ConnectionMonitor *monitor = [[ConnectionMonitor alloc] init];
ChatterServer *chatterServer = [[ChatterServer alloc] init];
// etc..

is changed to:

int main (int argc, const char * argv[])
{
   return NSApplicationMain(argc,  (const char **) argv);
}

And an AppController is added, along with a MainMenu.nib. The nib has
a button whose action is connected to a method on the AppController.
And the contents of main from line 12 through 48 is put in that
method. Specifically, that is:

ConnectionMonitor *monitor = [[ConnectionMonitor alloc] init];
// through
[[NSNotificationCenter defaultCenter]
addObserver:monitor
   selector:@selector(connectionDidDie:)
   name:NSConnectionDidDieNotification
 object:nil];

The result ends up being that the client can no longer connect to the
server. It gets the aforementioned exception raised, yet I can't find
any reason why. Can anyone provide any suggestions?
___

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/john%40positivespinmedia.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Bitmap fonts in Cocoa apps, line-height bug

2008-03-17 Thread Tobia Conforto

Hello

I would like to know what are the best practices and recommended  
programs for preparing bitmap fonts for use in Cocoa applications.   
I'm also reporting what is probably a bug in either OS X or the  
available font editors.


If there is a list better suited to this question, please point me to  
it.



I'm trying to convert the well known X11 fixed unicode fonts to a  
format usable in Cocoa text editors and terminal programs.  These  
fonts are available under a free license on Markus Kuhn's website: http://www.cl.cam.ac.uk/~mgk25/ucs-fonts.html 
 and are provided in source BDF format.


I tried using the free editor Fontforge to convert 9x18.bdf into a so- 
called (by Fontforge) "Apple bitmap-only .dfont" format.  Mostly it  
works, but I've run into a problem that Fontforge's programmers can't  
solve.  See this thread on their list:

http://www.nabble.com/BDF-to-Apple-bitmap-only-dfont,-wrong-line-height-td15155775.html

The problem is that the generated dfont is rendered by OS X with 4px  
of additional ascent (or line-height) and we can't figure out where it  
comes from.  If I convert only the ASCII subset of the original  
Unicode font, the line-height is correct.  As soon as I add more than  
a couple of non-ASCII characters, the 4px bug comes out.


I tried doing the same conversion using a trial version of the  
commercial BitFonter 3.0 editor ($500) and I got the same results as  
with Fontforge.


I looked into the .dfont file with a hex editor, using this manual as  
a reference http://developer.apple.com/textfonts/TTRefMan/ but I  
couldn't find anything out of place.


Here is a zip http://gruppo4.com/~tobia/osx-font-problem.zip where  
I've put two OS X dfont files I created from 9x18.bdf, using  
Fontforge, plus a text file with the font tables I extracted using the  
hex editor.
In "test3" I converted the full Latin 1 charset (Unicode points < 256)  
and it shows the 4px bug; in "test7" I deleted all glyphs other than  
ASCII and a couple of Latin 1 accented letters, and it displays  
correctly in all Cocoa apps.


What am I doing wrong?  What's different in the two files?  Can you  
replicate this bug?  Is this a bug in OS X, a weird setting in the  
original BDF, or a bug shared between Fontforge and BitFonter?


Can you think of any workaround or alternative program I could try?

Any input will be appreciated


Tobia
___

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 [EMAIL PROTECTED]


Simple question

2008-03-17 Thread Cocoa
I have studying Cocoa - objective-C by myself for a few days ( im  
entirely new to programming). There's a question I wanna know about.


When you create a project in XCode, and add a new class, does anyone  
know what .h file and .m respectively for?


I mean if they have their own jobs in the coding, I wanna know like .h  
for declare the varibles and .m for implementing?




___

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 [EMAIL PROTECTED]


make a window not draggable in spaces

2008-03-17 Thread Cocoa Developer
Hi,
How to make a window not draggable in spaces.
I used to set NSBorderlessWindowMask mask while creating window, when set
Full screen.
But spaces neglect this mask and allow to drag around.

Thank you,
Bas
___

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 [EMAIL PROTECTED]


Prevent application activation after dragging items to the Dock icon?

2008-03-17 Thread Peter Maurer
Cocoa applications tend to come to the foreground automatically  
whenever I drag files to their Dock icon. Sometimes, however, I'd  
prefer my application to stay in the background and just start working  
on the file, while giving feedback through the Dock icon.


But this isn't supposed to be a background-only process -- ideally,  
activation behavior would depend on the type of the file(s) I just  
dragged to the Dock.


(You might think such behavior would confuse users. But I do think it  
would be useful in situations where users drag lots of items to the  
application's Dock icon, because they want them to be dealt with  
sequentially. And this kind of non-standard behavior would certainly  
only be an option.)


So is anyone aware of a way to prevent an application from activating  
in these situations -- similar to sending preventWindowOrdering to  
keep windows in the background after mouse clicks?


Thanks!

Peter.
___

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 [EMAIL PROTECTED]