Re: Tools in App Bundles

2009-05-19 Thread Chris Suter
Hi Kevin,

On Wed, May 20, 2009 at 4:28 PM, Kevin LaCoste  wrote:
> Thanks for the link. Now the question becomes, if we move helper tools into
> a new Contents/Helpers folder are they covered by codesign?

No, it wouldn't be covered by codesign. codesign has some built-in
rules that specify what is covered and what isn't.

These are the default rules:

^Resources/.*\.lproj/

optional

weight
1000


Regards,

Chris
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Tools in App Bundles

2009-05-19 Thread Kevin LaCoste
Thanks for the link. Now the question becomes, if we move helper tools into
a new Contents/Helpers folder are they covered by codesign? Would the
problem mentioned in that post persist if we used Contents/MacOS/Tools
instead? Sub paths must be supported since it's part of the inspector
window. Time for some testing...

Kevin

On Wed, May 20, 2009 at 1:21 PM, Jerry Krinock  wrote:

>
> On 2009 May 19, at 18:21, Kevin LaCoste wrote:
>
>  I found some sample code that includes a helper tool and yes, it's in the
>> "Contents/MacOS" folder.
>>
>
> Yes, but there are issues with this.  Read:
>
> http://www.cocoabuilder.com/archive/message/cocoa/2009/3/26/233141
>
> My privileged helper tool is in Contents/MacOS, because I didn't want to
> hack BetterAuthorizationSample.  But I put my other helpers in
> Contents/Helpers.
>
>
> ___
>
> 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/klacoste%40zenvilla.com
>
> This email sent to klaco...@zenvilla.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 arch...@mail-archive.com


Re: Debugging ineffective binding?

2009-05-19 Thread Rick Mann


On May 19, 2009, at 21:19:24, Ken Thomases wrote:


On May 19, 2009, at 10:44 PM, Rick Mann wrote:

I have what I think is a very straightforward binding, but I can't  
verify that it's actually working.


I created a property foo (of type NSCellStateValue, an NSInteger),  
and bound a checkbox's value to it in IB. To verify that the  
binding is changing the value, I implemented the getter/setter and  
put a breakpoint in. It's not stopping at the breakpoint, so I  
wonder what's going on.


Did you build for debugging?  Are breakpoints enabled -- which is  
another way of asking if you're using Run or Debug from the Run menu?


Can you set a breakpoint in a method you're sure is being called, to  
verify that breakpoints are working in general?


Have you tried putting an NSLog call into the accessors?  Is the log  
line appearing in Xcode's Console window?


I've done all this, and it behaves as expected. My accessor is even  
called initially when my code explicitly calls "self.foo = ".



What other tools are there for debugging bindings at this level?


I recommend that you override +accessInstanceVariablesDirectly for  
all of your classes to return NO.  That can catch cases where the  
binding and instance variables are spelled/typed one way, while the  
accessors are mistakenly spelled another.


Here's some other info:

http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/Concepts/Troubleshooting.html


Thanks!

--
Rick

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Tools in App Bundles

2009-05-19 Thread Jerry Krinock


On 2009 May 19, at 18:21, Kevin LaCoste wrote:

I found some sample code that includes a helper tool and yes, it's  
in the

"Contents/MacOS" folder.


Yes, but there are issues with this.  Read:

http://www.cocoabuilder.com/archive/message/cocoa/2009/3/26/233141

My privileged helper tool is in Contents/MacOS, because I didn't want  
to hack BetterAuthorizationSample.  But I put my other helpers in  
Contents/Helpers.



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Debugging ineffective binding?

2009-05-19 Thread Ken Thomases

On May 19, 2009, at 10:44 PM, Rick Mann wrote:

I have what I think is a very straightforward binding, but I can't  
verify that it's actually working.


I created a property foo (of type NSCellStateValue, an NSInteger),  
and bound a checkbox's value to it in IB. To verify that the binding  
is changing the value, I implemented the getter/setter and put a  
breakpoint in. It's not stopping at the breakpoint, so I wonder  
what's going on.


Did you build for debugging?  Are breakpoints enabled -- which is  
another way of asking if you're using Run or Debug from the Run menu?


Can you set a breakpoint in a method you're sure is being called, to  
verify that breakpoints are working in general?


Have you tried putting an NSLog call into the accessors?  Is the log  
line appearing in Xcode's Console window?




What other tools are there for debugging bindings at this level?


I recommend that you override +accessInstanceVariablesDirectly for all  
of your classes to return NO.  That can catch cases where the binding  
and instance variables are spelled/typed one way, while the accessors  
are mistakenly spelled another.


Here's some other info:

http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/Concepts/Troubleshooting.html

Regards,
Ken

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Synthesized properties for scalars not KVO compliant

2009-05-19 Thread Andy Lee

On May 19, 2009, at 7:52 PM, Kiel Gillard wrote:
I have a few scalar (NSUInteger, CGRect etc) ivars in my model  
objects. I have declared identically named properties for these  
scalars and instructed the compiler to synthesize accessor methods  
for them. My controller objects add themselves to the model objects  
as observers with the keypaths to the scalars.


Sounds right, should work.

However, I'm not getting any key-value observing notifications when  
changes to those observed properties occur (observeKeyPath... isn't  
being called at all).


I feel I may be missing something very simple but I have no idea  
what. Any suggestions?


Use NSLog and/or the debugger to question everything.  You say the  
controllers are adding themselves as observers; are they doing so as  
self, or is there a variable that you think is pointing to a  
controller, but might be nil?  You say changes to the properties are  
occurring and you're not setting the ivars directly; how *are* you  
setting the property?  If it's through code, are you positive the  
object you're modifying is == to the object you observed?  How are you  
confirming that the property is actually getting changed?


--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 arch...@mail-archive.com


Re: Clarification on custom NSFormatter

2009-05-19 Thread Graham Cox


On 20/05/2009, at 1:43 PM, Erg Consultant wrote:

I have my own objects I store in an NSOutlineView. Each object has a  
name property.


When I implement my custom NSFormatter to tell the table how to draw  
cells,


This is not what NSFormatter does. How a cell is drawn is defined by  
the cell. The content of the cell may be modified by a formatter, but  
the formatter isn't required and doesn't draw anything.



do I create a separate subclass of NSFormatter, or can I make my  
existing data class subclass from NSFormatter and then use the data  
objects for both data and as the NSFormatter? It seems silly to have  
to create separate objects just to do the formatting when I am  
already storing the data objects in the table to begin with.



You can do whatever you like. A formatter isn't compulsory. Your data  
objects can supply their data in whatever form makes sense. It's the  
cell that draws it.


--Graham


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Debugging ineffective binding?

2009-05-19 Thread Rick Mann
I have what I think is a very straightforward binding, but I can't  
verify that it's actually working.


I created a property foo (of type NSCellStateValue, an NSInteger), and  
bound a checkbox's value to it in IB. To verify that the binding is  
changing the value, I implemented the getter/setter and put a  
breakpoint in. It's not stopping at the breakpoint, so I wonder what's  
going on.


What other tools are there for debugging bindings at this level?

TIA,
--
Rick

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Clarification on custom NSFormatter

2009-05-19 Thread Erg Consultant
I have my own objects I store in an NSOutlineView. Each object has a name 
property.

When I implement my custom NSFormatter to tell the table how to draw cells, do 
I create a separate subclass of NSFormatter, or can I make my existing data 
class subclass from NSFormatter and then use the data objects for both data and 
as the NSFormatter? It seems silly to have to create separate objects just to 
do the formatting when I am already storing the data objects in the table to 
begin with.

Erg



  
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Better to chain key path dependencies, or list explicitly?

2009-05-19 Thread Rick Mann


On May 19, 2009, at 20:39:12, Ken Thomases wrote:


On May 19, 2009, at 6:24 PM, Rick Mann wrote:

I have some key paths dependent on other paths. I'm using  
+keypathsForValuesAffectingFoo to set up the dependency.


Now I have a chain of dependencies: A -> B -> C. Is it better to  
just have B depend on C, and A depend on B, or should A explicitly  
depend on B and C?


I would say that it should follow the implementation of property A.   
Is property A implemented by directly using property C, or only  
property B?


From a maintenance perspective, you don't want to introduce  
dependencies where you don't have to.  Somebody should be able to  
reproduce +keypathsForValuesAffectingA by looking at -a and -setA:  
and whatever other methods constitute the implementation of A.


Put another way, somebody changing the implementation (not the  
interface nor contract) of B should not have to go around to all of  
the properties that might depend on B and check how they were  
written.  B's implementation should be local to itself and should  
not leak into the implementation of A.



That's a reasonable rule of thumb. In this case, A is implemented only  
in terms of B, not C. Thanks!


--
Rick

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Better to chain key path dependencies, or list explicitly?

2009-05-19 Thread Ken Thomases

On May 19, 2009, at 6:24 PM, Rick Mann wrote:

I have some key paths dependent on other paths. I'm using  
+keypathsForValuesAffectingFoo to set up the dependency.


Now I have a chain of dependencies: A -> B -> C. Is it better to  
just have B depend on C, and A depend on B, or should A explicitly  
depend on B and C?


I would say that it should follow the implementation of property A.   
Is property A implemented by directly using property C, or only  
property B?


From a maintenance perspective, you don't want to introduce  
dependencies where you don't have to.  Somebody should be able to  
reproduce +keypathsForValuesAffectingA by looking at -a and -setA: and  
whatever other methods constitute the implementation of A.


Put another way, somebody changing the implementation (not the  
interface nor contract) of B should not have to go around to all of  
the properties that might depend on B and check how they were  
written.  B's implementation should be local to itself and should not  
leak into the implementation of A.


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 arch...@mail-archive.com


