IB plugins

2008-10-03 Thread Ken Tozier

Hi

I'm working my way through the IB plugin documentation and have hit a  
point where step 2 in under Configuring a Library Object Template  
bears no resemblance whatsoever to anything in the Xcode project or  
the IB files. What the heck are they referring to? And how do I adapt  
that to the actual files/views that are created in a new IB plugin  
project?


Documentation here: http://developer.apple.com/documentation/DeveloperTools/Conceptual/IBPlugInGuide/ThePlug-inObject/chapter_5_section_2.html#/ 
/apple_ref/doc/uid/TP40004323-CH10-SW2


Thanks for any help
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Newbie: Strange problem with NSTableView, check boxes and Core Data

2008-10-03 Thread Ken Ferry
Is your application by chance garbage collected?

Some of the underlying machinery that kicks in when scaling standard
interface elements has issues with garbage collection in Leopard.
This suggests that your checkbox is scaling down, which you probably
don't want it to do.  Try selecting the checkbox cell in interface
builder and change the 'Scaling' setting from Proportionally Down to
None.

-Ken

On Thu, Oct 2, 2008 at 11:30 AM, Jonathan Oddie [EMAIL PROTECTED] wrote:

 On Oct 2, 2008, at 11:55 AM, Corbin Dunn wrote:



 Thanks for the advice Corbin. Below is a long backtrace, but I am not
 sure it sheds much light on the problem. I will keep working at it but since
 I am moving house this week I may not get much done for a while...
 Jonathan


 This is an interesting backtrace. What image do you have set on the
 NSButtonCell in the tableView? Is it one of the predefined apple ones? If
 so, which one?

 It is possible this is a bug in the framework.


 Hi Corbin,
 The button cell is just the predefined check box cell from Interface
 Builder, which I dragged into the table column to replace the default text
 field cell -- I don't think I've even changed any attributes of it.
 Is this a strange design, to have a column of check boxes adjacent to a
 column of text fields? It seemed like the simplest way to make it work with
 bindings (binding the value of the check box column to the boolean
 attribute arrangedObjects.Enabled of the array controller).

 Jonathan





 corbin



 #0  0x90187e17 in objc_exception_throw
 #1  0x9433434a in -[NSObject doesNotRecognizeSelector:]
 #2  0x9433294c in ___forwarding___
 #3  0x94332a12 in __forwarding_prep_0___
 #4  0x95bdfa8c in -[CISampler _initWithImage:optionsList:]
 #5  0x95bdf888 in -[CISampler initWithImage:options:]
 #6  0x95bdf811 in -[CISampler initWithImage:]
 #7  0x95bdf727 in +[CISampler samplerWithImage:]
 #8  0x95c9f638 in -[CIFullButton outputImage]
 #9  0x91663e3a in -[NSObject(NSKeyValueCoding) valueForKey:]
 #10 0x95bdd530 in -[CIFilter valueForKey:]
 #11 0x95d984c1 in -[CIUIBundle1 buttonResultForResolutionData:]
 #12 0x95d962f1 in -[CIUIBundleBase
 renderResolutionData:toBitmap:width:height:bytesPerRow:]
 #13 0x95d92f83 in -[CIUIBundleBase dataForResolutionData:]
 #14 0x95d93a5e in -[CIUIBundleBase dataForPPI:]
 #15 0x95d8f516 in QSICreateElement
 #16 0x90c0b6b4 in CUIElement::Load
 #17 0x90bf53e3 in CUIRenderer::Draw1Piece
 #18 0x90bf7851 in CUIRenderer::Draw
 #19 0x94da43d2 in -[NSCoreUIImageRep draw]
 #20 0x94da430b in -[NSCoreUIImageRep
 _drawFromRect:toRect:operation:alpha:compositing:flipped:ignoreContext:]
 #21 0x94d9fd43 in -[NSImage drawInRect:fromRect:operation:fraction:]
 #22 0x951e50de in -[NSImage
 _drawMappingAlignmentRectToRect:withState:backgroundStyle:operation:fraction:flip:]
 #23 0x94da2fc7 in -[NSButtonCell drawImage:withFrame:inView:]
 #24 0x95112d97 in -[NSButtonCell
 _configureAndDrawImageWithRect:cellFrame:controlView:]
 #25 0x94d96c20 in -[NSButtonCell drawInteriorWithFrame:inView:]
 #26 0x94ddff19 in -[NSTableView
 _drawContentsAtRow:column:withCellFrame:]
 #27 0x94ddf37a in -[NSTableView drawRow:clipRect:]
 #28 0x94d847f4 in -[NSTableView drawRowIndexes:clipRect:]
 #29 0x94d832d8 in -[NSTableView drawRect:]
 #30 0x94e13864 in -[NSView _drawRect:clip:]
 #31 0x94e1235b in -[NSView
 _recursiveDisplayAllDirtyWithLockFocus:visRect:]
 #32 0x94e126f2 in -[NSView
 _recursiveDisplayAllDirtyWithLockFocus:visRect:]
 #33 0x94e10cb1 in -[NSView
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
 #34 0x94e11b0b in -[NSView
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
 #35 0x94e11b0b in -[NSView
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
 #36 0x94e11b0b in -[NSView
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
 #37 0x94e11b0b in -[NSView
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
 #38 0x94e11b0b in -[NSView
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
 #39 0x94e105f3 in -[NSThemeFrame
 _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
 #40 0x94e0d117 in -[NSView
 _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:]
 #41 0x94d4db77 in -[NSView displayIfNeeded]
 #42 0x94d4d725 in -[NSWindow displayIfNeeded]
 #43 0x94d4d548 in _handleWindowNeedsDisplay
 #44 0x942b19c2 in __CFRunLoopDoObservers
 #45 0x942b2d1c in CFRunLoopRunSpecific
 #46 0x942b3cf8 in CFRunLoopRunInMode
 #47 0x911fb480 in RunCurrentEventLoopInMode
 #48 0x911fb1d2 in ReceiveNextEventCommon
 #49 0x911fb10d in 

Re: NSWindowController retain count confusion

2008-10-03 Thread Uli Kusterer

On 30.09.2008, at 21:01, James Walker wrote:
However, I did solve my problem.  I neglected to mention that I'm  
working in a mostly Carbon app.  When I surrounded the alloc, init,  
and showWindow calls with a local autorelease pool, the problem went  
away and the NSWindowController gets deallocated without funny  
business.  I thought I had read that it was no longer necessary to  
set up my own autorelease pools.



 You probably already know that, but just in case:

1) Do not put an autorelease pool at the bottom of your event loop,  
i.e. into your 'main' function so it surrounds the event loop run  
call. All this will do is inhibit the 'NSAutoReleaseNoPool' error log  
messages. Since that all-encompassing pool would take up all objects  
where no pool existed, but would never be drained, you'd have the  
leaks without the leak warning message.


2) If you did your creation, destruction and testing in the same event  
handler (even if it spawns its own sub-event-loop to e.g. run the  
Cocoa window modally), then they'll all be in the same autorelease  
pool, so you'll get a false leak. It's perfectly common to e.g. have  
another autorelease pool inside a tight loop, to more frequently  
autorelease objects that aren't needed after an iteration anymore.  
Carbon creates its own pool in RAEL, but that won't be drained until  
the next event or could (as a performance optimization) be drained  
only every fifth event or so.


3) A common recommendation for progressive Carbon-to-Cocoa ports that  
still need RAEL or WNE at the moment is to create a Cocoa app, start  
it regularly using NSApplicationMain, and to call RAEL in - 
applicationDidFinishLaunching:. If you're calling ReceiveNextEvent()/ 
SendEventToEventTarget() or -nextEventMatchingMask/-sendEvent: in a  
tight loop at this spot, you might not get the autorelease pool, and  
all objects will accumulate in the pool set up by AppKit for - 
applicationDidFinishLaunching:, giving you a similar effect as #1.


 Any of these ring a bell with regard to your project?

Cheers,
-- Uli Kusterer
The Witnesses of TeachText are everywhere...
http://www.zathras.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 [EMAIL PROTECTED]


Re: Remove Duplicates in a NSArray

2008-10-03 Thread Uli Kusterer

On 01.10.2008, at 13:29, Rashmi Vyshnavi wrote:
Is there a way to remove dictionary item containing same values for  
a key

from a array of dictionaries?



 If you used an NSSet instead of an NSArray, you might get this  
automatically. Not sure whether the objects really have to be the  
same, or whether it suffices that they're equal regarding their  
values, but it might be worth a try.


Cheers,
-- Uli Kusterer
The Witnesses of TeachText are everywhere...
http://www.zathras.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 [EMAIL PROTECTED]


Re: IB plugins

2008-10-03 Thread Ken Tozier


On Oct 3, 2008, at 4:10 AM, Joey Hagedorn wrote:


Ken,

Step 2 of this section says: In the library window, select the  
Library  IB SDK group. This group contains a single entry, which is  
a library object template. It is referring to the Interface  
Builder Kit category of items (as opposed to, for example, the  
Cocoa or WebKit groups) in the Library window.


When I create a new IB project using Xcode, I can't see any files,  
groups, categories or resources labeled Interface Builder Kit. Which  
application should I be looking in? Xcode or InterfaceBuilder? If you  
create a new IB plugin at your end, do you see this Interface Builder  
Kit category? If not, which of the automatically generated files is  
it contained in?

___

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

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

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

This email sent to [EMAIL PROTECTED]


OK To ask iPhone Questions?

2008-10-03 Thread Andrew Lindesay

Hello;

Is it now legal to ask iPhone development questions here?

cheers.

___
Andrew Lindesay
www.lindesay.co.nz

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Complicated set of dynamic nested views

2008-10-03 Thread Graham Cox


On 3 Oct 2008, at 2:52 pm, Ken Tozier wrote:


Hi