Only One Reason to ever use Transient Properties in Core Data

2009-05-19 Thread Jerry Krinock
After working through another issue caused by my use of a transient  
property, I just searched the whole Core Data Programming Guide for  
"transient".


I found four disadvantages of using transient properties vs. one  
advantage.  The advantage is not having to write custom accessor  
methods to support non-standard data types.


So my conclusion is that it is a design mistake to make "Transient" an  
attribute which is of a standard data type.  You get no advantages --  
only headaches, possible bugs, and "gotchas" when you switch from XML  
to SQLite store.


Have I missed anything?

Jerry Krinock


(*) Here are the four disadvantages:

... you cannot fetch using a predicate based on transient properties...

... you cannot sort on transient properties using the SQLite store...

... with transformable attributes you specify just one attribute and  
the conversion is handled automatically. In contrast, with transient  
properties you specify two attributes and

you have to write code to perform the conversion.

... If you use refreshObject:mergeChanges: with the mergeChanges flag  
YES, then any transient properties are restored to their pre-refresh  
value after awakeFromFetch is invoked. This means that, if you have a  
transient property with a value that depends on a property that is  
refreshed, the transient value may become out of sync.





___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Distinguish Pending Text from Committed Text

2009-05-19 Thread Gwynne Raskind

On May 19, 2009, at 10:35 PM, Dong Feng wrote:

Thanks Michael and Gideon's reply. [NSTextInput markedRange] works.

A minor question is that [NSWindow fieldEditor] returns an NSText*,
rather than an NSTextView*. I think that's because of historical
reason and it should be safe to always cast a returned NSText point to
an NSTextView. Is it safe?


I don't know if it's safe 100% of the time, but if you do it, drop an  
assert in your code for sanity's sake:


NSAssert( [returnedFieldEditor isKindOfClass:[NSTextView class]] ==  
YES, @"Field editor is, in fact, an NSTextView." );


-- Gwynne, Daughter of the Code
"This whole world is an asylum for the incurable."
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Distinguish Pending Text from Committed Text

2009-05-19 Thread Dong Feng
Thanks Michael and Gideon's reply. [NSTextInput markedRange] works.

A minor question is that [NSWindow fieldEditor] returns an NSText*,
rather than an NSTextView*. I think that's because of historical
reason and it should be safe to always cast a returned NSText point to
an NSTextView. Is it safe?



2009/5/20 Michael Ash :
> On Tue, May 19, 2009 at 9:48 AM, Dong Feng  wrote:
>> When using an non-English input method, such as Japanese or Chinese,
>> the entered characters are first in a pending status (i.e. with an
>> underscore). Pressing the space key make those pending text converted
>> to the actual non-English characters. Pressing the Enter key make the
>> underscore beneath the letters disappear. Either way, the pending text
>> become committed.
>>
>> I want to programmatically distinguish the committed text from the
>> pending one, in a NSTextField. [NSTextField stringValue] returns the
>> sum, not only the committed part. Is there any way to do so?
>
> Check out the NSTextInput protocol. NSTextView conforms to that
> protocol, so if you get the field editor from your NSTextField, you
> can use those methods. I believe that "marked" is what that protocol
> calls what you are referring to as "pending", but I'm not 100% sure.
>
> (Warning: I've never tried any of this.)
>
> Mike
> ___
>
> 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/middle.fengdong%40gmail.com
>
> This email sent to middle.fengd...@gmail.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 arch...@mail-archive.com


Re: Tools in App Bundles

2009-05-19 Thread Kevin LaCoste
Hey Chris, thanks for the reply.

Some further follow up.

I found some sample code that includes a helper tool and yes, it's in the
"Contents/MacOS" folder. Also, when opening the inspector window for a "Copy
Files" build phase, I noticed there is a popup menu with what I would guess
are the recommended bundle directories. Hadn't noticed that before.

http://developer.apple.com/samplecode/BetterAuthorizationSample/

Kevin LaCoste


On Wed, May 20, 2009 at 9:38 AM, Chris Suter  wrote:

> Hi Kevin,
>
> On Tue, May 19, 2009 at 8:04 PM, Kevin LaCoste 
> wrote:
> [snip]
> > If I understand that correctly, my tool is in the correct place but I'm
> not
> > confident. Should it be in "Contents/MacOS"
>
> Yes.
>
> > or should I add a "Contents/Executable" folder?
>
> No.
>
> > Bonus question. Is the support directory referred to above the
> Application
> > Support folder or is this another additional, optional bundle directory?
>
> It used to be the case that support applications that are bundles go
> in the Contents folder, but that doesn't seem to agree with the
> documentation you've found. The best thing to do is ask this question
> on the apple-cdsa list.
>
> Kind regards,
>
> Chris
>
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Cocoa event handling in fullscreen

2009-05-19 Thread Christopher Hansen
Thanks, Douglas.  That helps.

Christopher




From: douglas welton 
To: Christopher Hansen 
Cc: Alexander Spohr ; cocoa-dev@lists.apple.com
Sent: Tuesday, May 19, 2009 5:59:33 PM
Subject: Re: Cocoa event handling in fullscreen

Nothing stops you from starting up in "full screen" mode when you are using a 
window.

In IB, create a borderless window.  Size it appropriately.  Uncheck the 
"visible at Launch" switch.
In your awakeFromNib:, you can hide the main menubar.
Finally,  -makeKeyAndOrderFront:  the window when you are ready to display it.

The only way you will start with a blank window is if you tell the system to do 
so.

Hopefully, my comments make sense... and hopefully, I am understanding your 
problem... ;^}

On May 19, 2009, at 6:10 PM, Christopher Hansen wrote:

> Is there a way that I can do this without a window?  I'm writing a platform 
> independent game, so I want to alter the structure as little as possible.  
> The behavior that we want is to simply start up in full screen, and I'd like 
> to avoid starting up with a blank window before going to fullscreen.
> 
> Christopher
> 
> 
> 
> 
> From: Alexander Spohr 
> To: Christopher Hansen 
> Cc: cocoa-dev@lists.apple.com
> Sent: Tuesday, May 19, 2009 3:00:20 PM
> Subject: Re: Cocoa event handling in fullscreen
> 
> Christopher,
> 
> you could use an NSView subclass going into fullscreen, then set yourself as 
> the next responder of its window. Just implement mouse/keyDown for your 
> NSView’s subclass. Call super if you don’t need the event.
> 
>atze
> 
> 
> 
> 
> Am 19.05.2009 um 19:53 schrieb Christopher Hansen:
> 
>> Hello,
>> 
>> I'm writing a fullscreen game using Cocoa.  I need to intercept mouse and 
>> key events for my game's usage, but I'd also like to forward them on 
>> appropriately if my game code doesn't handle them specifically (e.g., 
>> adjusting volume, screen brightness, opening the CD/DVD ROM drive, 
>> Command-Q, etc.).
>> 
>> Since my game is fullscreen-only, I don't define any windows, I just 
>> subclass NSApplication.  I'm planning on providing event handling methods in 
>> my application (e.g., mouseDown, keyDown, etc.) and overriding sendEvent to 
>> call my application's methods for the event types that I'm interested in and 
>> falling back to [super sendEvent:anEvent]; otherwise.
>> 
>> The difficulty I'm having is what I do with key events, for instance, that 
>> are not needed specifically by my game code.  I've thought of either (a) 
>> returning a bool to indicate whether my game code used the event and using 
>> [super sendEvent:anEvent]; if it did not or (b) using [self nextResponder] 
>> to send it along.  The latter, of course, is consistent with the Cocoa event 
>> handling guide, but since I'm not using the standard Cocoa UI (windows, 
>> menus, etc.) with my fullscreen-only game, I'm not sure it's the right thing 
>> to do.
>> 
>> 
>> Any help would be appreciated.
>> 
>> Thanks,
>> Christopher
>> 
>> 
>> 
>> ___
>> 
>> 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/atze%40freeport.de
>> 
>> This email sent to a...@freeport.de
> 
> 
> 
> ___
> 
> 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/douglas_welton%40earthlink.net
> 
> This email sent to douglas_wel...@earthlink.net



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Synthesized properties for scalars not KVO compliant

2009-05-19 Thread Jerry Krinock


On 2009 May 19, at 16:52, Kiel Gillard wrote:


I feel I may be missing something very simple but I have no idea what.


Never tried it with structs like CGRect but I just bound some integers  
like this yesterday and they KVO works.  The title of your message  
says "not KVO compliant".  Please clarify: Is the console log telling  
you this, or is this your interpretation?



Any suggestions?


Post some code.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Tools in App Bundles

2009-05-19 Thread Chris Suter
Hi Kevin,

On Tue, May 19, 2009 at 8:04 PM, Kevin LaCoste  wrote:
[snip]
> If I understand that correctly, my tool is in the correct place but I'm not
> confident. Should it be in "Contents/MacOS"

Yes.

> or should I add a "Contents/Executable" folder?

No.

> Bonus question. Is the support directory referred to above the Application
> Support folder or is this another additional, optional bundle directory?

It used to be the case that support applications that are bundles go
in the Contents folder, but that doesn't seem to agree with the
documentation you've found. The best thing to do is ask this question
on the apple-cdsa list.

Kind regards,

Chris
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Bindings and KVO of View objects

2009-05-19 Thread Stuart Malin


On May 19, 2009, at 1:44 PM, Quincey Morris wrote:


On May 19, 2009, at 14:18, Stuart Malin wrote:



My specific concern is with NSSegmentedControl, which has a bindable
property "selectedIndex". I am trying to add an observer for this
property (using -addObserver: on an instance). Alas, I am not
getting an observer event (i.e, invocation of my -
observerForKeyPath:... method) when I change the segmented control
in the U/I.  So, either I have done something incorrectly in setting
up the observer, or this is not an observable property.



Finally, it usually indicates a design flaw if you're trying to
observe a property of a user interface object. It's almost always
better to observe the value that the UI object is bound to. (There are
valid exceptions, though.)


I don't see why it is a design flaw to want to bind to the  
selectedIndex of a segmented control so that when the user changes the  
selected segment, my code to take action. Binding to the control is  
conceptually quite similar. The two approaches to me seem to be  
matters of implementation specifics.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Bindings and KVO of View objects

2009-05-19 Thread Stuart Malin


On May 19, 2009, at 1:44 PM, Kyle Sluder wrote:


On Tue, May 19, 2009 at 7:01 PM, Quincey Morris
 wrote:

On May 19, 2009, at 14:18, Stuart Malin wrote:
No. The name of the binding is *not* the same as the name of any  
property of
the bound object. For example, most controls have a "value"  
binding, but

controls don't have a "value" property.


Actually, be careful if you're implementing a bindable object.  I
believe the default implementation of
-bind:toObject:withKeyPath:options: actually uses the provided key as
a property, even though this isn't documented anywhere.


I realized after I issued my post that I had inverted the thinking  
regarding KVO . For bindings, the KVO is used to observe the property  
that is *given* to the binding in the - 
bind:toObject:withKeyPath:options: method call.


The assumption underlying your assumption, that there is some sort  
of direct
correlation between a binding and an underlying property, is also  
false.
Typically, bindings will be implemented so as to use one or more  
properties
of the bound object, but that's not a requirement (except perhaps  
in a

looser conceptual sense).


This point needs to be made more clearly: binding names and properties
live in separate namespaces.



Yes: there is no correlation between a named binding and any  
underlying property.



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Synthesized properties for scalars not KVO compliant

2009-05-19 Thread Kiel Gillard

I should also mention I am not assigning a value to the scalar directly.

On 20/05/2009, at 9:52 AM, Kiel Gillard wrote:


Hi all,

I have a few scalar (NSUInteger, CGRect etc) ivars in my model  
objects. I have declared identically named properties for these  
scalars and instructed the compiler to synthesize accessor methods  
for them. My controller objects add themselves to the model objects  
as observers with the keypaths to the scalars. However, I'm not  
getting any key-value observing notifications when changes to those  
observed properties occur (observeKeyPath... isn't being called at  
all).


I feel I may be missing something very simple but I have no idea  
what. Any suggestions?


Thanks,

Kiel


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Cocoa event handling in fullscreen

2009-05-19 Thread douglas welton
Nothing stops you from starting up in "full screen" mode when you are  
using a window.


In IB, create a borderless window.  Size it appropriately.  Uncheck  
the "visible at Launch" switch.

In your awakeFromNib:, you can hide the main menubar.
Finally,  -makeKeyAndOrderFront:  the window when you are ready to  
display it.


The only way you will start with a blank window is if you tell the  
system to do so.


Hopefully, my comments make sense... and hopefully, I am understanding  
your problem... ;^}


On May 19, 2009, at 6:10 PM, Christopher Hansen wrote:

Is there a way that I can do this without a window?  I'm writing a  
platform independent game, so I want to alter the structure as  
little as possible.  The behavior that we want is to simply start up  
in full screen, and I'd like to avoid starting up with a blank  
window before going to fullscreen.


Christopher




From: Alexander Spohr 
To: Christopher Hansen 
Cc: cocoa-dev@lists.apple.com
Sent: Tuesday, May 19, 2009 3:00:20 PM
Subject: Re: Cocoa event handling in fullscreen

Christopher,

you could use an NSView subclass going into fullscreen, then set  
yourself as the next responder of its window. Just implement mouse/ 
keyDown for your NSView’s subclass. Call super if you don’t need the  
event.


   atze




Am 19.05.2009 um 19:53 schrieb Christopher Hansen:


Hello,

I'm writing a fullscreen game using Cocoa.  I need to intercept  
mouse and key events for my game's usage, but I'd also like to  
forward them on appropriately if my game code doesn't handle them  
specifically (e.g., adjusting volume, screen brightness, opening  
the CD/DVD ROM drive, Command-Q, etc.).


Since my game is fullscreen-only, I don't define any windows, I  
just subclass NSApplication.  I'm planning on providing event  
handling methods in my application (e.g., mouseDown, keyDown, etc.)  
and overriding sendEvent to call my application's methods for the  
event types that I'm interested in and falling back to [super  
sendEvent:anEvent]; otherwise.


The difficulty I'm having is what I do with key events, for  
instance, that are not needed specifically by my game code.  I've  
thought of either (a) returning a bool to indicate whether my game  
code used the event and using [super sendEvent:anEvent]; if it did  
not or (b) using [self nextResponder] to send it along.  The  
latter, of course, is consistent with the Cocoa event handling  
guide, but since I'm not using the standard Cocoa UI (windows,  
menus, etc.) with my fullscreen-only game, I'm not sure it's the  
right thing to do.



Any help would be appreciated.

Thanks,
Christopher



___

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/atze%40freeport.de

This email sent to a...@freeport.de




___

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/douglas_welton%40earthlink.net

This email sent to douglas_wel...@earthlink.net


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Synthesized properties for scalars not KVO compliant

2009-05-19 Thread Kiel Gillard

Hi all,