I need to create an interface with collapsible views (much like  
those in InterfaceBuilder's inspector palette) and am having a  
hard time figuring out what exactly to use as the base in IB 3.0. In  
older versions of IB, there was a panel view which allowed for  
this stuff, but that appears to be gone in 3.0. What should I use?  
And how can I create a generic collapsible view widget?


I made a bunch of custom view classes for an earlier version of my  
app but it required writing over 70 individual custom views and  
eventually the complicated interactions between all these parts got  
away from me. I couldn't get the refreshing right in response to  
window resizing so I thought I'd take a crack at creating these  
custom views in IB.


I badly need a generic collapsible view that can contain any number  
of other views (again much like IB 3.0 Inspector palette)


Any links to example projects or tips greatly appreciated.



I won't claim it's a perfect implementation by any means, but I wrote  
a couple of classes that implement collapsible, stackable views that  
can be docked together within existing windows or in their own windows  
freely. You can place any subviews inside them you want and they're  
straightforward to customise.


http://apptree.net/dockables.htm

Hope it's useful, or maybe you can cannibalise the code.

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


Re: Core Data undo grouping

2008-10-03 Thread Mike Abdullah

I agree with Ben that this seems somewhat odd to do, but that said:

NSManagedObjectContext coalesces changes for registering with the undo  
manager, but NSUndoManager also performs its own grouping. - 
processPendingChanges just provides a means for forcing the MOC to  
register its changes when you want. You still need to close off the  
undo managers grouping to match. So do something like ths:


[MOC processPendingChanges];

usnigned undoGrouping = 0;
while ([[MOC undoManager] groupingLevel]  0)
{
[[MOC undoManager] closeUndoGrouping];
undoGrouping++;
}

while ([[MOC undoManager] groupingLevel]  undoGrouping)
{
[[MOC undoManager] beginUndoGrouping];
}

On 2 Oct 2008, at 22:16, Peter Sagerson wrote:

I'm using CoreData for some internal state management that sometimes  
requires an undo boundary in a specific place. In other words, I  
need something along these lines to work:



NSManagedObject *object = [self getObjectFromSomewhere];
NSManagedObjectContext *context = [object managedObjectContext];

[object setValue:@1 forKey:@attr];
[self forceUndoBoundaryInContext:context];
[object setValue:@2 forKey:@attr];
[context undo];

STAssertEqualObjects([object valueForKey:@attr], @1, @);


Based on the documentation, it seems clear that all I have to do to  
accomplish this is call processPendingChanges:



- (void)forceUndoBoundaryInContext:(NSManagedObjectContext *)context
{
   [context processPendingChanges];
}


But this does not work. I installed notification handlers for  
NSUndoManagerDidOpenUndoGroupNotification and  
NSUndoManagerWillCloseUndoGroupNotification and I can see that the  
group is not closed until I call undo. As a workaround, I've found  
that I can fiddle with the context's undo manager directly:



- (void)forceUndoBoundaryInContext:(NSManagedObjectContext *)context
{
   [context processPendingChanges];

   [[context undoManager] endUndoGrouping];
   [[context undoManager] beginUndoGrouping];
}


This works, but it seems kind of sneaky and underhanded and I'm not  
entirely comfortable with it. Is there a better way to do this? Does  
anyone else find this behavior inconsistent with the documentation  
for processPendingChanges?


Thanks
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: OK To ask iPhone Questions?

2008-10-03 Thread Roland King
not yet - the moderator's still waiting for guidance. Apart from that  
we've not actually seen the new NDA (well I haven't) and it's  
impossible to say whether there will be changes to the list structure.  
Until now you have to hang with the documentation (which is actually  
really good when you're forced to read it!)




On Oct 3, 2008, at 6:41 PM, Andrew Lindesay wrote:


Hello;

Is it now legal to ask iPhone development questions here?

cheers.

___
Andrew Lindesay
www.lindesay.co.nz

___

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/rols%40rols.org

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


External C function and duplicate symbol

2008-10-03 Thread Christian Giordano
Hi guys, I've few functions that I'm keeping on an external .h file.
If the header is included in more than a class I get duplicate symbol
error. I tried using #ifndef which I use on my C++ classes but didn't
bring any luck. I had a look to the various headers in the framework
and I saw they use the following sintax:

#define VEC_ZERO_2(a)   \
{   \
   (a)[0] = (a)[1] = 0.0;   \
}

Isn't there a way to achieve the same but having parameters and returns typed?


Thanks, chr
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: OK To ask iPhone Questions?

2008-10-03 Thread Gregory Weston

Andrew Lindesay wrote:


Hello;

Is it now legal to ask iPhone development questions here?


Apple wrote:

Developers will receive a new agreement without an NDA covering  
released software within a week or so.


Future tense. Aside from the fact that (as far as I know) we are  
still waiting to hear back from the moderators what *they've* heard  
about what's okay to discuss here, I'd say that until we get that  
promised new agreement the old one is still binding.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: External C function and duplicate symbol

2008-10-03 Thread Scott Andrew
What about using #pragma once at the top of the header file? The other  
solution is to move the functions to a C file and move just the  
function definitions to header files. I prefer the second for  
readability. I usually have a utils.c and a utils.h. I'm not a big fan  
of function implementations in header files.


Scott

On Oct 3, 2008, at 4:19 AM, Christian Giordano wrote:


Hi guys, I've few functions that I'm keeping on an external .h file.
If the header is included in more than a class I get duplicate symbol
error. I tried using #ifndef which I use on my C++ classes but didn't
bring any luck. I had a look to the various headers in the framework
and I saw they use the following sintax:

#define VEC_ZERO_2(a)   \
{   \
  (a)[0] = (a)[1] = 0.0;\
}

Isn't there a way to achieve the same but having parameters and  
returns typed?



Thanks, chr
___

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/scottandrew%40roadrunner.com

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: External C function and duplicate symbol

2008-10-03 Thread Brian Stern
It seems that what you want is an inline C function.  I don't think  
this is part of the C language standard but gcc seems to have its own  
method of doing this.  Just do a find on 'inline' in the Frameworks to  
see how it's done.   Look at CGBase.h for instance.



On Oct 3, 2008, at 8:32 AM, Scott Andrew wrote:

What about using #pragma once at the top of the header file? The  
other solution is to move the functions to a C file and move just  
the function definitions to header files. I prefer the second for  
readability. I usually have a utils.c and a utils.h. I'm not a big  
fan of function implementations in header files.


Scott

On Oct 3, 2008, at 4:19 AM, Christian Giordano wrote:


Hi guys, I've few functions that I'm keeping on an external .h file.
If the header is included in more than a class I get duplicate symbol
error. I tried using #ifndef which I use on my C++ classes but didn't
bring any luck. I had a look to the various headers in the framework
and I saw they use the following sintax:

#define VEC_ZERO_2(a)   \
{   \
 (a)[0] = (a)[1] = 0.0; \
}

Isn't there a way to achieve the same but having parameters and  
returns typed?



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: External C function and duplicate symbol

2008-10-03 Thread Patrick Mau

Hi Christian

If you really want a function to appear in multiple object files
you could declare them static, like in:

static void vec_zero2(int *vect)
{
vec[0] = vec[1] = 0;
}

This is sometimes useful if you want to inline small functions
and not use preprocessor macros like this:

static inline char *code_long(char *dst, u_int32_t in)
{
dst[0] = (in  24)  0xff; // '' for readability only
dst[1] = (in  16)  0xff;
dst[2] = (in   8)  0xff;
dst[3] = (in   0)  0xff; // '' for readability only

return dst;
}

This works also mixing C and Obj-C:

static void callSomething(id myObject, int x, y)
{
[myObject withX:x andY:y];
	[myObject setTitle:[NSString stringWithFormat:@Position: %d,%d, x,  
y]];

}

Of course this will increase your code size if you are not considering
the size of your static functions. 'otool' or the assembler listing  
within

XCode is useful to look at the generated code.

Everything else should be declared 'extern' and implemented in one
source file only. That's only my opinion, of course.

Regards,
Patrick

On 03.10.2008, at 13:19, Christian Giordano wrote:


Hi guys, I've few functions that I'm keeping on an external .h file.
If the header is included in more than a class I get duplicate symbol
error. I tried using #ifndef which I use on my C++ classes but didn't
bring any luck. I had a look to the various headers in the framework
and I saw they use the following sintax:

#define VEC_ZERO_2(a)   \
{   \
  (a)[0] = (a)[1] = 0.0;\
}

Isn't there a way to achieve the same but having parameters and  
returns typed?



Thanks, chr


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Security - Write to protected directory

2008-10-03 Thread Michael Ash
On Fri, Oct 3, 2008 at 12:46 AM, Kelly Graus [EMAIL PROTECTED] wrote:

 On Oct 2, 2008, at 6:23 PM, Nick Zitzmann wrote:


 On Oct 2, 2008, at 1:30 PM, Kelly Graus wrote:

 Is the only way to allow a user to write to a protected location use the
 AuthorizationExecuteWithPrivileges function?

 Yes. AEWP() is most certainly not deprecated.

 Ok, I will look into using that.



 If so, is there a way to tell when the application has quit, and get the
 exit code?

 Yes. (Hint: Look at the man page for the wait() function.)

 I looked at the wait function, I just couldn't figure out how to get the pid
 of the started application.  Is there a way to get the pid without
 cooperation of the started application (ie, some sort of IPC between the two
 applications).  I'm very new coding for OS X (and Unix based systems in
 general), so any details would be very appreciated!

Nope! AEWP is a rather broken API in more ways than one. One of the
ways that it's broken is that it is *impossible* to correctly use it
without a subprocess which will cooperate with you. The reason for
this is that you *must* use wait4 or waitpid to reap the zombie that
will be created when the subprocess terminates, but AEWP provides *no*
way to get the pid. (You cannot use wait or wait3 because those could
end up inadvertently reaping a child process spawned by a library
you're using.) So your subprocess must have a way to communicate its
pid back to the parent, and do so very early before it does anything
that could make it crash or otherwise terminate.

Correct use of AEWP is extremely weird and un-fun. I definitely
recommend finding some of Apple's sample code on the subject, and then
adapting it to do what you need, rather than trying to figure out how
to use it on your own. In particular, the BetterAuthorizationSample,
while probably not doing what you need, is full of useful commentary
on how it works and how it gets around the various problems with the
AEWP API:

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

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


Re: Newbie: Strange problem with NSTableView, check boxes and Core Data

2008-10-03 Thread Jonathan Oddie


Message: 8
Date: Fri, 3 Oct 2008 01:09:48 -0700
From: Ken Ferry [EMAIL PROTECTED]
Subject: Re: Newbie: Strange problem with NSTableView,  check boxes and
Core Data
To: Jonathan Oddie [EMAIL PROTECTED]
Cc: cocoa-dev@lists.apple.com
Message-ID:
[EMAIL PROTECTED]
Content-Type: text/plain; charset=ISO-8859-1

Is your application by chance garbage collected?

Some of the underlying machinery that kicks in when scaling standard
interface elements has issues with garbage collection in Leopard.
This suggests that your checkbox is scaling down, which you probably
don't want it to do.  Try selecting the checkbox cell in interface
builder and change the 'Scaling' setting from Proportionally Down to
None.

-Ken


Yes, it is GC, and I'm pretty sure that fixed it ... at least I  
haven't been able to repeat the crash since changing it. What a  
strange bug, is it documented in a technote somewhere?

Many thanks for the fix, anyway!
Jonathan

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Play Playlist in iTunes

2008-10-03 Thread has

Michael Ash wrote:


On Thu, Oct 2, 2008 at 9:52 PM, Mr. Gecko  wrote:

I know but I can't find out the AppleEvent for Play Playlist.
Is there some sort of a program that will parse the AppleScript and  
make an

cocoa AppleEvent code.


If you just want the raw four-char-codes from an application's  
dictionary so you can construct NSAppleEventDescriptors yourself, you  
can obtain them in various ways: ASDictionary (on the appscript site)  
can export raw application dictionaries as fairly readable UTF8 files;  
Late Night Software's Script Debugger provides a very nice GUI that  
can extract and display just about anything you can think of; OS X's  
Script Editor or sdef tool can dump out application dictionaries in  
raw XML format.




Not quite, but you can get pretty close. Go to the section titled An
Example on this page:

http://www.cocoadev.com/index.pl?AEVTBuilder

It shows how to make Script Editor dump the Apple Events it's sending,
and then how to translate this into code.



FWIW, the approach that ASTranslate uses is to install a custom  
AESendProc into an AppleScript component and have the user run an  
AppleScript. Any events sent by the script are intercepted by the  
custom callback, which pulls the event apart and formats its  
constituent parts as Python/Ruby/ObjC-style code; no manual  
translation required. Pretty easy to do if you're interested in  
providing a similar converter for AEVTBuilder; you could probably hack  
one from its existing ObjC translator if you know any Python.


HTH

has
--
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Newbie: Strange problem with NSTableView, check boxes and Core Data

2008-10-03 Thread Corbin Dunn


On Oct 2, 2008, at 11:30 AM, Jonathan Oddie wrote:



On Oct 2, 2008, at 11:55 AM, Corbin Dunn wrote:





Thanks for the advice Corbin. Below is a long backtrace, but I am  
not sure it sheds much light on the problem. I will keep working  
at it but since I am moving house this week I may not get much  
done for a while...

Jonathan



This is an interesting backtrace. What image do you have set on the  
NSButtonCell in the tableView? Is it one of the predefined apple  
ones? If so, which one?


It is possible this is a bug in the framework.



Hi Corbin,
The button cell is just the predefined check box cell from Interface  
Builder, which I dragged into the table column to replace the  
default text field cell -- I don't think I've even changed any  
attributes of it.
Is this a strange design, to have a column of check boxes adjacent  
to a column of text fields? It seemed like the simplest way to make  
it work with bindings (binding the value of the check box column  
to the boolean attribute arrangedObjects.Enabled of the array  
controller).




If possible, can you send me your app (with source code), or an  
isolated version of it that reproduces this? It shouldn't do this, and  
what you are doing should work fine.


Also see Ken's message about GC.

-corbin


___

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

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

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

This email sent to [EMAIL PROTECTED]


NSURLConnection and HTTPS

2008-10-03 Thread dexter morgan
Hello I'm using NSURLConnection in order to download some pages. All
works fine until I try to load an HTTPS page.
This is an example:
https://www.wireless.att.com/olam/loginAction.olamexecute
It return a differ page (not the same viewed into Safari).
I think there is a problem accepting certificates of this page.
Searching inside the list I've found this code:
[_request setAllowsAnyHTTPSCertificate:YES forHost: [_url host]];

It's a private API. Unfortunatly the message is too old (2005) and at
this time this method seems to be removed.
Anyone can point me to a solution?
TIA
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Newbie: Simple display with NSView - problem

2008-10-03 Thread Genu Mathew
Graham,

Thank you for the reply. Is there any placeholder for the custom view that I 
can use in the NIB file such that I can instantiate the view in the code and 
then load it onto the window? 

I can not hard code the filename into the custom view class and use it in the 
NIB as the image to be displayed will not always be the same and it can change 
depending on where the user will click on the main window.

Thanks,
Genu


--- On Wed, 10/1/08, Graham Cox [EMAIL PROTECTED] wrote:

 From: Graham Cox [EMAIL PROTECTED]
 Subject: Re: Newbie: Simple display with NSView - problem
 To: [EMAIL PROTECTED]
 Cc: Cocoa-dev@lists.apple.com
 Date: Wednesday, October 1, 2008, 6:42 PM
 On 2 Oct 2008, at 5:02 am, Genu Mathew wrote:
 
  On debugging, I found that when I run the command
 [NewWindow  
  showWindow:self] in the APPController class, the
 constructor of  
  'OUSubImageView is called twice
 
 
 
 Sounds like you have one view instantiated in the nib and
 another one  
 instantiated in code. Do one or the other, but not both.
 
 If you set up your custom view in the nib, there's no
 need to init  
 another one - it already exists. Objects in nibs are real
 objects,  
 they are not placeholders for objects you create at
 runtime.
 
 hth,
 
 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 [EMAIL PROTECTED]


Re: IB plugins

2008-10-03 Thread Randall Meadows

On Oct 3, 2008, at 2:54 AM, Ken Tozier wrote:


On Oct 3, 2008, at 4:10 AM, Joey Hagedorn wrote:

Step 2 of this section says: In the library window, select the  
Library  IB SDK group. This group contains a single entry, which  
is a library object template. It is referring to the Interface  
Builder Kit category of items (as opposed to, for example, the  
Cocoa or WebKit groups) in the Library window.


When I create a new IB project using Xcode, I can't see any files,  
groups, categories or resources labeled Interface Builder Kit.  
Which application should I be looking in? Xcode or InterfaceBuilder?  
If you create a new IB plugin at your end, do you see this  
Interface Builder Kit category? If not, which of the automatically  
generated files is it contained in?


In IB, in the Library panel; in the top pane, select Library- 
Interface Builder Kit, then you'll see the one item in that group in  
the bottom pane, Library Template (AKA IBLIbraryObjectTemplate).


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Newbie: Simple display with NSView - problem

2008-10-03 Thread Genu Mathew
Thanks, I will check it out and also change the name.

Genu


--- On Wed, 10/1/08, Jonathan del Strother [EMAIL PROTECTED] wrote:

 From: Jonathan del Strother [EMAIL PROTECTED]
 Subject: Re: Newbie: Simple display with NSView - problem
 To: [EMAIL PROTECTED]
 Cc: Graham Cox [EMAIL PROTECTED], Cocoa-dev@lists.apple.com
 Date: Wednesday, October 1, 2008, 6:47 PM
 On Thu, Oct 2, 2008 at 12:42 AM, Graham Cox
 [EMAIL PROTECTED] wrote:
 
  On 2 Oct 2008, at 5:02 am, Genu Mathew wrote:
 
  On debugging, I found that when I run the command
 [NewWindow
  showWindow:self] in the APPController class, the
 constructor of
  'OUSubImageView is called twice
 
 
 
  Sounds like you have one view instantiated in the nib
 and another one
  instantiated in code. Do one or the other, but not
 both.
 
  If you set up your custom view in the nib, there's
 no need to init another
  one - it already exists. Objects in nibs are real
 objects, they are not
  placeholders for objects you create at runtime.
 
 
 Also, I suspect that JPEGImage is nil.  I'm guessing
 that the line in
 ssetImage that reads:
 [JPEGImage initWithContentsOfFile:imageFileImage];
 should actually be:
 JPEGImage = [[NSImage alloc]
 initWithContentsOfFile:imageFileImage];
 
 (While we're here, JPEGImage sounds like a class - the
 instance
 variable would usually be called jpegImage)


  
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSURLConnection and HTTPS

2008-10-03 Thread Timothy Wood


On Oct 3, 2008, at 8:17 AM, dexter morgan wrote:

Searching inside the list I've found this code:
[_request setAllowsAnyHTTPSCertificate:YES forHost: [_url host]];

It's a private API. Unfortunatly the message is too old (2005) and at
this time this method seems to be removed.
Anyone can point me to a solution?


  It's actually a class method on NSURLRequest (now at least -- don't  
know about in 2005).  We, and everyone else under the sun are using  
it, so you should log a Radar to help encourage Apple to make this API  
public or otherwise add hooks for managing certs on NSURLConnection.


-tim

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Play Playlist in iTunes

2008-10-03 Thread Mr. Gecko


On Oct 3, 2008, at 10:10 AM, has wrote:


Michael Ash wrote:


On Thu, Oct 2, 2008 at 9:52 PM, Mr. Gecko  wrote:

I know but I can't find out the AppleEvent for Play Playlist.
Is there some sort of a program that will parse the AppleScript  
and make an

cocoa AppleEvent code.


If you just want the raw four-char-codes from an application's  
dictionary so you can construct NSAppleEventDescriptors yourself,  
you can obtain them in various ways: ASDictionary (on the appscript  
site) can export raw application dictionaries as fairly readable  
UTF8 files; Late Night Software's Script Debugger provides a very  
nice GUI that can extract and display just about anything you can  
think of; OS X's Script Editor or sdef tool can dump out application  
dictionaries in raw XML format.
I already looked at that but it doesn't have an actual code for Play  
Playlist
I found this though class name=playlist code=cPly description=a  
list of songs/streams inherits=item plural=playlists which if  
you look at the output of AEDebugSends than you can see that that is  
called when running the play playlist command.



Not quite, but you can get pretty close. Go to the section titled An
Example on this page:

http://www.cocoadev.com/index.pl?AEVTBuilder

It shows how to make Script Editor dump the Apple Events it's  
sending,

and then how to translate this into code.



FWIW, the approach that ASTranslate uses is to install a custom  
AESendProc into an AppleScript component and have the user run an  
AppleScript. Any events sent by the script are intercepted by the  
custom callback, which pulls the event apart and formats its  
constituent parts as Python/Ruby/ObjC-style code; no manual  
translation required. Pretty easy to do if you're interested in  
providing a similar converter for AEVTBuilder; you could probably  
hack one from its existing ObjC translator if you know any Python.

I am using that at the moment until I edit EyeTunes to do it for me.
NSAppleEventDescriptor *descriptor = [AEVT class:'hook' id:'Play'  
target:[self applicationProcess:@com.apple.iTunes],


[KEY : ''], [RECORD : 'obj ',

[KEY : 'form'], [ENUM : 'name'],

[KEY : 'want'], [TYPE : 'cPly'],

[KEY : 'seld'], [STRING : [playlist objectForKey:@Name]],

[KEY : 'from'], [DESC null],

ENDRECORD],

ENDRECORD];
[descriptor sendWithImmediateReply];

HTH

has
--
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net



___

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

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

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

This email sent to [EMAIL PROTECTED]


[OT] Core Animation is it up to the challenge

2008-10-03 Thread development2

This is off topic, just want to get some peoples opinion on this.

I have been asked to port a game from Flash to the Mac (actually the  
iPhone, but that does not matter in this case). I am wondering if Core  
Animation is up to the task, of display and moving 30-50 units on the  
screen at one time, along with missiles and such. So possibly upwards  
of 70-100 items moving on the screen at once. The original developers  
are very concerned that Core Animation is not up to the task, when I  
mentioned that Core Animation would be the way to go. Does anyone have  
any experience with Core Animation and games? And what kind of results  
do yoy get with lots of items moving within Core Animation layers at  
one time?


Please answer off list so we don't clog up the list please.

Thanks,
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Core Data undo grouping

2008-10-03 Thread Peter Sagerson

[object setValue:@1 forKey:@attr];
[self forceUndoBoundaryInContext:context];
[object setValue:@2 forKey:@attr];


This is a little odd.  If this is in the UI thread, it will be  
confusing to the user in the typical scenarios.  Are you sure you  
don't want to create a nested undo group ?


This is actually pretty far removed from the UI. I'm managing internal  
state that I want to be able to roll back to specific points. A single  
rollback group may span many events. Imagine a stack of mutable  
dictionaries, each one of which starts out as a copy of the one  
before. Except with a managed object model, I can have complex,  
documented structures and I don't have to worry about making deep  
copies of nested mutable objects.


Fiddling with the undo groupings themselves should be done with  
NSUndoManager API.


That's what I ended up doing, so I guess I was on the right track.

Thanks for the quick reply,
Peter
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: IB plugins

2008-10-03 Thread Joey Hagedorn

Ken,

Step 2 of this section says: In the library window, select the  
Library  IB SDK group. This group contains a single entry, which is a  
library object template. It is referring to the Interface Builder  
Kit category of items (as opposed to, for example, the Cocoa or  
WebKit groups) in the Library window. When you select the Interface  
Builder Kit category at the top of the Library window, there is only a  
single item available, and its icon is a set of books. Drag this  
object, the library object template, to the library view you are  
creating. It will appear simply as a white box. You can then follow  
the subsequent instructions to configure it, by placing a custom view  
inside the the library object template, for example.


The Library nib file that is created with the project already has two  
library object templates in it, you could just delete everything and  
start over, or reuse these existing ones.


Hope that helps,
Joey Hagedorn


On Oct 3, 2008, at 12:22 AM, Ken Tozier wrote:


Hi

I'm working my way through the IB plugin documentation and have hit  
a point where step 2 in under Configuring a Library Object  
Template bears no resemblance whatsoever to anything in the Xcode  
project or the IB files. What the heck are they referring to? And  
how do I adapt that to the actual files/views that are created in a  
new IB plugin project?


Documentation here: http://developer.apple.com/documentation/DeveloperTools/Conceptual/IBPlugInGuide/ThePlug-inObject/chapter_5_section_2.html#/ 
/apple_ref/doc/uid/TP40004323-CH10-SW2


Thanks for any help

___

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

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

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

This email sent to [EMAIL PROTECTED]


Getting reference to a window

2008-10-03 Thread Cocoader

Hi there,

My NSDocument 'HF_Browser' works with a window in a XIB file. From  
within this HF_Browser.m file I can get a reference to the window, set  
it's title, etc.


In MainMenu.xib I have a menu command, 'Jump To' (invoked with Cmd-J).  
I dragged an Object object into MainMenu.xid and set it to HF_Browser  
then connected the Jump To menu command to it, to an IBAction in  
HF_Browser.m.


When I hit Cmd-J my method- (IBAction)MenuJumpTo:(id)sender is called  
perfectly but within this method I can't get any reference to the  
window at all. Can you please advise?


--
Paul Harvey
Hiddenfield Software
www.hiddenfield.com

___

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

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

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

This email sent to [EMAIL PROTECTED]


Write app without nib file.

2008-10-03 Thread Daniele Basile

Hi,
I want to write an application without using a nib file.
I found same code that do this and it works, but I am not able to manage
event. For exactly I want to trap some event (tablet event) and manage  
this.

So, I write this code:

- main.m -
import Cocoa/Cocoa.h
#import myView.h

int main(int argc, const char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSWindow *window;
myView *view;
view = [[myView alloc] initWithFrame:NSMakeRect(0,100,200,200) ];

window = [[NSWindow alloc]  
initWithContentRect:NSMakeRect(50,100,200,300)

 styleMask:NSTitledWindowMask | 
NSResizableWindowMask
   backing:NSBackingStoreBuffered
 defer:TRUE];


NSButton *button=[[NSButton  
alloc]initWithFrame:NSMakeRect(10,10,180,32) ];

[button setBezelStyle:NSRoundedBezelStyle];
[button setTitle:@Quit];
[button setTarget:NSApp];
[button setAction:@selector(terminate:)];

[[window contentView] addSubview:button];

[NSApplication sharedApplication];
[window makeKeyAndOrderFront: nil];
[pool release];

[NSApp run];
return 0;
}
 ---
- myView.h --
#import Cocoa/Cocoa.h

@interface myView : NSView
{
}
- (id)initWithFrame:(NSRect)frame;
- (BOOL)acceptsFirstResponder;
- (void)tabletProximity:(NSEvent *)theEvent;
@end
 ---

- myView.m --
#import myView.h

@implementation myView
- (id)initWithFrame:(NSRect)frame {
self = [super initWithFrame:frame];
if (self) {
printf(Parto..\n);
}
return self;
}

- (BOOL)acceptsFirstResponder
{
return YES;
}
- (void)tabletProximity:(NSEvent *)theEvent
{
printf(prossimita'\n);
if([theEvent isEnteringProximity])
{
printf(Entro\n);
printf(capabilityMask(%d)\n, [theEvent capabilityMask]);
printf(deviceID(%d)\n, [theEvent deviceID]);
printf(enterProximity(%d)\n, [theEvent isEnteringProximity]);
printf(pointerID(%d)\n, [theEvent pointingDeviceID]);
		printf(pointerSerialNumber(%d)\n, [theEvent  
pointingDeviceSerialNumber]);

printf(pointerType(%d)\n, [theEvent pointingDeviceType]);
printf(systemTabletID(%d)\n, [theEvent systemTabletID]);
printf(tabletID(%d)\n, [theEvent tabletID]);
printf(uniqueID(%d)\n, [theEvent uniqueID]);
printf(vendorID(%d)\n, [theEvent vendorID]);
printf(vendorPointerType(%d)\n, [theEvent  
vendorPointingDeviceType]);

}
else
{
printf(Esco\n);}

}
@end
--

This code draw a window with one button that, I press it, the program  
quit.
I see the window and button work, but the myView class seem not  
receive the windows events..


Have any idea for this?

Thanks
Daniele.

--
|  [D]-o Ing. Daniele Basile - [EMAIL PROTECTED]
|   ||}-o  Develer S.r.l., RD dept.
|  [B]-o  http://www.develer.com - http://www.bertos.org






___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [OT] Core Animation is it up to the challenge

2008-10-03 Thread Matt Long
Someone correct me if I'm wrong, but this is completely *on*-topic.  
Core Animation, it's capabilities and limitations are very pertinent.  
I don't know the answer to your question, but I certainly think it's  
on-topic. I would like to know the answers you get, myself. Then  
again, maybe you want it off-list as you would like to discuss that  
other platform. ;-)


Meanwhile, have you seen Scott Stevenson's NanoLife application? http://theocacao.com/document.page/555 
 . It seems to run very well and there are many objects moving around  
the screen at once. Of course your mileage is likely to vary on that  
other platform that we will soon be able to talk about.


Also, there is a lot you can do with Core Animation layers including  
OpenGL. Take a look at CAOpenGLLayer for more information on that.  
Whether it's available on that other platform will also be something  
you'll have to investigate yourself.


-Matt


On Oct 3, 2008, at 11:32 AM, development2 wrote:


This is off topic, just want to get some peoples opinion on this.

I have been asked to port a game from Flash to the Mac (actually the  
iPhone, but that does not matter in this case). I am wondering if  
Core Animation is up to the task, of display and moving 30-50 units  
on the screen at one time, along with missiles and such. So possibly  
upwards of 70-100 items moving on the screen at once. The original  
developers are very concerned that Core Animation is not up to the  
task, when I mentioned that Core Animation would be the way to go.  
Does anyone have any experience with Core Animation and games? And  
what kind of results do yoy get with lots of items moving within  
Core Animation layers at one time?


Please answer off list so we don't clog up the list please.

Thanks,

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Getting reference to a window

2008-10-03 Thread I. Savant
On Fri, Oct 3, 2008 at 9:57 AM, Cocoader [EMAIL PROTECTED] wrote:

 My NSDocument 'HF_Browser' works with a window in a XIB file. From within
 this HF_Browser.m file I can get a reference to the window, set it's title,
 etc.

  Yes, because the File's Owner of that xib instance is your
HF_Browser and its connections are restored when a new document is
instantiated (and a new copy of your XIB's object graph is
'awakened').

 In MainMenu.xib I have a menu command, 'Jump To' (invoked with Cmd-J). I
 dragged an Object object into MainMenu.xid and set it to HF_Browser then
 connected the Jump To menu command to it, to an IBAction in HF_Browser.m.

  Why do you do this? You're only creating an instance of your
document object (without allowing Cocoa to open a copy of the xib and
restore connections). All you have is a lone instance of your
NSDocument subclass.

  Re-read this document:

http://developer.apple.com/documentation/Cocoa/Conceptual/Documents/Documents.html#//apple_ref/doc/uid/1006

  See below for the right way to do this.

 When I hit Cmd-J my method- (IBAction)MenuJumpTo:(id)sender is called
 perfectly but within this method I can't get any reference to the window at
 all. Can you please advise?

  Your code is called because you have a valid instance of your
document subclass. Because it was not correctly created by Cocoa's
document machinery, none of its outlets (including window) are
connected to anything.

  If you want your main menu to be able to send messages to a
document, you need to connect their actions to the First Responder
icon within your xib. The front-most document will be the first
responder to that message so it'll receive it. Read this for more
information:

http://developer.apple.com/documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/chapter_2_section_6.html#

--
I.S.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Getting reference to a window

2008-10-03 Thread Shawn Erickson
On Fri, Oct 3, 2008 at 6:57 AM, Cocoader [EMAIL PROTECTED] wrote:
 Hi there,

 My NSDocument 'HF_Browser' works with a window in a XIB file. From within
 this HF_Browser.m file I can get a reference to the window, set it's title,
 etc.

At runtime the framework (or code of your own) creates an HF_Browser
instance making it the owner of the xib file that contains the window
you describe. This instance is hooked up with the window, etc.
allowing it to message the UI.

 In MainMenu.xib I have a menu command, 'Jump To' (invoked with Cmd-J). I
 dragged an Object object into MainMenu.xid and set it to HF_Browser then
 connected the Jump To menu command to it, to an IBAction in HF_Browser.m.

By dragging an object into your MainMenu xib you are creating an
object instance (in this case an instance of HF_Browser). Then you
connect a menu item with that instance. At runtime when your MainMenu
xib is load an instance of HF_Browser is unarchived, one not
associated with any document and having no ownership of the xib
containing the window it is meant to manage.

 When I hit Cmd-J my method- (IBAction)MenuJumpTo:(id)sender is called
 perfectly but within this method I can't get any reference to the window at
 all.

Yup because the instance you created is not associated with any window
or document.

 Can you please advise?

Don't try to connect your menu item that way and remove the HF_Browers
instance you created in your main menu xib.

Review the concept of the responder chain since it existing for
exactly this type of situation...

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

-Shawn
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [OT] Core Animation is it up to the challenge

2008-10-03 Thread development2

Hi Matt,
Thanks for your reply. I completely that example on theocacao. It is  
a very good example of what I want to do (in a sense.). But anyway  
part of my reluctance to discuss on list was the fact that I mentioned  
that which must not be named, but also did not want to clog up the  
lit with this.


Yeah I know about Core Animation layers and such, and that is exactly  
how I would do it, but i was not sure how it handled that many layers  
at once. As Scott Stevenson shows it handles 80+ layers at once with  
no problem. Of course on my Dual Quad core no, problem, but on that  
which must not be named, I am sure that this would be different.


Also thanks for you blog Cocoa is my Girlfriend I never miss it. :)

I will also let you know if I find more out about this subject and its  
capabilities.



On Oct 3, 2008, at 11:53 AM, Matt Long wrote:

Someone correct me if I'm wrong, but this is completely *on*-topic.  
Core Animation, it's capabilities and limitations are very  
pertinent. I don't know the answer to your question, but I certainly  
think it's on-topic. I would like to know the answers you get,  
myself. Then again, maybe you want it off-list as you would like to  
discuss that other platform. ;-)


Meanwhile, have you seen Scott Stevenson's NanoLife application? http://theocacao.com/document.page/555 
 . It seems to run very well and there are many objects moving  
around the screen at once. Of course your mileage is likely to vary  
on that other platform that we will soon be able to talk about.


Also, there is a lot you can do with Core Animation layers including  
OpenGL. Take a look at CAOpenGLLayer for more information on that.  
Whether it's available on that other platform will also be something  
you'll have to investigate yourself.


-Matt


On Oct 3, 2008, at 11:32 AM, development2 wrote:


This is off topic, just want to get some peoples opinion on this.

I have been asked to port a game from Flash to the Mac (actually  
the iPhone, but that does not matter in this case). I am wondering  
if Core Animation is up to the task, of display and moving 30-50  
units on the screen at one time, along with missiles and such. So  
possibly upwards of 70-100 items moving on the screen at once. The  
original developers are very concerned that Core Animation is not  
up to the task, when I mentioned that Core Animation would be the  
way to go. Does anyone have any experience with Core Animation and  
games? And what kind of results do yoy get with lots of items  
moving within Core Animation layers at one time?


Please answer off list so we don't clog up the list please.

Thanks,

___

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

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

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

This email sent to [EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: -[NSScanner scanUpToString:stopString:NULL] - 10.3.9 Crash, due Xcode 3.1?

2008-10-03 Thread Jerry Krinock
As far as I can see, this is another symptom of a bug which I found  
back in March 2008 in Mac OS 10.3.


The bug is that when an application is run in Mac OS 10.3.9, it  
crashes when a method in an NSScanner category that is defined in a  
framework does a simple scan.  It runs fine in Mac OS 10.5, and  
indications are, 10.4.


Back in March 2008, I found that this only happened if it was the  
first code to execute in the application executable, and a workaround  
was to execute one line of regular code before invoking the category  
in the framework.  But after updating from Xcode 3.0 to Xcode 3.1.1,  
this no longer works.  I tried playing around with some of the build  
settings in the framework for awhile, but none of what I tried fixed it.


Also back in March 2008, I thought that this affected other classes in  
addition to NSScanner.


Discussion of the March 2008 issue is here:

http://www.cocoabuilder.com/archive/message/cocoa/2008/3/27/202404

Here is the demo project in case anyone is interested.

http://sheepsystems.com/engineering/PantherCrasher.zip  (46 KB)

My solution is to tell Mac OS 10.3.9 users that they are not getting  
any more updates, and then I'll have to make the old version available  
manually when they need it.  Kind of a pain, but not as painful as  
keeping an Xcode 3.0 around.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Write app without nib file.

2008-10-03 Thread Jeff Johnson

Daniele,

My suspicion is that the issue has nothing to do with whether or not  
you have a nib.


The code below won't work, because as far as I can tell, you never  
add the view to a window. A view needs to be in a window to receive  
events.


By the way, it's standard Cocoa naming convention to capitalize class  
names -- MyView rather than myView. It's a good idea to follow  
standard Cocoa naming conventions, especially when other people will  
read your code.


-Jeff


On Oct 3, 2008, at 9:06 AM, Daniele Basile wrote:


Hi,
I want to write an application without using a nib file.
I found same code that do this and it works, but I am not able to  
manage
event. For exactly I want to trap some event (tablet event) and  
manage this.

So, I write this code:

- main.m -
import Cocoa/Cocoa.h
#import myView.h

int main(int argc, const char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSWindow *window;
myView *view;
view = [[myView alloc] initWithFrame:NSMakeRect(0,100,200,200) ];

window = [[NSWindow alloc] initWithContentRect:NSMakeRect 
(50,100,200,300)

 styleMask:NSTitledWindowMask | 
NSResizableWindowMask
   backing:NSBackingStoreBuffered
 defer:TRUE];


NSButton *button=[[NSButton alloc]initWithFrame:NSMakeRect 
(10,10,180,32) ];

[button setBezelStyle:NSRoundedBezelStyle];
[button setTitle:@Quit];
[button setTarget:NSApp];
[button setAction:@selector(terminate:)];

[[window contentView] addSubview:button];

[NSApplication sharedApplication];
[window makeKeyAndOrderFront: nil];
[pool release];

[NSApp run];
return 0;
}
 ---
- myView.h --
#import Cocoa/Cocoa.h

@interface myView : NSView
{
}
- (id)initWithFrame:(NSRect)frame;
- (BOOL)acceptsFirstResponder;
- (void)tabletProximity:(NSEvent *)theEvent;
@end
 ---

- myView.m --
#import myView.h

@implementation myView
- (id)initWithFrame:(NSRect)frame {
self = [super initWithFrame:frame];
if (self) {
printf(Parto..\n);
}
return self;
}

- (BOOL)acceptsFirstResponder
{
return YES;
}
- (void)tabletProximity:(NSEvent *)theEvent
{
printf(prossimita'\n);
if([theEvent isEnteringProximity])
{
printf(Entro\n);
printf(capabilityMask(%d)\n, [theEvent capabilityMask]);
printf(deviceID(%d)\n, [theEvent deviceID]);
printf(enterProximity(%d)\n, [theEvent isEnteringProximity]);
printf(pointerID(%d)\n, [theEvent pointingDeviceID]);
		printf(pointerSerialNumber(%d)\n, [theEvent  
pointingDeviceSerialNumber]);

printf(pointerType(%d)\n, [theEvent pointingDeviceType]);
printf(systemTabletID(%d)\n, [theEvent systemTabletID]);
printf(tabletID(%d)\n, [theEvent tabletID]);
printf(uniqueID(%d)\n, [theEvent uniqueID]);
printf(vendorID(%d)\n, [theEvent vendorID]);
printf(vendorPointerType(%d)\n, [theEvent  
vendorPointingDeviceType]);

}
else
{
printf(Esco\n);}

}
@end
--

This code draw a window with one button that, I press it, the  
program quit.
I see the window and button work, but the myView class seem not  
receive the windows events..


Have any idea for this?

Thanks
Daniele.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Cocoa Programming for Mac OsX Third Edition eBook search

2008-10-03 Thread Jamie Daniel
Greetings,
Does anyone know where I can find / get the Cocoa Programming for Mac OsX 
Third Edition in eBook. I have a trip I am going on and I would like to take a 
few books with me - in eBook for space of course.

it seems every place I find wants me to read it online - or download their 
stupid reader, which doesn't support OS X 10.5

I find that stupid. A book about Mac programming, not supported on a Mac.

But I digress.

Anyone know where I can get the above book in eBook ?

Thanks,
Jamie
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Write app without nib file.

2008-10-03 Thread Shawn Erickson
On Fri, Oct 3, 2008 at 7:06 AM, Daniele Basile [EMAIL PROTECTED] wrote:
 Hi,
 I want to write an application without using a nib file.

Don't. At least use a very basic nib/xib just to make your life easy.

-Shawn
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: IB plugins

2008-10-03 Thread JongAm Park



 Ken,

 Step 2 of this section says: In the library window, select the  
 Library  IB SDK group. This group contains a single entry, which is  
 a library object template. It is referring to the Interface  
 Builder Kit category of items (as opposed to, for example, the  
 Cocoa or WebKit groups) in the Library window.



When I create a new IB project using Xcode, I can't see any files,  
groups, categories or resources labeled Interface Builder Kit. Which  
application should I be looking in? Xcode or InterfaceBuilder? If you  
create a new IB plugin at your end, do you see this Interface Builder  
Kit category? If not, which of the automatically generated files is  
it contained in?


Hello.
The current Interface Builder Plug-in project template contains a bug 
and I reported it.

But you should not have problem in the step you have trouble.

For comparison, my project string formatter IB plugin project contains 
these. I didn't add any new files, except for an image.


JAStringFormatter ( the project)
- Plugin ( This is a directory for a plugin which will be built )
  - Class Descriptions
  - Classes
  - Other Sources
  - Resources
 - JAStringFormatterLibrary.nib ( This *contains *the *LIBRARY 
OBJECT!* So, open this one. )

 - JAStringFormatterInspector.xib
 - JAStringFormatter-picture.tif

- Framework ( This is a directory for a framework to be built. Other 
project which will use your plugin will be linked to this framework. )

  - Classes
 - Resources

- Products ( will contain built IB plugin and its framework )
- Frameworks ( frameworks which are linked to the your IB plugin/framework)

--
Now, if you open your *.nib file which I wrote in red, or commented as 
(This contains the LIBRARY OBJECT!.. ),
you will be able to locate some icons : File's owner, First Responder, 
Application, Library Object


The Library Object there is the one you are mentioning. The document 
shows the default one, and you can edit it or you can remove it and add 
a new one.
If you want to locate the Library Object, which is 
IBLibraryObjectTemplate, bring a Library panel under Tools menu of 
the Interface Builder.
Under its Objects tab, and under Library=Cocoa, you will be able to 
locate Interface Builder Kit. If you click it, there is only one item, 
Library Template which is subtitled as IBLibraryObjectTemplate. It is 
the one you want.


I hope this clarify your question.

JongAm Park



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSWindowController retain count confusion

2008-10-03 Thread James Walker

Uli Kusterer wrote:

On 30.09.2008, at 21:01, James Walker wrote:
However, I did solve my problem.  I neglected to mention that I'm 
working in a mostly Carbon app.  When I surrounded the alloc, init, 
and showWindow calls with a local autorelease pool, the problem went 
away and the NSWindowController gets deallocated without funny 
business.  I thought I had read that it was no longer necessary to set 
up my own autorelease pools.



 You probably already know that, but just in case:

1) Do not put an autorelease pool at the bottom of your event loop, i.e. 
into your 'main' function so it surrounds the event loop run call. All 
this will do is inhibit the 'NSAutoReleaseNoPool' error log messages. 
Since that all-encompassing pool would take up all objects where no pool 
existed, but would never be drained, you'd have the leaks without the 
leak warning message.


I see, but no I didn't do that.

2) If you did your creation, destruction and testing in the same event 
handler (even if it spawns its own sub-event-loop to e.g. run the Cocoa 
window modally), then they'll all be in the same autorelease pool, so 
you'll get a false leak. It's perfectly common to e.g. have another 
autorelease pool inside a tight loop, to more frequently autorelease 
objects that aren't needed after an iteration anymore. Carbon creates 
its own pool in RAEL, but that won't be drained until the next event or 
could (as a performance optimization) be drained only every fifth event 
or so.