I have a few scalar (NSUInteger, CGRect etc) ivars in my model  
objects. I have declared identically named properties for these  
scalars and instructed the compiler to synthesize accessor methods for  
them. My controller objects add themselves to the model objects as  
observers with the keypaths to the scalars. However, I'm not getting  
any key-value observing notifications when changes to those observed  
properties occur (observeKeyPath... isn't being called at all).


I feel I may be missing something very simple but I have no idea what.  
Any suggestions?


Thanks,

Kiel
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Programatically set file URL of Core Data Document?

2009-05-19 Thread Jerry Krinock


Thanks, Ben.  With the background you provided, after a couple hours  
of trial and error I finally devised a method that seems to work,  
shown below in -[NSPersistentDocument saveMoveToNewPath:error_p:].   
Indeed, it is necessary to jump through quite a few hoops, and to do  
so in just the correct order.


On 2009 May 18, at 23:35, Ben Trumbull wrote:

Probably worth a bug.


OK, Bug ID# 6904434, "Difficult to move a Core Data document file".   
Enhancement.


Jerry


The following categories may be added to a Core Data document-based  
application, providing action methods for "New Document with  
Wizard..." and "Save As Move..." items in the File menu.


* NSPersistentDocument+Pathify.h **

#import 

@interface NSPersistentDocument (Pathify)

/*!
 @briefAction method for a "Save As Move..."
 item in the "File" menu.

 @details  Presents a dialog which allows the user to
 move the receiver's file to a new path, deleting the
 old file.

 Suggested tooltip for the "Save As Move..." menu item:
 "This is like 'Save As...', except your document file will
 also be removed from its current name/location."
*/
- (IBAction)saveAsMove:(id)sender ;

/*!
 @briefSaves the receiver's file to a new path,
 deleting the old file.

 @paramerror_p  Pointer to an NSError which, if not
 NULL and the method fails, will point to an NSError
 explaining the failure.   Pass NULL if you are
 not interested in the NSError.
 @result   YES if the method succeeds, NO if it fails.
*/
- (BOOL)saveMoveToNewPath:(NSString*)newPath
  error_p:(NSError**)error_p ;

* NSPersistentDocument+Pathify.m **

#import "NSPersistentDocument+Pathify.h"
#import "NSDocumentController+FileExtensions.h"

@implementation NSPersistentDocument (Pathify)

- (BOOL)saveMoveToNewPath:(NSString*)newPath
  error_p:(NSError**)error_p {
BOOL ok = YES ;
NSError* error_ ;
NSInteger errorCode = 157160 ;

// In case this comes from a dialog, make sure that newPath has the
// proper filename extension.
NSString* requiredExtension = [[NSDocumentController  
sharedDocumentController] defaultFilenameExtension] ;

NSURL* newURL = [NSURL fileURLWithPath:newPath] ;
if (![[newPath pathExtension] isEqualToString:requiredExtension]) {
newPath = [newPath  
stringByAppendingPathExtension:requiredExtension] ;

}

newURL = [NSURL fileURLWithPath:newPath] ;

// Core Data needs a document file on disk to start with ...
NSURL* oldURL = [self fileURL] ;
if (!oldURL) {
// This will execute for new, never-saved documents
NSString* oldPath = NSTemporaryDirectory() ;
NSString* bundleID = [[NSBundle mainBundle] bundleIdentifier] ;
oldPath = [oldPath stringByAppendingPathComponent:bundleID] ;
oldPath = [oldPath stringByAppendingString:@"_temp"] ;
oldURL = [NSURL fileURLWithPath:oldPath] ;
[self setFileURL:oldURL] ;
}

NSString* oldPath = [[self fileURL] path] ;

// Core Data also needs a store ...
if (ok) {
NSManagedObjectContext* moc = [self managedObjectContext] ;
NSPersistentStoreCoordinator* psc = [moc  
persistentStoreCoordinator] ;

NSArray* stores = [psc persistentStores] ;
if ([stores count] < 1) {
// This will execute for new, never-saved documents
NSPersistentStore* oldStore = [psc  
addPersistentStoreWithType:NSSQLiteStoreType
 
configuration:nil
   
URL:oldURL
   
options:0
 
error:&error_] ;

ok = (oldStore != nil) ;
}
}
if (!ok) {
errorCode = 157161 ;
goto end ;
}


ok = [self saveToURL:oldURL
  ofType:[self fileType]
forSaveOperation:NSSaveOperation
   error:&error_] ;
if (!ok) {
errorCode = 157162 ;
goto end ;
}


// Needed if using the SQLite or other nonatomic store ...
NSFileManager* fileManager = [NSFileManager defaultManager] ;
ok = [fileManager moveItemAtPath:oldPath
  toPath:newPath
   error:&error_] ;
if (!ok) {
errorCode = 157163 ;
goto end ;
}


// Needed for NSDocument to use the new location for
// future saves, window title bar, etc. ...
[self setFileURL:newURL] ;

// Needed to avoid NSDocument displaying a sheet which tells the
// user that the document has been moved, and ask do they really
// want to save it in the new location, the next time they click
// in the menu File > Save ...
ok = [self saveToURL:newURL
  ofType:[self fileType]
forSaveOperation:NSSaveOperation
  

Better to chain key path dependencies, or list explicitly?

2009-05-19 Thread Rick Mann
I have some key paths dependent on other paths. I'm using  
+keypathsForValuesAffectingFoo to set up the dependency.


Now I have a chain of dependencies: A -> B -> C. Is it better to just  
have B depend on C, and A depend on B, or should A explicitly depend  
on B and C?


TIA,
--
Rick

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Bindings and KVO of View objects

2009-05-19 Thread Kyle Sluder
On Tue, May 19, 2009 at 7:01 PM, Quincey Morris
 wrote:
> On May 19, 2009, at 14:18, Stuart Malin wrote:
> No. The name of the binding is *not* the same as the name of any property of
> the bound object. For example, most controls have a "value" binding, but
> controls don't have a "value" property.

Actually, be careful if you're implementing a bindable object.  I
believe the default implementation of
-bind:toObject:withKeyPath:options: actually uses the provided key as
a property, even though this isn't documented anywhere.

> The assumption underlying your assumption, that there is some sort of direct
> correlation between a binding and an underlying property, is also false.
> Typically, bindings will be implemented so as to use one or more properties
> of the bound object, but that's not a requirement (except perhaps in a
> looser conceptual sense).

This point needs to be made more clearly: binding names and properties
live in separate namespaces.

--Kyle Sluder
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Bindings and KVO of View objects

2009-05-19 Thread Quincey Morris

On May 19, 2009, at 14:18, Stuart Malin wrote:

As my understanding of Bindings is that they implement using KVO and  
KVC, then is it safe to assume that if an object has a bindable  
property, then that property should be observable with KVO, yes?


No. The name of the binding is *not* the same as the name of any  
property of the bound object. For example, most controls have a  
"value" binding, but controls don't have a "value" property.


The assumption underlying your assumption, that there is some sort of  
direct correlation between a binding and an underlying property, is  
also false. Typically, bindings will be implemented so as to use one  
or more properties of the bound object, but that's not a requirement  
(except perhaps in a looser conceptual sense).


My specific concern is with NSSegmentedControl, which has a bindable  
property "selectedIndex". I am trying to add an observer for this  
property (using -addObserver: on an instance). Alas, I am not  
getting an observer event (i.e, invocation of my - 
observerForKeyPath:... method) when I change the segmented control  
in the U/I.  So, either I have done something incorrectly in setting  
up the observer, or this is not an observable property.


Pendantically, there's no such thing as a "bindable property".  
NSSegmentedControl has a binding named "selectedIndex" and a property  
named "selectedSegment" which (presumably) the binding uses. So, you  
should observe the "selectedSegment" property, not the (non-existent)  
"selectedIndex" property.


Incidentally, the relationship between the binding and the property is  
an implementation detail. It's not impossible that the "selectedIndex"  
binding might use a privately-known property, and that  
"selectedSegment" is derived from that private property in a non-KVO- 
compliant way. It's not impossible, therefore, that observing  
"selectedSegment" doesn't work, regardless of bindings.


Finally, it usually indicates a design flaw if you're trying to  
observe a property of a user interface object. It's almost always  
better to observe the value that the UI object is bound to. (There are  
valid exceptions, though.)



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: When init returns nil does it cause a leak

2009-05-19 Thread Jesper Storm Bache
I did talk to an Apple engineer about this and when I argued for  
[super dealloc] I was told that it would be fine.
I then logged a radar against the seemingly incorrect documentation, I  
got a reply stating that [self release] is the recommended approach by  
the AppKit team.
My radar was closed on 24-Feb-2009, so I think this is the most  
current recommendation.


Jesper

On May 19, 2009, at 3:01 PM, Nathan Vander Wilt wrote:


On May 19, 2009, at 9:37 AM, Jean-Daniel Dupas wrote:


Le 19 mai 09 à 18:24, Reza Farhad a écrit :

Hi all

we have an object that gets initialized like most other objects

-(id)init
{
self = [ super init ];
if ( self ){
...do something;
}
return self;
}

if [ super init ]  returns nil does this cause a leak, as the
memory has already been created by calling alloc when trying to
create the object

AnObject*object = [[ AnObject alloc ] init ];

I am sure the answer is simple but this suddenly stumbled me.

Thanks


The answer is in the Cocoa Fundamentals Guide > Cocoa Objects >
Object Creation > Implementing Initializer

with a lots of other useful info.

http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/CocoaObjects.html



There was a thread in ObjC-language about this a while back:
http://lists.apple.com/archives/ObjC-Language/2008/Sep/msg00132.html

In the followup, an Apple runtime engineer recommends calling [super
dealloc] before returning nil, saying "[self dealloc] or [self
release] are bad because they might call some subclass's -dealloc
method even though the subclass's -init hasn't done anything yet."

Of course, in practice [self release] should usually work just fine as
well, and avoids breaking the "never call dealloc except in -dealloc"
taboo. And indeed, this is what the documentation and sample code do
as well. I think you would be reasonably justified to do either. I'm
still debating this myself for our company's code, but the fact is
that they both work in most situations.

hope this helps,
-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/jsbache%40adobe.com

This email sent to jsba...@adobe.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 arch...@mail-archive.com


Re: Cocoa event handling in fullscreen

2009-05-19 Thread Christopher Hansen
Is there a way that I can do this without a window?  I'm writing a platform 
independent game, so I want to alter the structure as little as possible.  The 
behavior that we want is to simply start up in full screen, and I'd like to 
avoid starting up with a blank window before going to fullscreen.

Christopher




From: Alexander Spohr 
To: Christopher Hansen 
Cc: cocoa-dev@lists.apple.com
Sent: Tuesday, May 19, 2009 3:00:20 PM
Subject: Re: Cocoa event handling in fullscreen

Christopher,

you could use an NSView subclass going into fullscreen, then set yourself as 
the next responder of its window. Just implement mouse/keyDown for your 
NSView’s subclass. Call super if you don’t need the event.

atze




Am 19.05.2009 um 19:53 schrieb Christopher Hansen:

> Hello,
> 
> I'm writing a fullscreen game using Cocoa.  I need to intercept mouse and key 
> events for my game's usage, but I'd also like to forward them on 
> appropriately if my game code doesn't handle them specifically (e.g., 
> adjusting volume, screen brightness, opening the CD/DVD ROM drive, Command-Q, 
> etc.).
> 
> Since my game is fullscreen-only, I don't define any windows, I just subclass 
> NSApplication.  I'm planning on providing event handling methods in my 
> application (e.g., mouseDown, keyDown, etc.) and overriding sendEvent to call 
> my application's methods for the event types that I'm interested in and 
> falling back to [super sendEvent:anEvent]; otherwise.
> 
> The difficulty I'm having is what I do with key events, for instance, that 
> are not needed specifically by my game code.  I've thought of either (a) 
> returning a bool to indicate whether my game code used the event and using 
> [super sendEvent:anEvent]; if it did not or (b) using [self nextResponder] to 
> send it along.  The latter, of course, is consistent with the Cocoa event 
> handling guide, but since I'm not using the standard Cocoa UI (windows, 
> menus, etc.) with my fullscreen-only game, I'm not sure it's the right thing 
> to do.
> 
> 
> Any help would be appreciated.
> 
> Thanks,
> Christopher
> 
> 
> 
> ___
> 
> 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/atze%40freeport.de
> 
> This email sent to a...@freeport.de



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: When init returns nil does it cause a leak

2009-05-19 Thread Nathan Vander Wilt

On May 19, 2009, at 9:37 AM, Jean-Daniel Dupas wrote:


Le 19 mai 09 à 18:24, Reza Farhad a écrit :

Hi all

we have an object that gets initialized like most other objects

-(id)init
{
self = [ super init ];
if ( self ){
...do something;
}
return self;
}

if [ super init ]  returns nil does this cause a leak, as the  
memory has already been created by calling alloc when trying to  
create the object


AnObject*object = [[ AnObject alloc ] init ];

I am sure the answer is simple but this suddenly stumbled me.

Thanks


The answer is in the Cocoa Fundamentals Guide > Cocoa Objects >  
Object Creation > Implementing Initializer


with a lots of other useful info.

http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/CocoaObjects.html



There was a thread in ObjC-language about this a while back:
http://lists.apple.com/archives/ObjC-Language/2008/Sep/msg00132.html

In the followup, an Apple runtime engineer recommends calling [super  
dealloc] before returning nil, saying "[self dealloc] or [self  
release] are bad because they might call some subclass's -dealloc  
method even though the subclass's -init hasn't done anything yet."


Of course, in practice [self release] should usually work just fine as  
well, and avoids breaking the "never call dealloc except in -dealloc"  
taboo. And indeed, this is what the documentation and sample code do  
as well. I think you would be reasonably justified to do either. I'm  
still debating this myself for our company's code, but the fact is  
that they both work in most situations.