There was no sub-event-loop.  The dealloc method never got called, no 
matter how long I waited.



3) A common recommendation for progressive Carbon-to-Cocoa ports that 
still need RAEL or WNE at the moment is to create a Cocoa app, start it 
regularly using NSApplicationMain, and to call RAEL in 
-applicationDidFinishLaunching:. If you're calling 
ReceiveNextEvent()/SendEventToEventTarget() or 
-nextEventMatchingMask/-sendEvent: in a tight loop at this spot, you 
might not get the autorelease pool, and all objects will accumulate in 
the pool set up by AppKit for -applicationDidFinishLaunching:, giving 
you a similar effect as #1.


Well, I haven't progressed that far in going from Carbon to Cocoa.



 Any of these ring a bell with regard to your project?


Nope, but thanks for trying.

--
  James W. Walker, Innoventive Software LLC
  http://www.frameforge3d.com/
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Getting reference to a window

2008-10-03 Thread Cocoader

You, sir, are a Super Hero!

I have spent a lot (and I mean a LOT) of time over this, reading  
books, looking at other projects, scouring the mailing list archives.  
I knew from my experiments that it was something wrong with the way my  
project was set up, not a problem with the code itself.


You have switched a light on in my brain by your statement:


 If you want your main menu to be able to send messages to a
document, you need to connect their actions to the First Responder
icon within your xib. The front-most document will be the first
responder to that message so it'll receive it. Read this for more
information:


I have read so much about First Responder within a NIB/XIB and somehow  
couldn't quite work out what it was, as if it was some ever changing  
thing. Now it makes sense!!!


THANK YOU!!!


--
Paul Harvey
Hiddenfield Software
www.hiddenfield.com

On 3 Oct 2008, at 19:06, I. Savant wrote:

On Fri, Oct 3, 2008 at 9:57 AM, Cocoader [EMAIL PROTECTED]  
wrote:


My NSDocument 'HF_Browser' works with a window in a XIB file. From  
within
this HF_Browser.m file I can get a reference to the window, set  
it's title,

etc.


 Yes, because the File's Owner of that xib instance is your
HF_Browser and its connections are restored when a new document is
instantiated (and a new copy of your XIB's object graph is
'awakened').

In MainMenu.xib I have a menu command, 'Jump To' (invoked with Cmd- 
J). I
dragged an Object object into MainMenu.xid and set it to HF_Browser  
then
connected the Jump To menu command to it, to an IBAction in  
HF_Browser.m.


 Why do you do this? You're only creating an instance of your
document object (without allowing Cocoa to open a copy of the xib and
restore connections). All you have is a lone instance of your
NSDocument subclass.

 Re-read this document:

http://developer.apple.com/documentation/Cocoa/Conceptual/Documents/Documents.html#/ 
/apple_ref/doc/uid/1006


 See below for the right way to do this.


When I hit Cmd-J my method- (IBAction)MenuJumpTo:(id)sender is called
perfectly but within this method I can't get any reference to the  
window at

all. Can you please advise?


 Your code is called because you have a valid instance of your
document subclass. Because it was not correctly created by Cocoa's
document machinery, none of its outlets (including window) are
connected to anything.

 If you want your main menu to be able to send messages to a
document, you need to connect their actions to the First Responder
icon within your xib. The front-most document will be the first
responder to that message so it'll receive it. Read this for more
information:

http://developer.apple.com/documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/chapter_2_section_6.html#

--
I.S.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Getting reference to a window

2008-10-03 Thread Cocoader

Thank you Shawn!

Your explanation was very clear. I have always had doubts around what  
the First Responder did in a NIB/XIB. I understood that NSResponder  
worked its way up the chain looking for something to handle the event,  
I guess my knowledge is weakest when it comes to Interface Builder.


it's working a treat now and that's only 4 days of researching and  
messing about that's come to an end!!


Cheers matey, that's a drink for you if you're at the monthly meeting :)


--
Paul Harvey
Hiddenfield Software
www.hiddenfield.com

On 3 Oct 2008, at 19:06, Shawn Erickson wrote:

On Fri, Oct 3, 2008 at 6:57 AM, Cocoader [EMAIL PROTECTED]  
wrote:

Hi there,

My NSDocument 'HF_Browser' works with a window in a XIB file. From  
within
this HF_Browser.m file I can get a reference to the window, set  
it's title,

etc.


At runtime the framework (or code of your own) creates an HF_Browser
instance making it the owner of the xib file that contains the window
you describe. This instance is hooked up with the window, etc.
allowing it to message the UI.

In MainMenu.xib I have a menu command, 'Jump To' (invoked with Cmd- 
J). I
dragged an Object object into MainMenu.xid and set it to HF_Browser  
then
connected the Jump To menu command to it, to an IBAction in  
HF_Browser.m.


By dragging an object into your MainMenu xib you are creating an
object instance (in this case an instance of HF_Browser). Then you
connect a menu item with that instance. At runtime when your MainMenu
xib is load an instance of HF_Browser is unarchived, one not
associated with any document and having no ownership of the xib
containing the window it is meant to manage.


When I hit Cmd-J my method- (IBAction)MenuJumpTo:(id)sender is called
perfectly but within this method I can't get any reference to the  
window at

all.


Yup because the instance you created is not associated with any window
or document.


Can you please advise?


Don't try to connect your menu item that way and remove the HF_Browers
instance you created in your main menu xib.

Review the concept of the responder chain since it existing for
exactly this type of situation...

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

-Shawn


___

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

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

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

This email sent to [EMAIL PROTECTED]


NSTableView confusion

2008-10-03 Thread James Maxwell

To be more precise, my confusion is with bindings and NSTableView.

What I want to do is this:

1) Have a table with n columns (let's say 2, for kicks) and a variable  
number of rows

2) Column 1 holds a user-defined string/name for each entry (row)
3) Column 2 holds a popup with a set of choices. The popup is loaded  
from a persistent collection of objects


Creating a new entry, with a + button, will instantiate an XObject  
(arbitrary name). The name property of the new XObject will be set  
in column 1, and a number of optional settings for XStuff (arbitrary  
property) will be loaded into the popup in column 2.


This doesn't seem like a big deal, but I'm pretty confused. I want to  
set this up using bindings, but I'm note sure how I populate the popup  
in column 2, and I'm also unclear on who manages storing the index of  
the popup selection? Do I need to have a method to handle this in my  
XObject class, or is this something NSArrayController does?


If anyone could provide me with a run-through of the basic things I  
have to cover to manage this I'd really appreciate it - most of the  
tutorials I've found only cover single items in table cells, not  
automatically-populated popups...


thanks,

J.
___

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

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

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

This email sent to [EMAIL PROTECTED]


UITabBarController setViewControllers results in empty array of view controllers?

2008-10-03 Thread Liza Witz
Greetings-
I've recently refactored my iPhone app to stop using an XIB to load my
view controllers.   So, rather than specifying a TabBarController in
IB I'm doing so in code.   The view controllers I'm adding to it were
mostly specified in code previously.   What happens is, I create the
TabBarController, add the views, then query the TabBarController for
its array of views and get null.When running, the TabBar does show
up, but it shows up without any views .  Somewhow the views are being
lost.

If you'll notice from the logged output, the array of view controllers
are valid, but after adding them, the tab bar says its array of view
controllers is null.  This all happens within the same event loop, so
it can't be a memory issue...


Code:
tabBar = [[UITabBarController alloc] initWithNibName:nil bundle:nil];
tabBar.delegate = self;
// hook navigation controller to one of the tabs
// hook the inner views up to the tab bar
NSArray * tabControllers = [NSArray
arrayWithObjects:dataNavigationController, searchController,
settingsController, lockController, nil];
Log(@Controllers array: %@, tabControllers);
[tabBar setViewControllers:tabControllers animated:NO];
Log(@tabBar is: %@, [tabBar description]);
Log(@tabBar.viewController count: %d, [tabBar.viewControllers count]);
Log(@tabBar.viewControllers: %@, tabBar.viewControllers);

What it puts out at runtime:
2008-10-02 03:52:14.672 Vault[55179:20b] RootViewController.m:331
-[RootViewController configureForLogin] Controllers array: (
UINavigationController: 0x474e190,
SearchTableViewController: 0x47215e0,
SettingsViewController: 0x4721eb0,
LockViewController: 0x47223d0
)
2008-10-02 03:52:14.673 Vault[55179:20b] RootViewController.m:333
-[RootViewController configureForLogin] tabBar is:
UITabBarController: 0x474e360
2008-10-02 03:52:14.673 Vault[55179:20b] RootViewController.m:334
-[RootViewController configureForLogin] tabBar.viewController count: 0
2008-10-02 03:52:14.674 Vault[55179:20b] RootViewController.m:335
-[RootViewController configureForLogin] tabBar.viewControllers: (null)

So, how is it tabControllers has an array of valid objects, but
setViewControllers results in tabBar.viewControllers returning null?

Is there some other way to set the view controllers on a tab bar?
FWIW, previously the code set the property directly:
tabBar.viewControllers = tabControllers;

This gave the exact same results.

I'm stuck here, and unfortunately, I suspect its something obvious!

Liza
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [OT] Core Animation is it up to the challenge

2008-10-03 Thread Michael Ash
On Fri, Oct 3, 2008 at 1:32 PM, development2
[EMAIL PROTECTED] wrote:
 This is off topic, just want to get some peoples opinion on this.

 I have been asked to port a game from Flash to the Mac (actually the iPhone,
 but that does not matter in this case). I am wondering if Core Animation is
 up to the task, of display and moving 30-50 units on the screen at one time,
 along with missiles and such. So possibly upwards of 70-100 items moving on
 the screen at once. The original developers are very concerned that Core
 Animation is not up to the task, when I mentioned that Core Animation would
 be the way to go. Does anyone have any experience with Core Animation and
 games? And what kind of results do yoy get with lots of items moving within
 Core Animation layers at one time?

Seems to me that the fact that it's on the iPhone matters a great deal
when your question essentially boils down to performance. Since
CoreAnimation relies greatly on the CPU and GPU, it should be pretty
apparent that CoreAnimation will have vastly superior performance on
any Mac built within the last 3 (5? 7?) years than on the iPhone. It's
further apparent that CoreAnimation on the Mac can easily deliver what
you need: the fancy 3D skyscraper iTunes cover art demo does way more
than what you describe and runs fine. But of course this is on a
machine with one or two orders of magnitude more computing and
graphics power.

Seems to me the best answer to your question would be to test it for
yourself. CA is pretty straightforward and you ought to be able to
come up with either a convincing demo that it's up to the task, or an
example which shows that it's not, without a huge amount of work.

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


Re: -[NSScanner scanUpToString:stopString:NULL] - 10.3.9 Crash, due Xcode 3.1?

2008-10-03 Thread Michael Ash
On Fri, Oct 3, 2008 at 2:34 PM, Jerry Krinock [EMAIL PROTECTED] wrote:
 As far as I can see, this is another symptom of a bug which I found back in
 March 2008 in Mac OS 10.3.

 The bug is that when an application is run in Mac OS 10.3.9, it crashes when
 a method in an NSScanner category that is defined in a framework does a
 simple scan.  It runs fine in Mac OS 10.5, and indications are, 10.4.

How strange! Your project looks completely ordinary to me

 My solution is to tell Mac OS 10.3.9 users that they are not getting any
 more updates, and then I'll have to make the old version available
 manually when they need it.  Kind of a pain, but not as painful as keeping
 an Xcode 3.0 around.

Seems like a reasonable fix to me. However, *if* you felt like trying
something else, how about using a subclass of NSScanner rather than a
category? You'll have to either re-point your code at it or use
poseAsClass:, but it might solve the problem. Of course I completely
understand a desire to simply cut loose from the 10.3 population
instead.

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


NSApplication releases top-level nib objects?

2008-10-03 Thread Mike Manzano

The docs say that NSApplicationMain:

Creates the application, loads the main nib file from the  
application’s main bundle, and runs the application.


Who is responsible for releasing the objects in the main bundle when  
the app quits? Is it safe to not release them since the application is  
quitting anyway?


Thanks!

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


More IB plugin confusion

2008-10-03 Thread Ken Tozier

Hi

I encountered another puzzler in the IB plugin documentation. Under  
the Plug-in quick start  Creating and Configuring Your Xcode  
Project heading (http://developer.apple.com/documentation/DeveloperTools/Conceptual/IBPlugInGuide/Plug-inQuickStart/chapter_3_section_2.html#/ 
/apple_ref/doc/uid/TP40004323-CH9-DontLinkElementID_36), step 4 states  
In the new project window, double-click your plug-in target to open  
the inspector window for that target. but doesn't seem to apply to  
anything in the project or generated files in either XCode or  
Interface Builder


If you double click on the Targets item in the Xcode Project, you  
get the standard settings window, which contains the following four  
tabs General, Build, Configuration, Comments there is no  
Properties Tab. In InterfaceBuilder's Inspector window, there are  
tabs for Attributes, Effects, Size, Bindings, Connection, Identity  
and Applescript but again, no Properties tab.


What exactly are they referring to when they say double-click your  
plug-in target if not the Targets item in the Xcode project?


Thanks for any help
___

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

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

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

This email sent to [EMAIL PROTECTED]


[MEET] NYC CocoaHeads, Thu Oct 9 -- raffle!

2008-10-03 Thread Andy Lee
The October meeting of CocoaHeads-NYC is Thursday 10/9 from 6:00 to  
8:00 at Tekserve, at 119 West 23rd between 6th and 7th http://www.tekserve.com 
.


* Paul Kim will talk about tools and techniques for tracking down  
memory leaks.


* We will raffle off one copy of TextMate and one copy of OmniGraffle.

* Afterwards, food and beer as usual, at a location TBD.

--Andy
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [MEET] NYC CocoaHeads, Thu Oct 9 -- raffle!

2008-10-03 Thread Andy Lee

Sorry, I keep forgetting to include a link to our Yahoo Group:

http://tech.groups.yahoo.com/group/CocoaHeads-NYC/

--Andy

On Oct 3, 2008, at 5:42 PM, Andy Lee wrote:

The October meeting of CocoaHeads-NYC is Thursday 10/9 from 6:00 to  
8:00 at Tekserve, at 119 West 23rd between 6th and 7th http://www.tekserve.com 
.


* Paul Kim will talk about tools and techniques for tracking down  
memory leaks.


* We will raffle off one copy of TextMate and one copy of OmniGraffle.

* Afterwards, food and beer as usual, at a location TBD.

--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/aglee%40mac.com

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: More IB plugin confusion

2008-10-03 Thread Joey Hagedorn

On Oct 3, 2008, at 2:34 PM, Ken Tozier wrote:

Hi

I encountered another puzzler in the IB plugin documentation. Under  
the Plug-in quick start  Creating and Configuring Your Xcode  
Project heading (http://developer.apple.com/documentation/DeveloperTools/Conceptual/IBPlugInGuide/Plug-inQuickStart/chapter_3_section_2.html#/ 
/apple_ref/doc/uid/TP40004323-CH9-DontLinkElementID_36), step 4  
states In the new project window, double-click your plug-in target  
to open the inspector window for that target. but doesn't seem to  
apply to anything in the project or generated files in either XCode  
or Interface Builder


What exactly are they referring to when they say double-click your  
plug-in target if not the Targets item in the Xcode project?


Ken,

Click the disclosure triangle next to the Targets group in Xcode  
your Xcode project. That should expose three items; each one of these  
is a single target. Double-click the one that has a plugin icon, it  
will be named the same as you named your project. This is the plug-in  
target, it sounds like you were double-clicking on the targets group  
before instead.


Let me know if this works for you,
-Joey Hagedorn
___

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

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

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

This email sent to [EMAIL PROTECTED]


cookies and UIWebView

2008-10-03 Thread Paul Gribble
Now that the NDA has been lifted, can anyone contribute suggestions for this
thread? I'm interested in the answer as well.Thanks


   - *Subject*: *Re: [moderator] Re: reusing cookies set in UIWebView*
   - From: Scott Anguish [EMAIL PROTECTED]
   - Date: Fri, 22 Aug 2008 12:54:36 -0400
   - Delivered-to: [EMAIL PROTECTED]
   - Delivered-to: [EMAIL PROTECTED]

--

No, not at this time.


On 22-Aug-08, at 10:48 AM, John Greene wrote:


Is any information available about when that NDA will be lifted?


Thanks,


John


Scott Anguish wrote:

the reason you can't find this information is that the iPhone SDK is
still under non-disclosure.


You can't talk about it here or anywhere publicly.


scott
[moderator]



On 21-Aug-08, at 8:18 PM, John Greene wrote:


Hi,


I've done a little bit of searching and haven't found an answer to this
dilemma: I want to use a webservice in my app that returns XML, but the
catch is the user has to be logged in to get valid results, and the
log-in is quite distinct from the webservice. I could create a
UIWebView to the login screen, and somehow capture a successful login,
but I don't know how to reuse the cookies that get set later in a
NSURLRequest. Actually, I don't even know if that's possible. Does
anyone have any suggestions? The keys to the issue are I *have* to use
the login screen via a browser, and the webservice *has* to recieve
valid cookies.

___
___

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

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

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

This email sent to [EMAIL PROTECTED]


NSCoding protocol

2008-10-03 Thread hatzicware
I want MyClass to conform to the NSCoding protocol. But I'm puzzled  
about how to implement the initWithCoder: method.


Suppose I have this in MyClass.h:

NSString *S1, *S2, *S3;


and this in its init function:

S1 = @a string;
S2 = [[NSString alloc] init];
S3 = [NSString string];

So to conform to the protocol, I'd have something like this in  
MyClass.m too:


- (id)initWithCoder:(NSCoder *)decoder {

self = [super init];
S1 = [decoder decodeObjectForKey:@S1];
S2 = [[decoder decodeObjectForKey:@S2] retain];
S3 = [[decoder decodeObjectForKey:@S3] retain];
return self;
}

(I'm not posting the encodeWithCoder: method.)

So finally, my question: am I right to retain S2 and S3, and not S1?
___

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

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

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

This email sent to [EMAIL PROTECTED]


Multiples calls to acceptsFirstResponder

2008-10-03 Thread Andre Masse

Hi All,

I'm re-learning Cocoa (been on Windows/Java for the last 5-6 years)  
using Cocoa Programming For Mac OS X third edition. I'm at chapter  
19 (keyboard events) and I've noticed that my custom view  
(BigLetterView for those who know the book) overridden -  
(BOOL)acceptsFirstResponder is sometime called multiple times:


- 2 times at launch (before becoming firstResponder),
- 2 times after pressing tab for the first time (before resigning),
- 4 times when tabbing in

The author has a remark about it saying:

Yes, acceptsFirstResponder gets called more times than you might  
expect each time the view is selected


but doesn't say why...

Just for my own curiosity, why??

Thanks,

Andre Masse

PS: Glad to see some familiar names from MacZoop times. Hi to Graham  
Cox and Uli Kusterer! I see you're both as helpfull now than you were  
then :-)

___

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

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

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

This email sent to [EMAIL PROTECTED]


Help for a beginner..

2008-10-03 Thread Jent Kyle
My Greetings!
Okay so everyone has to start somewhere, right? Please don't tell me that
all of you were born with this special ability (built in) to program. I'm
a complete beginner, I have never done any programming but I really want to
learn cocoa. So my question is, where, how, etc. to learn cocoa?
Thanks!

Jent
___

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

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

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

This email sent to [EMAIL PROTECTED]


Load/Save buttons

2008-10-03 Thread cocoa
I am trying to create an application that will load an XML file into an
array when you press the load button, and save when you press a save
button.  However, I don't see any examples online or in my books that
suggest how to handle dataOfType or readFromData on a button click.

Any help would be appreciated.  Thank you.

___

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

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

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

This email sent to [EMAIL PROTECTED]


[Moderators] Re: OK To ask iPhone Questions?

2008-10-03 Thread Scott Anguish


On 3-Oct-08, at 6:41 AM, Andrew Lindesay wrote:


Hello;

Is it now legal to ask iPhone development questions here?



As others have said, the new NDA should be available shortly.

List guidelines are also still pending.

Don't worry, when things change I'll post the information.

Scott
[moderator]
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Help for a beginner..

2008-10-03 Thread Alex Wait
you should start with a c based language. like vanilla c or c++.
it will teach you the basics. :)
I'm sure others on here can recommend a good book.

On Fri, Oct 3, 2008 at 12:20 PM, Jent Kyle [EMAIL PROTECTED] wrote:

 My Greetings!
 Okay so everyone has to start somewhere, right? Please don't tell me that
 all of you were born with this special ability (built in) to program. I'm
 a complete beginner, I have never done any programming but I really want to
 learn cocoa. So my question is, where, how, etc. to learn cocoa?
 Thanks!

 Jent
 ___

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

 This email sent to [EMAIL PROTECTED]




-- 
If you can't be kind, at least have the decency to be vague.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSCoding protocol

2008-10-03 Thread Stephen J. Butler
Assuming this is not under GC...

On Fri, Oct 3, 2008 at 2:00 PM,  [EMAIL PROTECTED] wrote:
 I want MyClass to conform to the NSCoding protocol. But I'm puzzled about
 how to implement the initWithCoder: method.

 Suppose I have this in MyClass.h:

NSString *S1, *S2, *S3;


 and this in its init function:

S1 = @a string;
S2 = [[NSString alloc] init];
S3 = [NSString string];

You need to retain S3 also.

 So to conform to the protocol, I'd have something like this in MyClass.m
 too:

 - (id)initWithCoder:(NSCoder *)decoder {

self = [super init];
S1 = [decoder decodeObjectForKey:@S1];
S2 = [[decoder decodeObjectForKey:@S2] retain];
S3 = [[decoder decodeObjectForKey:@S3] retain];
return self;
 }

 (I'm not posting the encodeWithCoder: method.)

 So finally, my question: am I right to retain S2 and S3, and not S1?

You need to retain them all. Think of it this way: did you get the
object via alloc, copy, or mutableCopy? No, so you must retain it.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Python, Mac OS X 10.5.5 and CoreGraphics

2008-10-03 Thread Ronny Reichmann
Hello there,

to make it short: Does anyone accidentally know why CoreGraphics doesn't
work any more on conjunction with Python? The directory that contains the
CoreGraphics bindings is still there, but not in the PYTHONPATH anymore.
Setting it by hand and trying to import CoreGraphics leads to a Fatal Python
error: Interpreter not initialized (version mismatch?)

I was trying to use CoreAnimation from Python. But without CoreGraphics
porting the simplest examples just doesn't work. So where is the bug in my
thinking? Did something change significantly since 10.4, when this was
working without difficulty?

Thanx for suggestions and help,
Ronny
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Newbie: Simple display with NSView - problem

2008-10-03 Thread Graham Cox


On 4 Oct 2008, at 1:19 am, Genu Mathew wrote:

Thank you for the reply. Is there any placeholder for the custom  
view that I can use in the NIB file such that I can instantiate the  
view in the code and then load it onto the window?


I can not hard code the filename into the custom view class and use  
it in the NIB as the image to be displayed will not always be the  
same and it can change depending on where the user will click on the  
main window.



That's not how it should work.

If you have a view subclass then design it to handle any image file  
given its filename - you wouldn't have a separate view subclass for  
every individual file. I'm pretty sure this isn't what you're  
proposing, but it could be one interpretation of your description!


In the NIB, just use a custom view, then set its class to your class  
name. Then you don't have to instantiate it in code at all - it's  
already in existence in the NIB. When the NIB is loaded you can set  
the filename of the image, most likely using the -awakeFromNib  
message. To obtain the reference to the view, add an IBOutlet to its  
controller and link it up in IB. Then you can use that outlet to refer  
to the view.


hth,

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


Re: NSCoding protocol

2008-10-03 Thread Nick Zitzmann


On Oct 3, 2008, at 1:00 PM, [EMAIL PROTECTED] wrote:


So finally, my question: am I right to retain S2 and S3, and not S1?



No. -decodeObject: and -decodeObjectForKey: always return autoreleased  
objects, so if you use them later, then you must retain them unless  
the code requires GC.


Nick Zitzmann
http://www.chronosnet.com/

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Help for a beginner..

2008-10-03 Thread Nick Zitzmann


On Oct 3, 2008, at 1:20 PM, Jent Kyle wrote:


I'm
a complete beginner, I have never done any programming but I really  
want to

learn cocoa. So my question is, where, how, etc. to learn cocoa?



Don't, or at least, not yet. Learn C first, up to and including data  
structures and pointers; then you will be ready for ObjC and the  
frameworks. The C Programming Language by Kernighan  Ritchie is an  
absolutely essential book, but you'll also want any Unix-oriented book  
on learning C.


I'd also recommend learning Emacs or VI, and how to run GCC from the  
command line.


Nick Zitzmann
http://www.chronosnet.com/

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Help for a beginner..

2008-10-03 Thread Dave DeLong
Our local CocoaHeads group has been working on getting a lot of  
fundamentals material up online.  We have videos, slides, a wiki, and  
as many online and in-print resources as we can find.


http://cocoaheads.byu.edu

Good to see you around here, Bobber!  ;)

Dave DeLong

On 3 Oct, 2008, at 4:51 PM, Alex Wait wrote:


you should start with a c based language. like vanilla c or c++.
it will teach you the basics. :)
I'm sure others on here can recommend a good book.

On Fri, Oct 3, 2008 at 12:20 PM, Jent Kyle [EMAIL PROTECTED]  
wrote:



My Greetings!
Okay so everyone has to start somewhere, right? Please don't tell  
me that
all of you were born with this special ability (built in) to  
program. I'm
a complete beginner, I have never done any programming but I really  
want to

learn cocoa. So my question is, where, how, etc. to learn cocoa?
Thanks!

Jent

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Multiples calls to acceptsFirstResponder

2008-10-03 Thread Bill Bumgarner

On Oct 3, 2008, at 12:02 PM, Andre Masse wrote:

- 2 times at launch (before becoming firstResponder),
- 2 times after pressing tab for the first time (before resigning),
- 4 times when tabbing in

The author has a remark about it saying:

Yes, acceptsFirstResponder gets called more times than you might  
expect each time the view is selected


but doesn't say why...

Just for my own curiosity, why??


A very good question.  Have you set a breakpoint and grabbed the  
backtrace from each invocation?


b.bum



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: NSCoding protocol

2008-10-03 Thread hatzicware

Thanks for your replies.

But now I'm confused about how to de-allocate MyClass. Given this in  
its initialisation:


S1 = @a string;
S2 = [[NSString alloc] init];
S3 = [NSString string];

I would only release S2 in the dealloc method. But if the class has  
been unarchived, won't I leak memory with S1 and S3 when the class is  
released?


dkj

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Python, Mac OS X 10.5.5 and CoreGraphics

2008-10-03 Thread Bill Bumgarner

On Oct 3, 2008, at 3:55 PM, Ronny Reichmann wrote:
to make it short: Does anyone accidentally know why CoreGraphics  
doesn't
work any more on conjunction with Python? The directory that  
contains the
CoreGraphics bindings is still there, but not in the PYTHONPATH  
anymore.
Setting it by hand and trying to import CoreGraphics leads to a  
Fatal Python