hope this helps,
-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 arch...@mail-archive.com


Re: [OT] Anyone have the a DIRECT phone number for a real person at Apple Legal???

2009-05-19 Thread Kyle Sluder
Have you tried applefede...@apple.com ?  Got that from here:
http://www.apple.com/business/solutions/it/government.html

--Kyle Sluder
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


[off topic] Re: [OT] Anyone have the a DIRECT phone number for a real person at Apple Legal???

2009-05-19 Thread Scott Anguish

Please don't post off-topic messages. These go to 8000+ messages.

You can contact Apple legal (or indeed any aspect of the company)  
through the main switchboard 408 996-1010



On 19-May-09, at 4:27 PM, Karan, Cem (Civ, ARL/CISD) wrote:

Various people here at work have been trying to get in contact with  
someone at Apple on the Legal team about the iPhone Enterprise  
agreement paperwork, but we've just been getting the run around.   
Does anyone have a DIRECT number (not just the info at http://www.apple.com/legal/contacts.html 
 I mean a person's actual number!) that I can pass on?


For those that are wondering, certain parts of the Enterprise  
Agreement aren't applicable to the Federal Government, and our  
lawyers need to talk to Apple's lawyers to get it all straightened  
out.


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Bindings and KVO of View objects

2009-05-19 Thread Stuart Malin
As my understanding of Bindings is that they implement using KVO and  
KVC, then is it safe to assume that if an object has a bindable  
property, then that property should be observable with KVO, yes?


My specific concern is with NSSegmentedControl, which has a bindable  
property "selectedIndex". I am trying to add an observer for this  
property (using -addObserver: on an instance). Alas, I am not getting  
an observer event (i.e, invocation of my -observerForKeyPath:...  
method) when I change the segmented control in the U/I.  So, either I  
have done something incorrectly in setting up the observer, or this is  
not an observable property.


In searching the archives, I came across a statement by mmalc that  
View's don't emit KVO notifications (http://www.cocoabuilder.com/archive/message/cocoa/2007/6/29/185375 
).  If this is so, then how can the NSSegmentedControl (which is an  
NSView) support bindings?



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: iPhone text on UIImage not getting displayed on device.

2009-05-19 Thread Alexander Spohr
Nope. Shraddha is creating a CGBitmapContext and draws into it. That  
is fine.


Shraddha, did you check the heighton the sim and device? I mean h.

CGContextShowTextAtPoint(context, 4, 130, text, strlen(text));

could go wrong, if the image is smaller than 130 pixels.
Is text non-NULL?

I use NSStrings drawInRect: methods to draw text so I can not help  
with ShowText.


atze


Am 19.05.2009 um 19:40 schrieb Luke the Hiesterman:

Is this just a function you wrote? I'm guessing that's the problem.  
All drawing on iPhone should be done in the drawRect: method  
(declared in UIView.h). To put text in an image, you should either  
add another view on top of the image (a UILabel perhaps) or subclass  
UIImageView and add your text drawing in the drawRect: method.


Luke

On May 18, 2009, at 11:43 PM, Shraddha Karwan wrote:

I used the following function to add text on UIImage. I can display  
the text
on iPhone Simulator but its not getting displayed on the actual  
device. What

can be the cause?

CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef context = CGBitmapContextCreate(NULL, w, h, 8, 4 * w,
colorSpace, kCGImageAlphaPremultipliedFirst);

CGContextDrawImage(context, CGRectMake(0, 0, w, h), img.CGImage);
CGContextSetRGBFillColor(context, 0.0, 0.0, 1.0, 1);

char* text = (char *)[text1  
cStringUsingEncoding:NSASCIIStringEncoding];//

"05/05/09";
CGContextSelectFont(context, "Arial", 12, kCGEncodingMacRoman);
CGContextSetTextDrawingMode(context, kCGTextFill);
CGContextSetRGBFillColor(context, 255, 255, 255, 1);

CGContextShowTextAtPoint(context, 4, 130, text, strlen(text));
CGImageRef imageMasked = CGBitmapContextCreateImage(context);
CGContextRelease(context);
CGColorSpaceRelease(colorSpace);

return [UIImage imageWithCGImage:imageMasked];


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Cocoa event handling in fullscreen

2009-05-19 Thread Alexander Spohr

Christopher,

you could use an NSView subclass going into fullscreen, then set  
yourself as the next responder of its window. Just implement mouse/ 
keyDown for your NSView’s subclass. Call super if you don’t need the  
event.


atze




Am 19.05.2009 um 19:53 schrieb Christopher Hansen:


Hello,

I'm writing a fullscreen game using Cocoa.  I need to intercept  
mouse and key events for my game's usage, but I'd also like to  
forward them on appropriately if my game code doesn't handle them  
specifically (e.g., adjusting volume, screen brightness, opening the  
CD/DVD ROM drive, Command-Q, etc.).


Since my game is fullscreen-only, I don't define any windows, I just  
subclass NSApplication.  I'm planning on providing event handling  
methods in my application (e.g., mouseDown, keyDown, etc.) and  
overriding sendEvent to call my application's methods for the event  
types that I'm interested in and falling back to [super  
sendEvent:anEvent]; otherwise.


The difficulty I'm having is what I do with key events, for  
instance, that are not needed specifically by my game code.  I've  
thought of either (a) returning a bool to indicate whether my game  
code used the event and using [super sendEvent:anEvent]; if it did  
not or (b) using [self nextResponder] to send it along.  The latter,  
of course, is consistent with the Cocoa event handling guide, but  
since I'm not using the standard Cocoa UI (windows, menus, etc.)  
with my fullscreen-only game, I'm not sure it's the right thing to do.



Any help would be appreciated.

Thanks,
Christopher



___

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/atze%40freeport.de

This email sent to a...@freeport.de


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: [OT] Anyone have the a DIRECT phone number for a real person at Apple Legal???

2009-05-19 Thread I. Savant
On Tue, May 19, 2009 at 4:27 PM, Karan, Cem (Civ, ARL/CISD)
 wrote:
> Various people here at work have been trying to get in contact with someone 
> at Apple on the Legal team about the iPhone Enterprise agreement paperwork, 
> but we've just been getting the run around.  Does anyone have a DIRECT number 
> (not just the info at http://www.apple.com/legal/contacts.html I mean a 
> person's actual number!) that I can pass on?
>
> For those that are wondering, certain parts of the Enterprise Agreement 
> aren't applicable to the Federal Government, and our lawyers need to talk to 
> Apple's lawyers to get it all straightened out.


  This is completely off-topic for the cocoa-dev list and is spammy
noise to most of us. The cocoa-dev list is for Cocoa dev questions.

  For questions like yours, contact Developer Technical Solutions.

--
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 arch...@mail-archive.com


[OT] Anyone have the a DIRECT phone number for a real person at Apple Legal???

2009-05-19 Thread Karan, Cem (Civ, ARL/CISD)
Various people here at work have been trying to get in contact with someone at 
Apple on the Legal team about the iPhone Enterprise agreement paperwork, but 
we've just been getting the run around.  Does anyone have a DIRECT number (not 
just the info at http://www.apple.com/legal/contacts.html I mean a person's 
actual number!) that I can pass on?

For those that are wondering, certain parts of the Enterprise Agreement aren't 
applicable to the Federal Government, and our lawyers need to talk to Apple's 
lawyers to get it all straightened out.

Thanks,
Cem 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 arch...@mail-archive.com

Re: Cancelling an animation in a UITableViewCell was Re: UITableViewCell instances

2009-05-19 Thread Luke the Hiesterman


On May 18, 2009, at 4:16 PM, Mike Manzano wrote:

First, let me say thanks for your reply. I think I was able to  
implement a similar algorithm for detecting when a cell has gone off- 
screen by overriding the table view's -willRemoveSubview:.


That's great if this works, but it's making a very big assumption  
about the underlying API implementation, and could break in the  
future. There's no contract in the API that cells will be removed from  
their superview when they go out of view, so even if this strategy  
does work now, it could break in the future.


Luke
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: When init returns nil does it cause a leak

2009-05-19 Thread Michael Ash
On Tue, May 19, 2009 at 2:24 PM, Gwynne Raskind  wrote:
> On May 19, 2009, at 2:15 PM, Jesper Storm Bache wrote:
>>
>> In the obj-c world we then have to implement classes to be able to handle
>> a dealloc call before the initializer has completely executed.
>
> My 2 cents...
>
> If we aren't implementing our classes this way to begin with, then we're not
> programming our Objective-C correctly at all. As far as I'm concerned,
> "dealloc should be able to handle a partially initialized object" should be
> a language requirement. If any of Apple's classes don't handle this case
> properly, then it's a bug that should be filed.

Since your instance variables are guaranteed to be zero-filled as soon
as the object is allocated, even before initialization, writing your
dealloc method to correctly handle an uninitialized object should be
trivial. Most dealloc methods will work with zero modification, and
where changes are needed, they tend to be useful belt-and-suspenders
checks anyway.

Mike
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


TableView & TextFieldCell question...

2009-05-19 Thread Richard Nichols

Hello list,

I have an application the contains a single NSTableView with 2 columns  
that are the default NSTextFieldCell.


Everything is done through delegates, there is no binding.

I use NSMutableAttributedString to format the text and URL data to  
display in the second column. This works fine.


Now I want the user to be able to click on the URL link and go  
directly to the site the link points to without being in an 'edit'  
mode. This should be done with only one click!


Everything seems to work fine except that I am forced to click on the  
URL link multiple times to get it to work correctly.


So the question is how do I get the NSTextFieldCell to respond to one  
or two clicks?


I've checked all over the web and there is lots of old, confusing and  
contradictory information out there and even apple's on documentation  
isn't very clear.


Can anyone give me and example or point me where I can find the answer?


Thanks,

ran6110

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSToolBar : Unable to add a seperator item in the toolBar

2009-05-19 Thread Peter Ammon
This code is correct.   You may have customized the toolbar as a user,  
so that toolbarDefaultItemIdentifiers is not called.  In that case,  
you can throw away the preferences file for testing.  Otherwise,  
you'll have to explain what you mean by "not working."


On May 19, 2009, at 10:26 AM, Arun wrote:


Hi,
I have an application in which i added 2 buttons and one search view  
in the
too bar. I need to insert a seperator in between search view and 2  
buttons.
I have tried the following in my code. and it is not working. Any  
idea?


- (NSArray *) toolbarAllowedItemIdentifiers: (NSToolbar *) toolbar
{
   return [NSArray arrayWithObjects:[NSString
stringWithString:serachIdentifier],
   NSToolbarSeparatorItemIdentifier,
   [NSString stringWithString:Button1ToolbarItemIdentifier],
   [NSString stringWithString:Button2ToolbarItemIdentifier],
nil];
}

- (NSArray *) toolbarDefaultItemIdentifiers: (NSToolbar *) toolbar
{
   return [NSArray arrayWithObjects:searchIdentifier,
   NSToolbarSeparatorItemIdentifier,
   Button1ItemIdentifier,
   Button2ItemIdentifier, nil];
}


Thanks
Arun KA


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: When init returns nil does it cause a leak

2009-05-19 Thread Gwynne Raskind

On May 19, 2009, at 2:15 PM, Jesper Storm Bache wrote:
In the obj-c world we then have to implement classes to be able to  
handle a dealloc call before the initializer has completely executed.


My 2 cents...

If we aren't implementing our classes this way to begin with, then  
we're not programming our Objective-C correctly at all. As far as I'm  
concerned, "dealloc should be able to handle a partially initialized  
object" should be a language requirement. If any of Apple's classes  
don't handle this case properly, then it's a bug that should be filed.


-- Gwynne, Daughter of the Code
"This whole world is an asylum for the incurable."
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: iPhone text on UIImage not getting displayed on device.

2009-05-19 Thread David Duncan

On May 18, 2009, at 11:43 PM, Shraddha Karwan wrote:


CGContextSetRGBFillColor(context, 255, 255, 255, 1);



It may not be related to what is going wrong, but Quartz always uses  
normalized colors when specifying components, so this should really be  
1.0, 1.0, 1.0 instead of 255, 255, 255. Quartz will also clamp colors  
if appropriate, so these components are just getting clamped to 1.0  
anyway.

--
David Duncan
Apple DTS Animation and Printing

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: iPhone Generating and displaying images using Bitmap

2009-05-19 Thread David Duncan

On May 18, 2009, at 11:06 PM, Shraddha Karwan wrote:


Hi,

I get the following errors while displaying the JPEG buffered image.

: Corrupt JPEG data: 584 extraneous bytes before marker 0xc0
: Quantization table 0x00 was not defined

: Corrupt JPEG data: 446 extraneous bytes before marker 0xdb
: Bogus marker length
: CGImageCreate: invalid image size: 0 x 0.

What can be the cause for this error? Any ideas?



More than likely a bogus or corrupted JPEG file, just as the errors  
imply. Check that you can view the file in another viewer (say  
Preview) and that they are being transferred correctly.


If all that checks outs, then you probably want to make sure your even  
working with a JPEG (often non-technical people will rename files and  
expect that to change the file format - without outside assistance it  
doesn't). The file command will try to tell you what type of file you  
are really looking at.


If you've verified you have a valid JPEG, then the next step is  
probably to file a bug report.

--
David Duncan
Apple DTS Animation and Printing

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: When init returns nil does it cause a leak

2009-05-19 Thread Jesper Storm Bache

On May 19, 2009, at 10:58 AM, Quincey Morris wrote:

On May 19, 2009, at 09:32, Jesper Storm Bache wrote:


I personally disagree with the Apple recommendation, and I vote for
calling [super dealloc] when initialization fails - because this
will invoke dealloc only in the base classes where init succeeded.


First of all, in general, it can't work. If it were permissible to
write '[super dealloc]' anywhere other than in a dealloc method, you'd
have to be certain that there were no outstanding extra retains on the
object, and you can't know that. One of the "base" inits might have
done something that resulted in a retain/autorelease on the object,
for example.

Interesting & a valid point.
Such a use case definitely does *not* work with an explicit dealloc  
mechanism.




Second, in general, when an init method decides to fail, its object is
already partially initialized. So in addition to (hypothetically)
calling '[super dealloc]', it would also have to back out some
initializations, and it comes down to a choice between (a) adding code
to init to back out the initializations or (b) adding code to dealloc
to avoid doing anything dangerous on a partially-initialized object.


That is right. The issue I have with release is if you have a class  
hierarchy of three classes A<-B<-C and B fails, then you will get a  
dealloc call in C before C's init returned from [super init]. By  
calling dealloc on the super class you get C++ style behavior, where  
you only get destructor calls in instances where the init call  
succeeded. It is correct that this require implementing init in a way  
that provide proper clean up if a failure should occur.
The benefit we get from obj-c, is that we know that all ivars are set  
to 0, so we do get some kind of class hierarchy wide initialization  
before our initializers run.
If you use the [self release] method, then your canonical no-value  
must be 0 for all of your data types.


I can't find any documentation stating that retain/autorelease in  
initializers is bad, so following the Apple guide lines is the right  
way to go.
In the obj-c world we then have to implement classes to be able to  
handle a dealloc call before the initializer has completely executed.


Thanks for your comments.
Jesper



The problem with (a) is that it will duplicate -- multiple times if
there are multiple errors to detect -- some code that's already in
dealloc. The advantage of (b) is that it centralizes the knowledge of
how to handle un-initialization in dealloc. (In most cases, the only
backing out that needs to be done is releasing instance variables. As
far as that's concerned, [self dealloc] is safe without special-casing
anything.)


___

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/jsbache%40adobe.com

This email sent to jsba...@adobe.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 arch...@mail-archive.com


Re: When init returns nil does it cause a leak

2009-05-19 Thread Quincey Morris

On May 19, 2009, at 09:32, Jesper Storm Bache wrote:

I personally disagree with the Apple recommendation, and I vote for  
calling [super dealloc] when initialization fails - because this  
will invoke dealloc only in the base classes where init succeeded.


First of all, in general, it can't work. If it were permissible to  
write '[super dealloc]' anywhere other than in a dealloc method, you'd  
have to be certain that there were no outstanding extra retains on the  
object, and you can't know that. One of the "base" inits might have  
done something that resulted in a retain/autorelease on the object,  
for example.


Second, in general, when an init method decides to fail, its object is  
already partially initialized. So in addition to (hypothetically)  
calling '[super dealloc]', it would also have to back out some  
initializations, and it comes down to a choice between (a) adding code  
to init to back out the initializations or (b) adding code to dealloc  
to avoid doing anything dangerous on a partially-initialized object.


The problem with (a) is that it will duplicate -- multiple times if  
there are multiple errors to detect -- some code that's already in  
dealloc. The advantage of (b) is that it centralizes the knowledge of  
how to handle un-initialization in dealloc. (In most cases, the only  
backing out that needs to be done is releasing instance variables. As  
far as that's concerned, [self dealloc] is safe without special-casing  
anything.)



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Cocoa event handling in fullscreen

2009-05-19 Thread Christopher Hansen
Hello,

I'm writing a fullscreen game using Cocoa.  I need to intercept mouse and key 
events for my game's usage, but I'd also like to forward them on appropriately 
if my game code doesn't handle them specifically (e.g., adjusting volume, 
screen brightness, opening the CD/DVD ROM drive, Command-Q, etc.).

Since my game is fullscreen-only, I don't define any windows, I just subclass 
NSApplication.  I'm planning on providing event handling methods in my 
application (e.g., mouseDown, keyDown, etc.) and overriding sendEvent to call 
my application's methods for the event types that I'm interested in and falling 
back to [super sendEvent:anEvent]; otherwise.

The difficulty I'm having is what I do with key events, for instance, that are 
not needed specifically by my game code.  I've thought of either (a) returning 
a bool to indicate whether my game code used the event and using [super 
sendEvent:anEvent]; if it did not or (b) using [self nextResponder] to send it 
along.  The latter, of course, is consistent with the Cocoa event handling 
guide, but since I'm not using the standard Cocoa UI (windows, menus, etc.) 
with my fullscreen-only game, I'm not sure it's the right thing to do.


Any help would be appreciated.

Thanks,
Christopher



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: iPhone text on UIImage not getting displayed on device.

2009-05-19 Thread Luke the Hiesterman
Is this just a function you wrote? I'm guessing that's the problem.  
All drawing on iPhone should be done in the drawRect: method (declared  
in UIView.h). To put text in an image, you should either add another  
view on top of the image (a UILabel perhaps) or subclass UIImageView  
and add your text drawing in the drawRect: method.


Luke

On May 18, 2009, at 11:43 PM, Shraddha Karwan wrote:

I used the following function to add text on UIImage. I can display  
the text
on iPhone Simulator but its not getting displayed on the actual  
device. What

can be the cause?

CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef context = CGBitmapContextCreate(NULL, w, h, 8, 4 * w,
colorSpace, kCGImageAlphaPremultipliedFirst);