error: Interpreter not initialized (version mismatch?)

I was trying to use CoreAnimation from Python. But without  
CoreGraphics
porting the simplest examples just doesn't work. So where is the bug  
in my

thinking? Did something change significantly since 10.4, when this was
working without difficulty?


There are two different bits of CoreGraphics binding.  The SWIG  
generated bindings that were primarily used for processing PDF within  
the printing pipeline and the framework wrappers included with PyObjC.


Both should still work.

If you have a simple example script that does not work on 10.5.5, but  
worked on previous versions of the OS, file a bug and send me the #,  
please.


b.bum



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Help for a beginner..

2008-10-03 Thread mmalc crawford


On Oct 3, 2008, at 12:20 PM, Jent Kyle wrote:


I have never done any programming but I really want to
learn cocoa. So my question is, where, how, etc. to learn cocoa?

Start with Programming in Objective-C by Stephen Kochan (depending on  
how quickly you want to get underway, you may consider waiting for the  
second edition):


http://www.amazon.com/Programming-Objective-C-Developers-Library-Stephen/dp/0672325861/ 

http://www.amazon.com/Programming-Objective-C-2-0-Developers-Library/dp/0321566157/ 



If you're feeling a little ambitious, you might start with Scott  
Stevenson's Learn C Tutorial at http://cocoadevcentral.com/articles/81.php 
, but it does have some prerequisites (You should already know at  
least one scripting or programming language, including functions,  
variables and loops. You'll also need to type commands into the Mac OS  
X Terminal.).


mmalc

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSCoding protocol

2008-10-03 Thread Shawn Erickson
On Fri, Oct 3, 2008 at 4:29 PM,  [EMAIL PROTECTED] wrote:

 But now I'm confused about how to de-allocate MyClass. Given this in its
 initialisation:

S1 = @a string;
S2 = [[NSString alloc] init];
S3 = [NSString string];

The line for S3 is wrong since you presumably want S3 to remain valid
for the life of your object (or until otherwise set). +[NSString
string] is returning you an object that you don't own so it will
disappear out from under you at some point in the future unless you
either take ownership directly (retain it) or indirectly (for example
add it to a collection your object owns). Often best to always
directly retain the objects you reference via instance vars unless the
ivar is meant to be a weak reference.

 I would only release S2 in the dealloc method. But if the class has been
 unarchived, won't I leak memory with S1 and S3 when the class is released?

You should release S1, S2, and S3 in your dealloc method (assuming you
correct what you are doing with S3).

If no other code changes S1 you could skip releasing S1 but since
releasing a string constant is a no-op you should continue to release
S1 in your dealloc method for code readability and correctness. This
can help prevent a leak in the future if you decide to make S1 point
at a string you get / create from some other code but forget to add
the now needed release.

-Shawn
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Python, Mac OS X 10.5.5 and CoreGraphics

2008-10-03 Thread Ronny Reichmann

Hello there,

unfortunately none of the examples in /Developer/Examples/Quartz/ 
Python/ work anymore. I don't know if recently, I just encountered it  
today. According to your answer, there should be wrappers as part of  
PyObjC. Unfortunately the graphics examples from the PyObjC-website  
don't work either. In order to know what is wrong I would like to find  
out, if I'm probably having something running that's preventing my  
code and those examples from working properly. Especially before  
filing a bug, of course.


Kind regards,
Ronny


Am 04.10.2008 um 01:23 schrieb Bill Bumgarner:


On Oct 3, 2008, at 3:55 PM, Ronny Reichmann wrote:
to make it short: Does anyone accidentally know why CoreGraphics  
doesn't
work any more on conjunction with Python? The directory that  
contains the
CoreGraphics bindings is still there, but not in the PYTHONPATH  
anymore.
Setting it by hand and trying to import CoreGraphics leads to a  
Fatal Python

error: Interpreter not initialized (version mismatch?)

I was trying to use CoreAnimation from Python. But without  
CoreGraphics
porting the simplest examples just doesn't work. So where is the  
bug in my
thinking? Did something change significantly since 10.4, when this  
was

working without difficulty?


There are two different bits of CoreGraphics binding.  The SWIG  
generated bindings that were primarily used for processing PDF  
within the printing pipeline and the framework wrappers included  
with PyObjC.


Both should still work.

If you have a simple example script that does not work on 10.5.5,  
but worked on previous versions of the OS, file a bug and send me  
the #, please.


b.bum



___

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

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

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

This email sent to [EMAIL PROTECTED]


What does it mean for an NSManagedObject to be invalidated?

2008-10-03 Thread Dave Fernandes
I'm getting the following error logged to the console when I open a  
new document.


2008-10-03 19:34:48.269 MyApp[1182] The NSManagedObject with ID: 
0x1604f260 x-coredata://ADE49D12-24A9-4C1A-884E-91FEEE739A7D/ 
Statistics/p187 has been invalidated.


What does invalidated mean in this message? Breaking on  
[NSException raise] gives the following stack trace right before  
NSLog spits out the above message:


#0  0x9282d3c1 in -[NSException raise]
#1	0x93419404 in -[NSCarbonMenuImpl  
performActionWithHighlightingForItemAtIndex:]

#2  0x9334a842 in _NSHandleCarbonMenuEvent
#3  0x9327e2dc in _DPSNextEvent
#4	0x9327db37 in -[NSApplication  
nextEventMatchingMask:untilDate:inMode:dequeue:]

#5  0x932778c4 in -[NSApplication run]
#6  0x9326b820 in NSApplicationMain
#7  0x55d6 in main at main.m:13

I release a previous document's MOC when a new document is opened,  
however, that code doesn't show up in the stack trace. (Note: this is  
on OS 10.4.11).


I've seen this message posted a couple times in the archives with no  
response.


Thanks,
Dave
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Play Playlist in iTunes

2008-10-03 Thread Mr. Gecko
I made it work for EyeTunes, added the functions -playPlaylist: 
(NSString *)playlist; and -playTrack:(long)track ofPlaylist:(NSString  
*)playlist;
AEDebugSends=1 /Applications/AppleScript/Script\ Editor.app/Contents/ 
MacOS/Script\ Editor is extremely useful for finding this stuff out.
I will try and find the guy who made EyeTunes and send him my version  
so he can add the volume controls and playlist playing options.


Thanks for the help,
Mr. Gecko
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSWindowController retain count confusion

2008-10-03 Thread James Walker

Uli Kusterer wrote:

On 03.10.2008, at 21:14, James Walker wrote:

Uli Kusterer wrote:

On 30.09.2008, at 21:01, James Walker wrote:
However, I did solve my problem.  I neglected to mention that I'm 
working in a mostly Carbon app.  When I surrounded the alloc, init, 
and showWindow calls with a local autorelease pool, the problem went 
away and the NSWindowController gets deallocated without funny 
business.  I thought I had read that it was no longer necessary to 
set up my own autorelease pools.

You probably already know that, but just in case:
1) Do not put an autorelease pool at the bottom of your event loop, 
i.e. into your 'main' function so it surrounds the event loop run 
call. All this will do is inhibit the 'NSAutoReleaseNoPool' error log 
messages. Since that all-encompassing pool would take up all objects 
where no pool existed, but would never be drained, you'd have the 
leaks without the leak warning message.


I see, but no I didn't do that.


 Just for the archives: It's OK in general to have an autorelease pool 
in the main function, as long as one makes sure it gets drained 
occasionally.


2) If you did your creation, destruction and testing in the same 
event handler (even if it spawns its own sub-event-loop to e.g. run 
the Cocoa window modally), then they'll all be in the same 
autorelease pool, so you'll get a false leak. It's perfectly common 
to e.g. have another autorelease pool inside a tight loop, to more 
frequently autorelease objects that aren't needed after an iteration 
anymore. Carbon creates its own pool in RAEL, but that won't be 
drained until the next event or could (as a performance optimization) 
be drained only every fifth event or so.


There was no sub-event-loop.  The dealloc method never got called, no 
matter how long I waited.


 Any other objects involved that may be retaining your object? NSTimer? 
NSThread? NSInvocation? Anything getting retained by an application 
delegate? In general, the objects at the top level of the MainMenu.nib 
don't get released on shutdown, that throws off many people.



No, I've never used NSTimer, NSThread, or NSInvocation in this project. 
 There is no MainMenu.nib and no application delegate.  The only global 
Cocoa objects are a couple of registered value transformers and an 
object that watches NSUserDefaults with KVO.




Any of these ring a bell with regard to your project?


Nope, but thanks for trying.



 If I'm not misremembering your name, you wrote a very nice piece of 
code once that could be used to show help texts and Readmes... I had a 
lot of fun with that back when I started out -- consider it an attempt 
at payback :-)


Ah, yes, Show_help, in the ancient days before OS X.

--
  James W. Walker, Innoventive Software LLC
  http://www.frameforge3d.com/
___

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

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

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

This email sent to [EMAIL PROTECTED]


NSOutlineView assertion failures

2008-10-03 Thread Jeff Wilcox
I am suddenly having a load of issues with NSOutline view failing with  
the following assertion:


Assertion failure in -[NSOutlineView  
_expandItemEntry:expandChildren:startLevel:](), /SourceCache/AppKit/ 
AppKit-949.35/TableView.subproj/NSOutlineView.m:1003


I seemed to be able to make this go away by subclassing the outline  
view and locking it down before starting a reload or evaluating the  
number of rows (found mostly by lots or trial and error) with the  
following:



- (NSInteger)numberOfRows{
@synchronized(self){
return [super numberOfRows];
}
}

- (void)reloadData{
@synchronized(self){
[super reloadData];
}
}


Here is one of many signatures that it yields (back trace abbreviated)

#0  0x94893e17 in objc_exception_throw ()
#1  0x918f7f2b in +[NSException raise:format:arguments:] ()
#2  0x95affac5 in -[NSAssertionHandler  
handleFailureInFunction:file:lineNumber:description:] ()
#3  0x9038363f in -[NSOutlineView  
_expandItemEntry:expandChildren:startLevel:] ()

#4  0x903833f6 in -[NSOutlineView _expandItemEntry:expandChildren:] ()
#5  0x90383314 in -[NSOutlineView numberOfRows] ()
#6  0x9022dfa9 in -[NSTableView rectOfRow:] ()
#7  0x9022de28 in -[NSOutlineView rectOfRow:] ()

Any ideas?  This is driving me a little crazy and delaying my next  
release.  I finally got the work around I mentioned seemingly stable  
for a couple of outline views but then other ones started showing the  
same issue.  I don't feel confident enough about the side effects of  
the work around above to use it pervasively.


Thanks
Jeff
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [OT] Core Animation is it up to the challenge

2008-10-03 Thread Rob Keniger


On 04/10/2008, at 4:14 AM, development2 wrote:

Yeah I know about Core Animation layers and such, and that is  
exactly how I would do it, but i was not sure how it handled that  
many layers at once. As Scott Stevenson shows it handles 80+ layers  
at once with no problem. Of course on my Dual Quad core no, problem,  
but on that which must not be named, I am sure that this would be  
different.



On my iMac, Scott's demo can easily display 1000 layers with great  
performance and 4000 layers with acceptable performance, so 80  
layers on a machine ten times slower would seem quite possible. As  
others have said, testing should reveal the answer but I suspect  
performance would be quite acceptable.


--
Rob Keniger



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Help for a beginner..

2008-10-03 Thread Rob Keniger

On 04/10/2008, at 9:46 AM, mmalc crawford wrote:

Start with Programming in Objective-C by Stephen Kochan (depending  
on how quickly you want to get underway, you may consider waiting  
for the second edition):


http://www.amazon.com/Programming-Objective-C-Developers-Library-Stephen/dp/0672325861/ 

http://www.amazon.com/Programming-Objective-C-2-0-Developers-Library/dp/0321566157/ 




I totally agree with mmalc, this is the first book you should buy.  
Despite what others have said, I highly recommend that you do NOT  
start with Kernigan and Richie, it's simply not the best learning tool  
for getting into Mac programming. KR is extremely dry and although it  
teaches you plain C, you don't need to know most of the stuff in that  
book to write good Objective-C.


Stephen Kochan's book teaches you everything you need to know about  
programming in Objective-C, including the bits of the C language you  
need to know and none of the bits you don't. It is also one of the  
most well-written technical books I have ever read.


Once you've read the Kochan book you should get Aaron Hillegass'  
Cocoa Programming for Mac OS X, which goes beyond the Objective-C  
language to teach you the mechanics of working with the Cocoa  
frameworks.


--
Rob Keniger



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Play Playlist in iTunes

2008-10-03 Thread has

On 3 Oct 2008, at 17:09, Mr. Gecko wrote:


On Thu, Oct 2, 2008 at 9:52 PM, Mr. Gecko  wrote:

I know but I can't find out the AppleEvent for Play Playlist.
Is there some sort of a program that will parse the AppleScript  
and make an

cocoa AppleEvent code.


If you just want the raw four-char-codes from an application's  
dictionary so you can construct NSAppleEventDescriptors yourself,  
you can obtain them in various ways: [...]


I already looked at that but it doesn't have an actual code for Play  
Playlist
I found this though class name=playlist code=cPly  
description=a list of songs/streams inherits=item  
plural=playlists which if you look at the output of AEDebugSends  
than you can see that that is called when running the play playlist  
command.


I think you're a bit confused about how iTunes' Apple event API works.  
This is understandable, given how hopelessly inadequate 99% of  
scriptable applications' documentation is, along with the rather  
unusual, counter-intuitive way that Apple event IPC works in the first  
place.


Suffice it to say: nothing in AppleScript makes sense except in the  
light of RPC plus queries[1][2].