CGContextDrawImage(context, CGRectMake(0, 0, w, h), img.CGImage);
CGContextSetRGBFillColor(context, 0.0, 0.0, 1.0, 1);

char* text = (char *)[text1  
cStringUsingEncoding:NSASCIIStringEncoding];//

"05/05/09";
CGContextSelectFont(context, "Arial", 12, kCGEncodingMacRoman);
CGContextSetTextDrawingMode(context, kCGTextFill);
CGContextSetRGBFillColor(context, 255, 255, 255, 1);

 CGContextShowTextAtPoint(context, 4, 130, text, strlen(text));
 CGImageRef imageMasked = CGBitmapContextCreateImage(context);
CGContextRelease(context);
CGColorSpaceRelease(colorSpace);

 return [UIImage imageWithCGImage:imageMasked];
___

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/luketheh%40apple.com

This email sent to luket...@apple.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 arch...@mail-archive.com


Tools in App Bundles

2009-05-19 Thread Kevin LaCoste
Hey guys, quick question about storing a helper tool in an application
bundle.
Currently I have a tool that is launched via NSTask stored in the
"Contents/MacOS" folder of my bundle. When reading up on code signing I saw
this in the Code Signing Release Notes for Mac OS X v10.5 document:

"Do not put helper applications, plugins, and other separately signed code
into the Resources directory of a bundle. The Resources directory is
directly sealed to the main executable. Put plugins into the Plug-Ins
directory. Put helper tools into the executable directory. Put helper
applications (with their own bundles) into the support directory."

http://developer.apple.com/releasenotes/Security/RN-CodeSigning/

If I understand that correctly, my tool is in the correct place but I'm not
confident. Should it be in "Contents/MacOS" or should I add a
"Contents/Executable" folder?

Bonus question. Is the support directory referred to above the Application
Support folder or is this another additional, optional bundle directory?

Thanks for any clarification!

Kevin LaCoste
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


NSToolBar : Unable to add a seperator item in the toolBar

2009-05-19 Thread Arun
Hi,
I have an application in which i added 2 buttons and one search view in the
too bar. I need to insert a seperator in between search view and 2 buttons.
I have tried the following in my code. and it is not working. Any idea?

- (NSArray *) toolbarAllowedItemIdentifiers: (NSToolbar *) toolbar
{
return [NSArray arrayWithObjects:[NSString
stringWithString:serachIdentifier],
NSToolbarSeparatorItemIdentifier,
[NSString stringWithString:Button1ToolbarItemIdentifier],
[NSString stringWithString:Button2ToolbarItemIdentifier],
 nil];
}

- (NSArray *) toolbarDefaultItemIdentifiers: (NSToolbar *) toolbar
{
return [NSArray arrayWithObjects:searchIdentifier,
NSToolbarSeparatorItemIdentifier,
Button1ItemIdentifier,
Button2ItemIdentifier, nil];
}


Thanks
Arun KA
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: When init returns nil does it cause a leak

2009-05-19 Thread Jean-Daniel Dupas


Le 19 mai 09 à 18:24, Reza Farhad a écrit :


Hi all

we have an object that gets initialized like most other objects

-(id)init
{
self = [ super init ];
if ( self ){
...do something;
}
return self;
}

if [ super init ]  returns nil does this cause a leak, as the memory  
has already been created by calling alloc when trying to create the  
object


AnObject*object = [[ AnObject alloc ] init ];

I am sure the answer is simple but this suddenly stumbled me.

Thanks


The answer is in the Cocoa Fundamentals Guide > Cocoa Objects > Object  
Creation > Implementing Initializer


with a lots of other useful info.

http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/CocoaObjects.html



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: When init returns nil does it cause a leak

2009-05-19 Thread Jesper Storm Bache
Apple's take on this is that when an initializer fails, then it should  
call release on itself and return nil.
See: http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/ocAllocInit.html#/ 
/apple_ref/doc/uid/TP30001163-CH22-SW13


This means that if super returns nil, then your memory should already  
be deallocated.


I personally disagree with the Apple recommendation, and I vote for  
calling [super dealloc] when initialization fails - because this will  
invoke dealloc only in the base classes where init succeeded.
In any case, when nil is returned, you should expect that your storage  
may already have been deleted.


Jesper Storm Bache


On May 19, 2009, at 9:24 AM, Reza Farhad wrote:


Hi all

we have an object that gets initialized like most other objects

-(id)init
{
self = [ super init ];
if ( self ){
...do something;
}
return self;
}

if [ super init ]  returns nil does this cause a leak, as the memory
has already been created by calling alloc when trying to create the
object

AnObject*object = [[ AnObject alloc ] init ];

I am sure the answer is simple but this suddenly stumbled me.

Thanks

Reza








___

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/jsbache%40adobe.com

This email sent to jsba...@adobe.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 arch...@mail-archive.com


Re: Distinguish Pending Text from Committed Text

2009-05-19 Thread Gideon King
You can use the markedRange method and then remove it from the text  
range you are dealing with to get only the "committed" text.


Gideon


On Tue, May 19, 2009 at 9:48 AM, Dong Feng   
wrote:

When using an non-English input method, such as Japanese or Chinese,
the entered characters are first in a pending status (i.e. with an
underscore). Pressing the space key make those pending text converted
to the actual non-English characters. Pressing the Enter key make the
underscore beneath the letters disappear. Either way, the pending text
become committed.

I want to programmatically distinguish the committed text from the
pending one, in a NSTextField. [NSTextField stringValue] returns the
sum, not only the committed part. Is there any way to do so?



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


When init returns nil does it cause a leak

2009-05-19 Thread Reza Farhad

Hi all

we have an object that gets initialized like most other objects

-(id)init
{
self = [ super init ];
if ( self ){
...do something;
}
return self;
}

if [ super init ]  returns nil does this cause a leak, as the memory  
has already been created by calling alloc when trying to create the  
object


AnObject*object = [[ AnObject alloc ] init ];

I am sure the answer is simple but this suddenly stumbled me.

Thanks

Reza








___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Distinguish Pending Text from Committed Text

2009-05-19 Thread Michael Ash
On Tue, May 19, 2009 at 9:48 AM, Dong Feng  wrote:
> When using an non-English input method, such as Japanese or Chinese,
> the entered characters are first in a pending status (i.e. with an
> underscore). Pressing the space key make those pending text converted
> to the actual non-English characters. Pressing the Enter key make the
> underscore beneath the letters disappear. Either way, the pending text
> become committed.
>
> I want to programmatically distinguish the committed text from the
> pending one, in a NSTextField. [NSTextField stringValue] returns the
> sum, not only the committed part. Is there any way to do so?

Check out the NSTextInput protocol. NSTextView conforms to that
protocol, so if you get the field editor from your NSTextField, you
can use those methods. I believe that "marked" is what that protocol
calls what you are referring to as "pending", but I'm not 100% sure.

(Warning: I've never tried any of this.)

Mike
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: [ANN] KNAppGuide - an open source in-app tutorial framework

2009-05-19 Thread Mic Pringle
Hi Daniel,

The video is a great aid as it really shows what the framework is about.

I definitely think a web view is the way to go. You could even require
that anyone using the framework create their documentation using the
standard plug in/bundle format so that you could just provide the name
of the bundle and your framework would automatically be able to load
the content into the HUD window.

-Mic

2009/5/19 Daniel Kennett :
> Hi Mic,
>
> Thanks for your feedback. The framework does indeed highlight the UI with an
> animated red circle. I've gone ahead and put up a demo video on the
> framework's page so you can get a better feel for that it's like.
>
> I have been wondering about how to add styled content to guides, and I think
> a WebView is a good idea.
>
> Thanks,
>
> -- Daniel
>
> On 19 May 2009, at 14:19, Mic Pringle wrote:
>
>> Hi Daniel,
>>
>> This looks like a great idea.
>>
>> Having perused the page on your site (I can't test the framework at
>> the moment as I'm away from my Mac) it's not quite clear how the UI is
>> highlighted (is it done by actually drawing a red circle as shown in
>> the screenshots ?)
>>
>> I feel it would be much clearer if you had a video on there showing
>> your demo app ?
>>
>> Also, one recommendation is to use Webkit and render HTML in the pop
>> up rather than just text. It can be quite tiring on the eye's to read
>> paragraph after paragraph of plain text. Allowing the developer to
>> embed images or even videos (i.e. YouTube) would really enhance this
>> experience.
>>
>> -Mic
>>
>> 2009/5/19 Daniel Kennett :
>>>
>>> I'm pleased to announce the first release of KNAppGuide - an in-app
>>> tutorial
>>> framework inspired by Apple Guide of the System 7 era.
>>>
>>> The framework was written because, well, Apple Guide was awesome. The
>>> ability to guide your users through specific tasks in your application
>>> actually *IN* your application is wonderful, and gives a much better user
>>> experience than following a set of screenshots or whatever. KNAppGuide
>>> intends to being this idea into the modern world of Cocoa.
>>>
>>> More information, screenshots, demo app and code are located at:
>>> http://www.kennettnet.co.uk/code/knappguide/
>>>
>>> I'd really appreciate any feedback.
>
> ___
>
> 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/micpringle%40gmail.com
>
> This email sent to micprin...@gmail.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 arch...@mail-archive.com


Re: Capturing key events in a menu

2009-05-19 Thread Adam Warski

Hello,

On May 19, 2009, at 4:28 PM, Benjamin Stiglitz wrote:


When a menu is open the Menu Manager in HIToolbox handles incoming
events on its own. You be able to capture the events with an  
embedded

NSView, but I first need to ask the standard question: what are you
trying to achieve?


Well, I want to know what the user typed when a menu is open, so  
that I

can narrow the items displayed.


Something like the Spotlight for Help implementation, then? (That's  
the

search field in the Help menu in most apps in Leopard.)


Yes, something like that :) Only that they use a custom view I guess -  
maybe I should do that too, though it's more work, menus give you  
quite a lot for free.


How can I embed an NSView? I know I can do that for an NSMenuItem,  
but
then the menu item must have focus for the view to receive the  
events,

is it not so?


The thing to do would be to embed an NSSearchField in an NSMenuItem,  
and

have it receive focus when the menu is opened. As for filtering the
results, you'll need to replace the menu content with your own  
filtered

content, which is extremely tricky to do with the current Menu Manager
API.


Well, filtering content should be easy, using [menuItem setHidden:YES/ 
NO]. If only I could get the keys that were pressed.

But I like the idea of embedding a search field, thanks! :)