IOW, you can either approach it on its own terms and accept it for  
what it is, which will weird you out till you get your head around it;  
or else you can try to approach it in conventional OO terms, in which  
case it will frequently confuse and frustrate you whenever it behaves  
in a non-OO fashion (which is quite often).



Regarding the playing of iTunes playlists, here's a quick attempt to  
clarify:


iTunes has no 'play playlist' command as you suggest. There is,  
however, a 'play' command (Apple event), and various kinds of playable  
objects: sources, several kinds of playlists (audio CD playlists,  
library playlists, user playlists, etc), and several kinds of tracks  
(file tracks, URL tracks, etc).


To use the 'play' command, you construct a query (reference in  
AppleScript jargon) identifying the object you want played, then pass  
that query as the 'play' command's direct parameter. e.g.:


play (source 1)
play (source Library)

play (playlist My Top Rated)
play (first playlist whose name is My Top Rated)
play (user playlist My Top Rated)
play (user playlist My Top Rated of source 1)

play (track 1 of user playlist My Top Rated)
play (file track id 56315 of user playlist id 520 of source id 41)
etc.

As you can see, queries can be pretty flexible in how they identify  
objects. But whatever query you use, it's up to iTunes' 'play' event  
handler to evaluate that query in order to locate the object or  
objects to act upon, and do its funky thing.



Oh, and BTW: one thing you will almost never find provided by  
applications' scripting documentation (be it built-in dictionaries and/ 
or supplementary files) is any formal indication of which commands can  
operate on which objects, so expect to use some intelligent guesswork  
and trial-and-error testing to figure this out for yourself. (Yes,  
this sucks; AppleScripters have been kvetching about it for the last  
decade, without notable effect. It's just something you'll have to  
deal with; the AppleScript-users list is good for advice, and there's  
a whole stack of existing iTunes scripts at http://dougscripts.com  
to learn from.)


...

If you want to try to wrap your head around the AppleScript way,  
chapter 2 in the appscript manual tries to provide a quick summary of  
the concepts involved. There's also an excellent paper by William Cook  
(one of the original AppleScript designers), which describes both the  
language and the Apple event-based IPC system created around it, and  
provides significant insights into the original motives and decisions  
behind its design. It dates back to the early days of AppleScript so  
doesn't discuss the more recent related Cocoa-based APIs, but the  
underlying principles are unchanged:


http://www.cs.utexas.edu/users/wcook/Drafts/2006/ashopl.pdf

Matt Neuburg's AppleScript: The Definitive Guide also provides a  
good, critical, programmer-friendly guide to AppleScript and  
application scripting principles; obviously a big chunk of the book is  
about AppleScript itself which might not be of so much interest to  
you, but I've heard at least one other non-AppleScript user say that  
they've found it helpful, albeit after a slow start (presumably the  
basic AppleScript language chapters).


HTH

has

[1] (With apologies to Theodosius Dobzhansky.)

[2] FWIW, it is an odd and unfamiliar way to do IPC, and there are a  
lot of real-life design and implementation shortcomings that make it  
much more difficult than it ought to be, but at a basic level it is a  
logical and self-consistent - and even somewhat elegant (if unusual) -  
system. The nearest analogy I can think of is using XPath queries over  
XML-RPC, if that helps.


--
Control AppleScriptable applications 

Re: Python, Mac OS X 10.5.5 and CoreGraphics

2008-10-03 Thread has

Ronny Reichmann wrote:

to make it short: Does anyone accidentally know why CoreGraphics  
doesn't
work any more on conjunction with Python? The directory that  
contains the
CoreGraphics bindings is still there, but not in the PYTHONPATH  
anymore.
Setting it by hand and trying to import CoreGraphics leads to a  
Fatal Python

error: Interpreter not initialized (version mismatch?)



Seems to work here (10.5.5). Are you using Apple's own Python  
installation, or a third-party one? (Apple's own CoreGraphics bindings  
are only intended to work with Apple's own Python installation.)  
That's the only thing I can think of offhand. If that's not it, you  
could also try asking for help over on the PythonMac-SIG mailing list:


http://mail.python.org/mailman/listinfo/pythonmac-sig

HTH

has
--
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Python, Mac OS X 10.5.5 and CoreGraphics

2008-10-03 Thread Bill Bumgarner

On Oct 3, 2008, at 5:02 PM, Ronny Reichmann wrote:

Hello there,

unfortunately none of the examples in /Developer/Examples/Quartz/ 
Python/ work anymore. I don't know if recently, I just encountered  
it today. According to your answer, there should be wrappers as part  
of PyObjC. Unfortunately the graphics examples from the PyObjC- 
website don't work either. In order to know what is wrong I would  
like to find out, if I'm probably having something running that's  
preventing my code and those examples from working properly.  
Especially before filing a bug, of course.


The Quartz based Python stuff predates PyObjC shipping with Mac OS X  
and is done in isolation; it is the SWIG wrapper based stuff.


If both it and the PyObjC based stuff is broken, then that raises a  
question -- are you running w/the system provided Python, or did you  
install some other Python distribution or update?


b.bum



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

[Moderator] Re: UITabBarController setViewControllers results in empty array of view controllers?

2008-10-03 Thread Scott Anguish

Sorry Liza,

Please re-read http://developer.apple.com/iphone/program/. The new  
list rules will be posted when the new program terms are.



For the moment this is still not for public discussion on this list.


Thanks

scott
[moderator]

On 3-Oct-08, at 4:35 PM, Liza Witz wrote:


Greetings-
I've recently refactored my iPhone app to stop using an XIB to load my
view controllers.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Play Playlist in iTunes

2008-10-03 Thread Mr. Gecko
I am not using AppleScript to do this, I am using AppleEvents, as you  
can see in code below. This is way faster than using AppleScript.


- (void)playPlaylist:(NSString *)playlist
{
OSErr err;
AppleEvent cmdEvent;

err = AEBuildAppleEvent(iTunesSignature,
ET_PLAY,
typeApplSignature,
iTunesSignature,
sizeof(iTunesSignature),
kAutoGenerateReturnID,
kAnyTransactionID,
cmdEvent,
NULL,
			'':obj { form:'name', want:'type'(cPly), seld:'utxt'(@),  
from:'null'() },

[playlist 
lengthOfBytesUsingEncoding:NSUnicodeStringEncoding],
[playlist 
cStringUsingEncoding:NSUnicodeStringEncoding]);

if (err != noErr) {
ETLog(@Error creating Apple Event: %d, err);
return;
}

	err = AESendMessage(cmdEvent, NULL, kAENoReply | kAENeverInteract,  
kAEDefaultTimeout);

if (err != noErr) {
ETLog(@Error sending AppleEvent: %d, err);
}
AEDisposeDesc(cmdEvent);
}

- (void)playTrack:(long)track ofPlaylist:(NSString *)playlist
{
OSErr err;
AppleEvent cmdEvent;

err = AEBuildAppleEvent(iTunesSignature,
ET_PLAY,
typeApplSignature,
iTunesSignature,
sizeof(iTunesSignature),
kAutoGenerateReturnID,
kAnyTransactionID,
cmdEvent,
NULL,
			'':obj { form:'indx', want:'type'(cTrk), seld:'long'(@),  
from:obj { form:'name', want:'type'(cPly), seld:'utxt'(@),  
from:'null'() } },

track,
[playlist 
lengthOfBytesUsingEncoding:NSUnicodeStringEncoding],
[playlist 
cStringUsingEncoding:NSUnicodeStringEncoding]);

if (err != noErr) {
ETLog(@Error creating Apple Event: %d, err);
return;
}

	err = AESendMessage(cmdEvent, NULL, kAENoReply | kAENeverInteract,  
kAEDefaultTimeout);

if (err != noErr) {
ETLog(@Error sending AppleEvent: %d, err);
}
AEDisposeDesc(cmdEvent);
}

I would prefer using AppleEvents because it is the right way to  
communicate with different things in the os, using cocoa.


Sorry if there was any mess understanding,
Mr. Gecko

P.S. this code was made with EyeTunes, framework, in mind so I used  
the available properties and references for creating the code so it  
would be all on the same track as the rest of the code in EyeTunes.


On Oct 3, 2008, at 8:18 PM, has wrote:


On 3 Oct 2008, at 17:09, Mr. Gecko wrote:


On Thu, Oct 2, 2008 at 9:52 PM, Mr. Gecko  wrote:

I know but I can't find out the AppleEvent for Play Playlist.
Is there some sort of a program that will parse the AppleScript  
and make an

cocoa AppleEvent code.


If you just want the raw four-char-codes from an application's  
dictionary so you can construct NSAppleEventDescriptors yourself,  
you can obtain them in various ways: [...]


I already looked at that but it doesn't have an actual code for  
Play Playlist
I found this though class name=playlist code=cPly  
description=a list of songs/streams inherits=item  
plural=playlists which if you look at the output of AEDebugSends  
than you can see that that is called when running the play playlist  
command.


I think you're a bit confused about how iTunes' Apple event API  
works. This is understandable, given how hopelessly inadequate 99%  
of scriptable applications' documentation is, along with the rather  
unusual, counter-intuitive way that Apple event IPC works in the  
first place.


Suffice it to say: nothing in AppleScript makes sense except in the  
light of RPC plus queries[1][2].


IOW, you can either approach it on its own terms and accept it for  
what it is, which will weird you out till you get your head around  
it; or else you can try to approach it in conventional OO terms, in  
which case it will frequently confuse and frustrate you whenever it  
behaves in a 

A way to use multiple colours with one NSBezierPath?

2008-10-03 Thread Michael Robinson

Hello again

I would like to draw one path, which is used as a border.

I naively assumed I could change the colour of the path as it is  
constructed, but it seems this is not the case.


If I change the colour (using [[NSColor blackColor] set]; for  
example), this changes the colour for the entire path.


Basically what I would like to know is:

Is it possible to use multiple colours in one line, as in the following:

Bottom + BR + BL corners = black
Right = Orange
Top + TR + TL corners = black
Left = Orange

Yes, I know this would be hideous, it is just an example.

I was attempting this by using [[NSColor aColor] set];  after each  
path element is drawn, but it is causing the whole path to take the  
value of the last set colour.


I would also like to say that I really appreciate the incredible  
amount of quality suggestions and advice I have received from this  
list, you're all wonderfully talented and kind.
Without your help I would have bashed my computer into little pieces  
long ago.


Mike

 No snowflake in an avalanche ever feels responsible.
-- Voltaire

___

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

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

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

This email sent to [EMAIL PROTECTED]


Accessing Menu in Another Nib

2008-10-03 Thread Kevin Ferguson

Greetings!

So, let's say I have a menu in a secondary NIB file that I plan to use  
as a status bar menu. Since the user may not want that menu to even  
exist, I don't want to load it if it doesn't need to be, so it's in a  
secondary nib file.


Is there any way to access that menu from that second nib file?

Basically, is there any way for me to load that second NIB file (using  
something like 'loadNibNamed:' or the like) and then get the menu that  
I have connected to the File's Owner 'menu' outlet, or is my only  
option to put the menu in the MainMenu NIB file and immediately  
release it if the user doesn't want it? (I find this an issue in case  
they decide they DO want it once the app loads)


-Kevin
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [Math] sin(), cos() not working? What special magic must I use to summon their powers?

2008-10-03 Thread Michael Robinson

On 2/10/2008, at 5:29 AM, David Duncan wrote:


On Oct 1, 2008, at 5:46 AM, Michael Robinson wrote:


Unsurprisingly, I need my hand held again.

1. how do I initialize a CGShading object, with my two colours  
(left right/top bottom)


See the Quartz 2D Shadings sample at http://developer.apple.com/samplecode/Quartz2DShadings/index.html 

The sample code runs on 10.5, but the shadings code should work on  
10.4 as well (the sample only runs on 10.5 because it also uses the  
CGGradientRef APIs).




Thank you for this, but it confuses my feeble mind.

Instead I happened upon the NSGradient object, and used that while I  
built other parts of the image creation section of my plugin.


Now I'd like to replace this:

	NSGradient* aGradient = [[[NSGradient alloc]  
initWithColorsAndLocations:[gradientColour1 color], (CGFloat)0.0,  
[gradientColour2 color], (CGFloat)1.0,nil] autorelease];


		[aGradient drawInBezierPath:aPath angle:[gradientOpacitySlider  
floatValue]];


With a 10.4 compatible solution.

Though I'm sure the solution *is* in the project you referred me too,  
I can' t see it.  I apologize for my ineptitude.


Is there a one-liner I can use to replace my current code?

Thank you for your patience

Mike



2. how do I fill my NSBitmapImageRep with this pretty gradient?



Create an NSGraphicsContext with the image rep, then get the  
CGContext from the NSGraphicsContext. The latter is shown in the  
sample above, although the former is not.

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


Re: NSOutlineView assertion failures

2008-10-03 Thread Jeff Wilcox
Not explicitly, but maybe.  This seems to be taking place when the  
content for the NSTreeController is changing (explicitly) in one  
thread, causing a reload in the outline view,  and in another thread  
the NSOutlineView's drawrect is getting called.  I can't say for sure  
that this accounts for all of the cases but that seems like a common  
theme.


Thoughts?

On Oct 3, 2008, at 6:10 PM, Uli Kusterer wrote:


On 04.10.2008, at 03:00, Jeff Wilcox wrote:
I seemed to be able to make this go away by subclassing the outline  
view and locking it down before starting a reload or evaluating the  
number of rows (found mostly by lots or trial and error) with the  
following:



Wait, you're not calling numberOfRows and reloadData on an outline  
view from another thread, are you?


Cheers,
-- Uli Kusterer
The Witnesses of TeachText are everywhere...
http://www.zathras.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 [EMAIL PROTECTED]