I’d suggest that you:
1) File a bug asking for API to simplify the implementation of this  
sort

  of menu,
2) file a bug asking for a sample app that shows how to implement this
  sort of menu,
3) think of another UI to use in the meantime.


Heh :) Yeah, it seems quite hard to do something non-standard with  
menus.


--
Thanks again,
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 arch...@mail-archive.com


Re: [ANN] KNAppGuide - an open source in-app tutorial framework

2009-05-19 Thread Daniel Kennett

Hi Mic,

Thanks for your feedback. The framework does indeed highlight the UI  
with an animated red circle. I've gone ahead and put up a demo video  
on the framework's page so you can get a better feel for that it's like.


I have been wondering about how to add styled content to guides, and I  
think a WebView is a good idea.


Thanks,

-- Daniel

On 19 May 2009, at 14:19, Mic Pringle wrote:


Hi Daniel,

This looks like a great idea.

Having perused the page on your site (I can't test the framework at
the moment as I'm away from my Mac) it's not quite clear how the UI is
highlighted (is it done by actually drawing a red circle as shown in
the screenshots ?)

I feel it would be much clearer if you had a video on there showing
your demo app ?

Also, one recommendation is to use Webkit and render HTML in the pop
up rather than just text. It can be quite tiring on the eye's to read
paragraph after paragraph of plain text. Allowing the developer to
embed images or even videos (i.e. YouTube) would really enhance this
experience.

-Mic

2009/5/19 Daniel Kennett :
I'm pleased to announce the first release of KNAppGuide - an in-app  
tutorial

framework inspired by Apple Guide of the System 7 era.

The framework was written because, well, Apple Guide was awesome. The
ability to guide your users through specific tasks in your  
application
actually *IN* your application is wonderful, and gives a much  
better user
experience than following a set of screenshots or whatever.  
KNAppGuide

intends to being this idea into the modern world of Cocoa.

More information, screenshots, demo app and code are located at:
http://www.kennettnet.co.uk/code/knappguide/

I'd really appreciate any feedback.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


[NSApp presentError:error] & Custom Icon ...

2009-05-19 Thread Mic Pringle
Hi,

Is it possible to use an icon other than the applications when using
[NSApp presentError:error] ?

I'm open to all suggestions.

Thanks

-Mic
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Capturing key events in a menu

2009-05-19 Thread Benjamin Stiglitz
>> When a menu is open the Menu Manager in HIToolbox handles incoming
>> events on its own. You be able to capture the events with an embedded
>> NSView, but I first need to ask the standard question: what are you
>> trying to achieve?
>
> Well, I want to know what the user typed when a menu is open, so that I 
> can narrow the items displayed.

Something like the Spotlight for Help implementation, then? (That's the
search field in the Help menu in most apps in Leopard.)

> How can I embed an NSView? I know I can do that for an NSMenuItem, but  
> then the menu item must have focus for the view to receive the events,  
> is it not so?

The thing to do would be to embed an NSSearchField in an NSMenuItem, and
have it receive focus when the menu is opened. As for filtering the
results, you'll need to replace the menu content with your own filtered
content, which is extremely tricky to do with the current Menu Manager
API.

I’d suggest that you:
1) File a bug asking for API to simplify the implementation of this sort
   of menu,
2) file a bug asking for a sample app that shows how to implement this
   sort of menu,
3) think of another UI to use in the meantime.

-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 arch...@mail-archive.com


Distinguish Pending Text from Committed Text

2009-05-19 Thread Dong Feng
When using an non-English input method, such as Japanese or Chinese,
the entered characters are first in a pending status (i.e. with an
underscore). Pressing the space key make those pending text converted
to the actual non-English characters. Pressing the Enter key make the
underscore beneath the letters disappear. Either way, the pending text
become committed.

I want to programmatically distinguish the committed text from the
pending one, in a NSTextField. [NSTextField stringValue] returns the
sum, not only the committed part. Is there any way to do so?
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: [ANN] KNAppGuide - an open source in-app tutorial framework

2009-05-19 Thread Mic Pringle
Hi Daniel,

This looks like a great idea.

Having perused the page on your site (I can't test the framework at
the moment as I'm away from my Mac) it's not quite clear how the UI is
highlighted (is it done by actually drawing a red circle as shown in
the screenshots ?)

I feel it would be much clearer if you had a video on there showing
your demo app ?

Also, one recommendation is to use Webkit and render HTML in the pop
up rather than just text. It can be quite tiring on the eye's to read
paragraph after paragraph of plain text. Allowing the developer to
embed images or even videos (i.e. YouTube) would really enhance this
experience.

-Mic

2009/5/19 Daniel Kennett :
> I'm pleased to announce the first release of KNAppGuide - an in-app tutorial
> framework inspired by Apple Guide of the System 7 era.
>
> The framework was written because, well, Apple Guide was awesome. The
> ability to guide your users through specific tasks in your application
> actually *IN* your application is wonderful, and gives a much better user
> experience than following a set of screenshots or whatever. KNAppGuide
> intends to being this idea into the modern world of Cocoa.
>
> More information, screenshots, demo app and code are located at:
> http://www.kennettnet.co.uk/code/knappguide/
>
> I'd really appreciate any feedback.
>
>  Thanks,
>
> -- Daniel
>
>  ___
>
>   dan...@kennettnet.co.uk
>   http://www.kennettnet.co.uk
>
> Please include previous messages in any reply you send.
>
>
>
> ___
>
> 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/micpringle%40gmail.com
>
> This email sent to micprin...@gmail.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 arch...@mail-archive.com


[ANN] KNAppGuide - an open source in-app tutorial framework

2009-05-19 Thread Daniel Kennett
I'm pleased to announce the first release of KNAppGuide - an in-app  
tutorial framework inspired by Apple Guide of the System 7 era.


The framework was written because, well, Apple Guide was awesome. The  
ability to guide your users through specific tasks in your application  
actually *IN* your application is wonderful, and gives a much better  
user experience than following a set of screenshots or whatever.  
KNAppGuide intends to being this idea into the modern world of Cocoa.


More information, screenshots, demo app and code are located at: 
http://www.kennettnet.co.uk/code/knappguide/

I'd really appreciate any feedback.

 Thanks,

-- Daniel

 ___

   dan...@kennettnet.co.uk
   http://www.kennettnet.co.uk

Please include previous messages in any reply you send.



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Slow scrolling after NSPopup implementation

2009-05-19 Thread Steven Hamilton

Ok. I'm still struggling with this.

My NSTableColumn is bound to an NSArrayController for content and  
content values. This works great. My custom controller has the  
following code in it to set the popup selection to display for each row.


- (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell  
forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row

{
if ([[tableColumn identifier] isEqualToString:@"transfer"])
{
		NSDictionary *transdic = [self.formattedTransactions  
objectAtIndex:row];

int index = [[transdic objectForKey:@"transfer"] intValue];
[aCell selectItemAtIndex:index];
}
}

This works great too.

However, in my setObjectValueForTableColumn method later on I need to  
access the selected object in the popup for the particular row. I  
can't fetch the NSPopButtonCell (dataCell) from the column as that  
only holds the last displayed value. I also can't bind selection of  
the column to a property as that slows everything down, and these  
tables may end up holding thousands of lines. Am I attempting the  
impossible here?

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Is there two streams with CFReadStreamRead happend in two threads?

2009-05-19 Thread Jean-Daniel Dupas


Le 19 mai 09 à 09:27, Chris Gardner a écrit :



Hi,

  Now I have created two threads and want to download files through  
the method below in each thread:




1. Create the stream using CFReadStreamCreateWithFTPURL()

2. Set up my callbacks wiht CFReadStreamSetClient()

3. Add it to the run-loop wiht CFReadStreamScheduleWithRunLoop()

4. Open the stream with CFRendStreamOpen()

5. Implement CFRunLoopRun()




Why do you create a second thread ? just schedule the both stream on  
the main thread and they will be downloaded simultaneously on the main  
thread. (And don't cross post)___


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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Is there two streams with CFReadStreamRead happend in two threads?

2009-05-19 Thread Chris Gardner

Hi,

   Now I have created two threads and want to download files through the method 
below in each thread:

 

1. Create the stream using CFReadStreamCreateWithFTPURL()

2. Set up my callbacks wiht CFReadStreamSetClient()

3. Add it to the run-loop wiht CFReadStreamScheduleWithRunLoop()

4. Open the stream with CFRendStreamOpen()

5. Implement CFRunLoopRun()

 

After done that, I should wait for the first file to be downloaded, then begin 
to download the second file.

 

So my question is ... can these two files download simultaneously in two 
threads?

 

If anyone know any idea, please tell me and I will apprecite for your help.

 

Best Regard.

Chris Wu

 

_
Show them the way! Add maps and directions to your party invites. 
http://www.microsoft.com/windows/windowslive/products/events.aspx
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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