Re: Get error message about registered observers when Object receives dealloc message

2009-08-31 Thread Graham Cox


On 30/08/2009, at 7:46 PM, Andreas Grosam wrote:


This is not exactly what I got in the console. Actually it is:
"An instance 0xd21b60 of class MyObservee is being deallocated while  
key value observers are still registered with it. "


Notice:  "is being deallocated"

This is also **exactly** what happens in my code: the dealloc method  
has been sent to the observed object and - at this point - KVOs are  
still registered.



What I can't quite follow Andreas, is that *you* must be sending the - 
release message to the object, which in turn is calling dealloc. So  
why not just stop observing before you call release? That's what  
you're supposed to do. Call me dense (feel free!) but if you are  
unable to do that because of the design of your code, the code design  
needs to be fixed. Simple as.


I believe all the discussion about the logging of error messages is a  
red herring. If your code is broken, it's broken. Arguing about  
exactly which version words the message which way isn't helping you  
fix it. If the problem is that you are not retaining to avoid a retain  
cycle, and therefore are not in control of the release such that you  
can't stop observing just prior, that to me indicates a broken design.  
That's what you need to be sorting out.


As I understand it you have a situation where nodes of a tree are  
observing other nodes (sibling or otherwise) in the same tree, but at  
the same time these nodes are owned by their parent nodes, so cannot  
retain the other nodes that they are observing. Forgive my bluntness,  
but it sounds like a bad data structure design that was the product of  
one too many tequilas late on a Friday night! If a node even needs to  
observe another node in order to fulfil its function, maybe a tree  
structure isn't even the right design at all? Your solution of having  
some sort of shutdown message blowing all over your leaves is a band- 
aid on a gaping wound. Instead, why not strictly forbid nodes from  
observing other nodes, and instead move messages only along the  
branches. If a node needs to know what another node has done, it can  
do so because the single common node (or root) between the two passes  
that message. It means that the only KVO observers of a node allowed  
are its parent nodes (or root), which already owns it so it can simply  
stop observing when the child node is released.


--Graham


___

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

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

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

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


CGEventTap code fails on Snow Leopard

2009-08-31 Thread Rick Mann
Hi. A while back I wrote a little program to remap the right-side  
option key to be enter (on Al MacBook Pros). It works great, but since  
installing snow leopard, it runs for a while, then gets an unexpected  
event (type -2) and then never gets another event.


It's pretty simple code. Only if a key down/key up event comes in does  
it do anything; otherwise it just returns the passed-in event.


It's not clear what causes the type -2 event to come in (really, it's  
type 0xFFFE). However, it seems that it always happens in response  
to pressing the remaped option key, and in that instance what I see is  
a key down on the LEFT option key, and no key up. Just the weird event.


Any ideas?

--
Rick

___

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

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

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

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


Re: _NSAutoreleaseNoPool missing in Snow Leopard

2009-08-31 Thread Jean-Daniel Dupas


Le 31 août 2009 à 02:27, Seth Willits a écrit :


On Aug 30, 2009, at 2:05 PM, Keith Duncan wrote:

Does anyone know what I *should* be breaking on? I'd obviously  
like to track this down.


A fallback option is to break on NSLog/printf to see where that  
message is being output from, but you could be using those  
frequently elsewhere depending on what you're writing.



Yeah, I tried to break on NSLog and it didn't break on that. Given  
the format of the message (extra display of the time etc) which only  
occurs with NSLog I didn't try printf, but I suppose I should have  
anyway.




On Aug 30, 2009, at 2:35 PM, Kyle Sluder wrote:

Check the 10.6 Foundation release notes. A lot of this stuff was  
removed with no replacement.


Hmm. Ok, so I just looked and the release notes say it's now simply  
named __NSAutoreleaseNoPool, but that is again not in the symbol  
list and does not work if I try to break on it with the debugger.  
That was actually what I tried first until I remembered the extra  
underscore typically being added. I then moved on to no underscores  
even.




It is in CoreFoundation with two underscores, not in Foundation.


___

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

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

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

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


system(root) locale

2009-08-31 Thread Maggie Zhang
Hi,
Does anyone know how to get the root locale in Objective-c or C or using
Unix commands? I tried NSLocale but it didn't give what I want. Though I can
get the user's current locale in different ways.

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


Re: NSScroller width

2009-08-31 Thread Massimiliano Gargani

Thanks a lot,

I had to subclass also the scroll view but it partially works.

Now my code is:

@implementation MyScroller

+ (CGFloat)scrollerWidth {
return 40.0f;
}

+ (CGFloat)scrollerWidthForControlSize:(NSControlSize)controlSize
{
return 40.0f;
}

- (void)drawRect:(NSRect)rect
{
[self drawKnobSlot];
[self drawKnob];
}

- (void)drawKnob
{
NSRect rect = [self rectForPart:NSScrollerKnob];
rect.origin.x =0;
rect.size.width = 40;

[[NSColor darkGrayColor] set];
[NSBezierPath fillRect:rect];
}

- (void)drawKnobSlot
{
NSRect rect = [self rectForPart:NSScrollerKnobSlot];
rect.origin.x = 0;
rect.size.width = 40;
[[NSColor grayColor] set];
[NSBezierPath fillRect:rect];
}

@end


The knob's width is still 15.0f

As you can see from image here:

http://img30.imageshack.us/img30/3586/immagine1jvf.png

the knob's rect is splitted in 2 rects:

the right rect works fine and scroll my table, the left rect doesn't  
scroll and if i try to click on it or drag it it moves the windo to  
its origin.x and y


I found no documentation about a knobwidth or something.

Thanks for any help or hints.

Max



Il giorno 30/ago/09, alle ore 21:20, Brandon Walkin ha scritto:

Use +scrollerWidth and +scrollerWidthForControlSize. Here's a custom  
scroller subclass from BWToolkit which might help you out: http://bitbucket.org/bwalkin/bwtoolkit/src/tip/BWTransparentScroller.m


Brandon

On 2009-08-30, at 5:25 AM, Massimiliano Gargani wrote:


Hi there,

I've googled a lot before post this question but I'm stucked.

I'm trying to subclassing NSScroller to change the aqua look and,  
most important, to change the width of the vertical scroll bar.


My subclass is:

- (void)drawRect:(NSRect)rect
{
 [self drawKnobSlot];
 [self drawKnob];
}

- (void)drawKnob
{
 NSRect rect = [self rectForPart:NSScrollerKnob];
 [[NSColor darkGrayColor] set];
 [NSBezierPath fillRect:rect];
}

- (void)drawKnobSlot
{
 NSRect rect = [self rectForPart:NSScrollerKnobSlot];
 [[NSColor grayColor] set];
 [NSBezierPath strokeRect:rect];
}

It works and change the look as I want but not the width. I tried  
to set rect width but is not the right way because the rect goes  
beyond the scrollview.


Any help is appreciated.

Thanks,
Max

___

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

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

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

This email sent to bwal...@gmail.com




___

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

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

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

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


Build error

2009-08-31 Thread Mahaboob
I changed the Active Build configuration to Distribution and then select the
code signing identity to my distribution profile as suggested in the iPhone
Developer portal. Then I build the application. But,I got the following
message:

File /../.../.../...xxx.app depends on itself. This target might include
its own product.

I'm using Xcode 3.1 and iPhone OS 2.2.

How can I fix this error?

Thanks in advance
Mahaboob


___

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

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

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

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


Re: pulldown in custom NSCell

2009-08-31 Thread Georg Seifert

Hi corbin and Andreas,

Both approaches look promising. I will play with them.

Thanks
Georg



What I found is that the Cell, in its drawwithFrame method, adds  
subview to the TableView and this subview handles all the drawing  
and handling. Is this appropriate or is there a better solution.


In case you don't need a fully fledged TableView, have a look at  
this and see if it fits your bill:


http://www.harmless.de/cocoa-code.php#collectionview


___

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

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

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

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


Re: Build error

2009-08-31 Thread Roland King

1) read the error message and attempt to understand it

2) see if the error message applies and you have in fact included the 
product in its own target


3) if 1) and 2) don't work mail the XCode list because this isn't a 
cocoa question


Mahaboob wrote:

I changed the Active Build configuration to Distribution and then select the
code signing identity to my distribution profile as suggested in the iPhone
Developer portal. Then I build the application. But,I got the following
message:

File /../.../.../...xxx.app depends on itself. This target might include
its own product.

I'm using Xcode 3.1 and iPhone OS 2.2.

How can I fix this error?

Thanks in advance
Mahaboob


___

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

Please do not post admin requests or moderator comments to the list.
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 r...@rols.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 arch...@mail-archive.com


refresh issue with QLPreviewPanel..!

2009-08-31 Thread Naresh Kongara

Hi,

I have  an app in which i need to display the view to be printed in  
QuickLook preview. For this i thought os using the  
(QlPreviewPanel)QuickLookUI.framework which is available at /System/ 
Library/PrivateFrameworks.


QLPreviewPanel class is obtained using

#define QLPreviewPanel NSClassFromString(@"QLPreviewPanel")

and the QuickLookUI framework is loaded as below.

[[NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/ 
QuickLookUI.framework"] load];


Using NSPrintOperation i'm saving the View to be printed a path say  
PDFPath.

Then i'm passing the PDFPath URL to previewPanel as below.

		[[QLPreviewPanel sharedPreviewPanel] setURLs:[NSArray  
arrayWithObject:[NSURL fileURLWithPath:PDFPath]]];

[[QLPreviewPanel sharedPreviewPanel] makeKeyAndOrderFront:self];


The above code is working fine for the first time. If i close the  
panel  and change the view to be printed(Which inturn changes the  
file  at PDFPath).Now if the panel is shown again with above 2 lines  
of code then the panel is not showing the updated one, it is showing  
the previous view only.
If we wait for some time to show the panel, then it is showing the  
correct view only.

There is no problem with file at PDFPath.
I don't know why the preview panel is taking the time to refresh.

If any one has the idea on it, Please let me know.





Thanks,
Naresh Kongara
naresh.kong...@prithvisolutions.com




___

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

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

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

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


Errors & Warnings Smart Group Missing from XCode 3.2

2009-08-31 Thread Peter Ferrett


I have installed XCode 3.2 from the Snow Leopard Disc and find that  
the Errors & Warnings smart group is missing.  I cannot find any way  
to view a list of warnings during compile.  Wondering if anyone else  
has experienced this & found a fix.



___

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

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

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

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


Re: _NSAutoreleaseNoPool missing in Snow Leopard

2009-08-31 Thread Klaus Backert


On 31 Aug 2009, at 03:50, Kyle Sluder wrote:

Except his previous stack trace seems to indicate that the at-fault  
code is in QTKit…


When logging image and library names as they are loaded and calls to  
class and category +load methods it looks like you can see below.  
Interestingly -- or not interestingly? -- +[QTMovieContentView load]  
is called before the autorelease error message appears.


...
Running…
Blotto(388) malloc: enabling scribbling to detect mods to free blocks
objc[388]: OBJC_PRINT_OPTIONS is set
objc[388]: OBJC_PRINT_IMAGES is set
objc[388]: OBJC_PRINT_LOAD_METHODS is set
objc[388]: OBJC_PRINT_CXX_CTORS is set
objc[388]: OBJC_DISABLE_GC is set
objc[388]: IMAGES: processing 109 newly-mapped images...

objc[388]: IMAGES: loading image for /usr/lib/libobjc.A.dylib  
(supports GC)




objc[388]: IMAGES: loading image for /System/Library/Frameworks/ 
AppKit.framework/Versions/C/AppKit (supports GC)


objc[388]: IMAGES: loading image for /System/Library/Frameworks/ 
QTKit.framework/Versions/A/QTKit (supports GC)


objc[388]: IMAGES: loading image for /Volumes/C/Development/Projects/ 
Blotto/build/Debug/Blotto.app/Contents/MacOS/Blotto


objc[388]: GC: forcing GC OFF because OBJC_DISABLE_GC is set
objc[388]: LOAD: class 'NSObject' scheduled for +load
objc[388]: LOAD: +[NSObject load]



objc[388]: LOAD: +[NSApplication load]

 invoking at /Volumes/C/Development/ 
Projects/Demokrit/DktWorld.cpp:18
 initialize ODE library at /Volumes/C/ 
Development/Projects/Demokrit/DktWorld.cpp:21

objc[388]: LOAD: class 'QTMovieContentView' scheduled for +load
objc[388]: LOAD: +[QTMovieContentView load]

(gdb) continue
objc[388]: IMAGES: checking 1 images for compatibility...
objc[388]: IMAGES: processing 18 newly-mapped images...

2009-08-31 12:18:36.793 Blotto[388:813] *** _NSAutoreleaseNoPool():  
Object 0xa0c13290 of class NSCFString autoreleased with no pool in  
place - just leaking
Stack: (0x94350dac 0x9427de14 0x9134ca24 0x940bcab4 0x940bc934  
0x940bb010 0x96df69d8 0x940c49b0 0x940bd4ec 0x8fe02d7c 0x8fe0f220  
0x8fe0f198 0x8fe0f36c 0x8fe03848 0x8fe08144 0x8fe01774 0x8fe01048)

(gdb)

This all is on Leopard. I haven't had the opportunity of testing this  
on Snow Leopard.


Klaus

___

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

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

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

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


Re: Errors & Warnings Smart Group Missing from XCode 3.2

2009-08-31 Thread I. Savant

On Aug 31, 2009, at 7:25 AM, Peter Ferrett wrote:



I have installed XCode 3.2 from the Snow Leopard Disc and find that  
the Errors & Warnings smart group is missing.  I cannot find any way  
to view a list of warnings during compile.  Wondering if anyone else  
has experienced this & found a fix.



  Please post Xcode-specific requests to the xcode-users list. This  
has nothing at all to do with Cocoa.


--
I.S.


___

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

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

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

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


View Swapping Issue.

2009-08-31 Thread Philip Juel Borges

Hi,

I'm using code from ViewController to swap between views in my app,  
which works fine.
In my app one view is named IndexView.xib and that contains one  
tableview and one webview and an NSObject called IndexViewController.h/m


Recently, I discovered how to shift the focus from the tableview to  
the webview whenever you make a selection in the tableview, using  
makeFirstResponder.


It works fine if all objects, i.e. tableview and webview, are  
contained in the MainMenu.xib file, or in just one xib file, because  
then you can set the NSWindow outlet called mainWindow to the window  
object called HostWindow. However, the problem is that the various  
view-files (and in this case IndexView.xib) don't contain the window  
object since they are swapped into the CustomView of the HostWindow in  
the MainMenu.xib file.


The code from the IndexViewController.m to shift focus is [mainWindow  
makeFirstResponder: webView];


So I need to figure out how I can connect the mainWindow outlet to the  
HostWindow in the MainMenu.xib file from the IndexView.xib file.


Any ideas? I hope I have explained it well enough. Hope somebody can  
help.


Philip
___

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

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

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

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


Re: View Swapping Issue.

2009-08-31 Thread Graham Cox


On 31/08/2009, at 10:08 PM, Philip Juel Borges wrote:

The code from the IndexViewController.m to shift focus is  
[mainWindow makeFirstResponder: webView];


So I need to figure out how I can connect the mainWindow outlet to  
the HostWindow in the MainMenu.xib file from the IndexView.xib file.



Or not - you could just do:

[[webView window] makeFirstResponder:webView];

When a view is installed its -window method will return the window  
that hosts it. If it's not installed, it will return nil, but in that  
case, you wouldn't be making it the first responder...


--Graham


___

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

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

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

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


How To Unbind

2009-08-31 Thread Richard Somers

I have a controller.

 NSArrayController *controller;

Then I establish a binding programmatically which works fine.

 [controller bind:@"managedObjectContext"
 toObject:self
  withKeyPath:@"managedObjectContext"
  options:nil];

Then I unbind programmatically which does not work. By does not work I  
mean that there is no error produced and the binding still remains in  
place.


 [controller unbind:@"managedObjectContext"];

The managedObjectContext property of self changes. So I bind, unbind,  
and then rebind programmatically. Does anyone know why the unbind does  
not work?


Richard

___

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

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

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

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


Re: Errors & Warnings Smart Group Missing from XCode 3.2

2009-08-31 Thread Graham Cox


On 31/08/2009, at 9:25 PM, Peter Ferrett wrote:

I have installed XCode 3.2 from the Snow Leopard Disc and find that  
the Errors & Warnings smart group is missing.  I cannot find any way  
to view a list of warnings during compile.  Wondering if anyone else  
has experienced this & found a fix.



While off-topic, the quick answer seems to be that you can display  
this in the "Build Results" pane, ordered "By Issue".


--Graham


___

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

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

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

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


Re: learning the NSView structure of an app?

2009-08-31 Thread sag lists

Great feedback guys, thanks for the 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 arch...@mail-archive.com


Re: What sound plays after an Installer runs?

2009-08-31 Thread Steven Degutis
Aaron,
The sound played is not part of Cocoa if I recall correctly. It is located
inside Installer.app's Resources directory and you can thus technically take
it out and use it in your app, if you're alright with that sort of thing.

-- 
Steven Degutis
http://www.thoughtfultree.com/
http://www.degutis.org/


On Sun, Aug 30, 2009 at 11:56 PM, aaron smith <
beingthexemplaryli...@gmail.com> wrote:

> Hey All,
>
> Does anyone know which sound plays after an Installer package runs?
> (When the Green Circle with checkmark shows).
>
> 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/steven.degutis%40gmail.com
>
> This email sent to steven.degu...@gmail.com
>
___

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

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

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

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


Re: outlineView:dataCellForTableColumn:item: repeated called w null tableColumn on Snow Leopard

2009-08-31 Thread Corbin Dunn


On Aug 28, 2009, at 5:31 PM, David Melgar wrote:



On Aug 28, 2009, at 6:13 PM, Corbin Dunn wrote:



On Aug 28, 2009, at 3:07 PM, David Melgar wrote:


I printed out all the calls.

What happening is:
1. My data source/delegate/controller initWithCoder method is  
invoked. But its pointer to the document is not valid yet so it  
doesn't have data.
2. outlineView:numberOfChildrenOfItem: method is invoked. It  
cannot access the document and returns 0.


That's fine.

3. awakeFromNib is called. The root object (document) is now  
correct.


It doesn't seem correct that the view is asking for  
numberOfChildren before awakeFromNib was called.


You are right, but some applications depend on this behavior, and  
eventually we may change it (it isn't a cut and dry thing to  
change). Returning 0 base on your root object not being available  
is the correct thing do to, and calling -reloadData inside  
awakeFromNib is a good idea (but shouldn't be required).


Thank you!! Just the workaround I needed. Calling [view reloadData]  
in awakeFromNib appears to have fixed it. I've tried it a mess of  
times and it's never failed. In my debug output I still see a bunch  
of calls in a row to dataCellForTableColumn with a null tableColumn,  
but then reloadData is called and a proper set of methods are  
invoked against my data source and delegate.


I was not calling reloadData in Leopard and had never had an issue  
with it.


For some reason, your application may be doing something early (ie:  
before awakefromNib) that requires the datasource methods be filled in  
(ie: asking for the -numberOfRows in the table, which can happen from  
may different methods via side effects).


Ideally, you shouldn't have to call -reloadData for a case like yours.  
But, a general recommendation is to always call -reloadData when the  
datasource model has changed.







4. A series of calls to outlineView:dataCellForTableColumn:item:  
where tableColumn is passing in nil. I return nil.


It should call you once with nil, and once again with the  
tableColumn non-nil, provided you returned nil the first time.


Unfortunately, there isn't enough info to really gather what is  
wrong. I would suggest simplifying things to narrow down the  
problem. If you think it is a bug in AppKit, please do log a bug  
report. Ideally, if you can, include a sample application that  
reproduces the problem.
For a sample application, do they need source or is a binary  
sufficient?
I have run into two other apparent Snow Leopard bugs, so I guess I  
need to figure out the process. :)


We usually prefer small-source code examples that illustrate the  
problem, but I realize that can sometimes be difficult to provide, so  
access to a binary is also acceptable. The latter takes longer to debug.


http://bugreporter.apple.com

--corbin





Things I suggest looking at:
1. Do you subclass NSTableView? If so, try removing that subclass.

I am using NSOutlineView and not subclassing it.
2. Does it work if you remove the  
outlineView:dataCellForTableColumn:item method entirely and use the  
regular cell in the table column?
Interestingly, even commenting out dataCellForTableColumn, it still  
fails. I end up with no calls to the datasource/delegate other than  
the initial numberOfChildren call. It results in an empty  
NSOutlineView.




-corbin

Thanks again!!












If that is appropriate, how can I insure that I have valid data  
before awakeFromNib is called?


If it matters, I'm running a 32bit build.

Thanks

On Aug 28, 2009, at 3:45 PM, Corbin Dunn wrote:



On Aug 28, 2009, at 11:58 AM, David Melgar wrote:

Running into a problem getting my application to run under Snow  
Leopard.


In this case I have an outline view with a data source. The  
method, outlineView:dataCellForTableColumn:item: is being  
repeated called on my delegate with a null tableColumn, not just  
the first time as the documentation states. The code returns  
different cells based on the column, but its never passed the  
tableColumn.


I haven't heard of this problem. Try printing out all calls to  
the method (include parameters), and printing out what you are  
returning each time.


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


How to use NSTextView's new -checkTextInRange:types:options:?

2009-08-31 Thread Keith Blount
Hello,

I am trying to force text checking in an NSTextView on Snow Leopard using the 
new -checkTextInRange:types:options: method, but I can't seem to get this 
method to work at all. I am aware that the documentation clearly states that 
"this method *usually* would not be called directly" (although it does not say 
"never" or "should not be") as NSTextView calls it from its various text 
checking methods automatically, but my text view subclass adds other types of 
substitutions which mean I need to force text checking on the built-in types 
either before or after making my custom substitutions. (For instance, I have an 
auto-capitalisation method that gets called in -textDidChange:. If 
auto-capitalisation alters a word that is in the system "substitutions" list, 
though, it prevents substitutions from happening, presumably because the 
changed range gets affected before the substitutions code gets called. 
Therefore in the situation where auto-caps is going to change
 the text, I need to force text checking beforehand.)

The -checkTextInRange:types:options: method doesn't seem to work as expected, 
though, presumably because the documentation is new and doesn't explain it 
properly as yet. For instance, I would expect this:

// (Note that "self" here is an NSTextView subclass.)
[self checkTextInRange:NSMakeRange(0,[[self textStorage] length]) types:[self 
enabledTextCheckingTypes] options:nil];

to have the same effect as this:

[self checkTextInDocument:nil];

or this:

[self setSelectedRange:NSMakeRange(0,[[self textStorage] length])];
[self checkTextInSelection:nil];

But it doesn't. Both of the latter methods - the action methods - work as 
expected, checking and replacing the text where necessary - but the code using 
-checkTextInRange:types:options: directly apparently does nothing at all - no 
text gets replaced. (Even though the docs clearly describe the method thus: 
"Check and replace the text in the range using the specified checking types and 
options.")

(Note: [self enabledTextCheckingTypes] is not 0 - it includes quotes and text 
replacement etc; hence the two action methods work. So I'm not doing anything 
as silly as passing the method no checking types.)

I can get my auto-caps to work with the new substitution methods if I just use 
-checkTextInSelection:, setting the selection before calling it and resetting 
the selection immediately afterwards, but this is a bit of a kludge and I would 
rather use the -checkTextInRange:... method directly if at all possible.

Has anybody tried this new method, encountered similar problems or found a 
solution? Is there something I need to do in conjunction with this method to 
get it working?

Many thanks in advance and all the best,
Keith


  
___

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

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

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

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


AppleScript crashing and garbage collection

2009-08-31 Thread jonat...@mugginsoft.com
Some time ago we learnt that compiling AppleScript in a GC app is  
unpredictable:


http://www.cocoabuilder.com/archive/message/cocoa/2008/4/22/204897

It was stated:

FROM : Mark Piccirelli
DATE : Tue Apr 22 22:16:12 2008

Yes. But we intend to fix it in a software update. (And I can't say
anything more specific than that. A fix isn't a fix until it's shipped.)

   -- Mark


This still seems to be an issue on 10.5.7.
Does anyone know if SL has the fix in place?

Jonathan Mitchell

Developer
http://www.mugginsoft.com





___

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

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

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

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


Re: AppleScript crashing and garbage collection

2009-08-31 Thread I. Savant

On Aug 31, 2009, at 10:31 AM, jonat...@mugginsoft.com wrote:

Some time ago we learnt that compiling AppleScript in a GC app is  
unpredictable:

...

This still seems to be an issue on 10.5.7.
Does anyone know if SL has the fix in place?


  Yes. This was specifically mentioned in the release notes.

--
I.S.




___

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

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

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

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


NSCollectionView item selection on Snow Leopard

2009-08-31 Thread Markus Spoettl

Hello,

  I have an NSCollectionView that used to work normally on Leopard,  
when the App is running on Snow Leopard, item selection using the  
mouse by clicking on it doesn't work correctly.


When clicking on an item in the bottom-most visible row, instead of  
selecting that item the collection view scrolls down a row (unless  
there is no item visible lower than the item that is clicked on).


Does anyone else see this issue?

Regards
Markus
--
__
Markus Spoettl



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

Re: AppleScript crashing and garbage collection

2009-08-31 Thread jonat...@mugginsoft.com


On 31 Aug 2009, at 15:33, I. Savant wrote:


On Aug 31, 2009, at 10:31 AM, jonat...@mugginsoft.com wrote:

Some time ago we learnt that compiling AppleScript in a GC app is  
unpredictable:

...

This still seems to be an issue on 10.5.7.
Does anyone know if SL has the fix in place?


 Yes. This was specifically mentioned in the release notes.


Thanks for the pointer. The notes say:

Bug Fix in NSAppleScript Running Garbage-Collected

In Mac OS 10.5 there was a bad bug in NSAppleScript that rendered it  
effectively incompatible with garbage collection. The symptoms were  
frequent crashes and spurious returning of errors. This bug has been  
fixed since Mac OS 10.5.3.


Can anyone confirm that 10.5.3 fixed this issue?


--
I.S.






Jonathan Mitchell

Developer
http://www.mugginsoft.com





___

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

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

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

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


Re: What sound plays after an Installer runs?

2009-08-31 Thread Alastair Houghton

On 31 Aug 2009, at 15:15, Steven Degutis wrote:


Aaron,
The sound played is not part of Cocoa if I recall correctly. It is  
located
inside Installer.app's Resources directory and you can thus  
technically take
it out and use it in your app, if you're alright with that sort of  
thing.


*Technically* (since it's the word you used), that's copyright  
infringement, unless the owner of the aforementioned sound file (in  
this case Apple) says you can.


In practice, Apple seems to adopt a fairly relaxed attitude towards  
this kind of thing *provided* you're using system assets in the same  
context and with the same meaning.  If you were e.g. to use the sound  
in a computer game or to use it in a Windows or Linux program... well  
it wouldn't surprise me if you ended up being the recipient of a  
nastygram from Apple Legal.


I'll also note one more thing; while Apple may be relaxed about these  
kinds of issues, it may or may not pay for you to be as relaxed.  If,  
for instance, you ended up somehow in a legal dispute with Apple later  
down the line, Apple might very well decide that to raise the issue of  
your infringement of Apple copyrights, *even if* nobody has previously  
complained about the matter.  If on the other hand you happen to be in  
possession of a piece of paper saying it's OK, then they can't really  
complain.


Most people don't seem to worry too much about this and just go ahead  
and "borrow" things from the system, but it's worth realising that  
there is a risk even if you don't see one.


IIRC someone from Apple made a statement a while back about  
developers' use of assets (I think in the context of icons, though I'm  
not certain), but I don't recall where or with what degree of  
authority.  Anyone remember?


Kind regards,

Alastair.

--
http://alastairs-place.net

___

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

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

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

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


Re: What sound plays after an Installer runs? [OT]

2009-08-31 Thread Greg Guerin

Alastair Houghton wrote:

*Technically* (since it's the word you used), that's copyright  
infringement, unless the owner of the aforementioned sound file (in  
this case Apple) says you can.



Technically, it MAY be copyright infringement.  We don't know the  
owner of the sound, nor its provenance.  It could be public domain or  
open source, or it could be licensed from another source, or Apple  
could be the copyright holder.  We don't know.


And it's all off topic.

  -- GG
___

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

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

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

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


Re: Right-to-Left / Bidi / Arabic / Hebrew support in my app

2009-08-31 Thread Marc Wandschneider
Thanks for the feedback.  In general, I've found that while the controls do,
indeed, seem to align the text correctly for input in bidi locales, there is
little support in things like IB for putting the label on a box at the top
right instead of the top-left, and also in code for determining what the
current writing direction is.

For example, I have a list I print out in my photo viewer that looks like:

Filename | DSC0001.jpg
Size | 2072 x 2048 pixels

that should be:

DSC0001.JPG | [al-Filename]
3072 x 2048 pixels | [al-Size]

in Arabic / Hebrew, etc ...

It looks like I'll just have to use other controls to do the same effect in
IB, and just check of locale.name == "ar" || "he" in code to do the reverse
drawing.


Still kinda shocked that this is it ...  Must be a lot of english speakers
in the middle east :)



2009/8/28 Gideon King 

> NSCell, NSControl, NSText, NSParagraphStyle etc all have
> baseWritingDirection getters and setters which may be of some help...I
> believe the writing direction is determined on a paragraph by paragraph
> basis, but unless explicitly set uses the Unicode Bidi Algorithm rules P2
> and P3.
>
> In many cases, people writing in an RTL locale need to include English in
> the text too, and the text system handles this nicely - I have seen this
> often with our NovaMind users creating Mind Maps in Hebrew and Arabic.
>
> I wasn't directly involved in the localization into Hebrew, but I believe
> that the controls just did the right thing - I certainly can't see any code
> that we had to put in to explicitly support it. Hope this helps.
>
> Gideon
>
>
> On 27/08/2009, at 12:35 PM, Marc Wandschneider wrote:
>
>  Hello!
>> I recently received an Arabic translation for my application JustLooking,
>> and have started looking at how to integrate the strings I was given.
>> Unfortunately, I'm not finding much documentation or visual indications in
>> apps like Interface Builder on how to enable RTL support.
>> ...
>>
>
>
___

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

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

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

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


Re: Right-to-Left / Bidi / Arabic / Hebrew support in my app

2009-08-31 Thread Benjamin Stiglitz
> It looks like I'll just have to use other controls to do the same effect in
> IB, and just check of locale.name == "ar" || "he" in code to do the reverse
> drawing.

On 10.6 your heuristic should instead mirror the value of the new
-userInterfaceLayoutDirection accessor in NSApplication (and NSCell).

>From the release notes:
NSApplication
-userInterfaceLayoutDirection is a new NSApplication interface that
returns the default layout directionality of general user interface flow
for the running application. The method returns
NSUserInterfaceLayoutDirectionRightToLeft when running with
localizations such as Arabic or Hebrew that should have the user
interface layout origin on the right edge of the coordinate system.


NSCell (Updated since WWDC 2008)
NSCell now has -userInterfaceLayoutDirection and
-setUserInterfaceLayoutDirection:. This new property describes the
in-cell layout directionality. For NSCell subclasses that have multiple
visual components in a single cell instance, this property should
specify the directionality or flow of components.

-Ben
___

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

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

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

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


Re: Finding information about deprecated methods / what replaces them?

2009-08-31 Thread David Duncan

On Aug 30, 2009, at 6:12 PM, Joar Wingfors wrote:

The documentation should, IMO, point you to the replacement API if  
there is any, and probably also tell you if there isn't. I'd suggest  
that you file bug reports on the documentation if it doesn't:






Joar makes an excellent point, and you should file a bug report (or at  
least use the feedback links in the docs) to mention this.


In the mean time however, you will often find that comments in the  
header files themselves will point you to useful information in these  
cases. In this case the replacement appears to be  
CGDisplayCopyDisplayMode.

--
David Duncan
Apple DTS Animation and Printing

___

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

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

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

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


Re: What sound plays after an Installer runs? [OT]

2009-08-31 Thread Alastair Houghton

On 31 Aug 2009, at 16:12, Greg Guerin wrote:


Alastair Houghton wrote:

*Technically* (since it's the word you used), that's copyright  
infringement, unless the owner of the aforementioned sound file (in  
this case Apple) says you can.


Technically, it MAY be copyright infringement.  We don't know the  
owner of the sound, nor its provenance.  It could be public domain  
or open source, or it could be licensed from another source, or  
Apple could be the copyright holder.  We don't know.


How does that differ from what I wrote?  (Answer: it doesn't)


And it's all off topic.


I do agree that it isn't something we need debate at any length; I  
just thought that someone else might be able to locate the previous  
statement from Apple on the matter (since I don't recall where it  
was).  I'm sure there was one, I just can't find it.


Kind regards,

Alastair.

--
http://alastairs-place.net



___

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

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

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

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


Re: Right-to-Left / Bidi / Arabic / Hebrew support in my app

2009-08-31 Thread Ken Ferry
On Aug 31, 2009, at 8:51 AM, Marc Wandschneider > wrote:


Thanks for the feedback.  In general, I've found that while the  
controls do,
indeed, seem to align the text correctly for input in bidi locales,  
there is
little support in things like IB for putting the label on a box at  
the top

right instead of the top-left,


NSBox in 10.6 will draw the label on the right side whenever - 
[NSApplication userInterfaceLayoutDirection] is right to left.


-Ken


and also in code for determining what the
current writing direction is.

For example, I have a list I print out in my photo viewer that looks  
like:


Filename | DSC0001.jpg
Size | 2072 x 2048 pixels

that should be:

DSC0001.JPG | [al-Filename]
3072 x 2048 pixels | [al-Size]

in Arabic / Hebrew, etc ...

It looks like I'll just have to use other controls to do the same  
effect in
IB, and just check of locale.name == "ar" || "he" in code to do the  
reverse

drawing.


Still kinda shocked that this is it ...  Must be a lot of english  
speakers

in the middle east :)



2009/8/28 Gideon King 


NSCell, NSControl, NSText, NSParagraphStyle etc all have
baseWritingDirection getters and setters which may be of some  
help...I
believe the writing direction is determined on a paragraph by  
paragraph
basis, but unless explicitly set uses the Unicode Bidi Algorithm  
rules P2

and P3.

In many cases, people writing in an RTL locale need to include  
English in
the text too, and the text system handles this nicely - I have seen  
this
often with our NovaMind users creating Mind Maps in Hebrew and  
Arabic.


I wasn't directly involved in the localization into Hebrew, but I  
believe
that the controls just did the right thing - I certainly can't see  
any code

that we had to put in to explicitly support it. Hope this helps.

Gideon


On 27/08/2009, at 12:35 PM, Marc Wandschneider wrote:

Hello!
I recently received an Arabic translation for my application  
JustLooking,
and have started looking at how to integrate the strings I was  
given.
Unfortunately, I'm not finding much documentation or visual  
indications in

apps like Interface Builder on how to enable RTL support.
...





___

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

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

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

This email sent to kenfe...@gmail.com


___

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

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

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

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


I can't find it in the docs so I know I'm missing it some where

2009-08-31 Thread Development
Are apps that are offered for free not allowed to use the store kit?  
It seems foolish to have an app the requires a subscription that is  
not a free download.

___

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

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

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

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


Re: I can't find it in the docs so I know I'm missing it some where

2009-08-31 Thread Luke the Hiesterman

Free apps cannot use in-app purchase. You must charge at least 99 cents.

Luke

On Aug 31, 2009, at 9:44 AM, Development wrote:

Are apps that are offered for free not allowed to use the store kit?  
It seems foolish to have an app the requires a subscription that is  
not a free download.

___

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

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

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

This email sent to luket...@apple.com


___

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

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

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

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


Re: I can't find it in the docs so I know I'm missing it some where

2009-08-31 Thread Development
Wow. that really needs to change. Subscription services or what not  
cant use the store then since most of those are free downloads. Ah  
well. Back to paypal.


On Aug 31, 2009, at 9:46 AM, Luke the Hiesterman wrote:

Free apps cannot use in-app purchase. You must charge at least 99  
cents.


Luke

On Aug 31, 2009, at 9:44 AM, Development wrote:

Are apps that are offered for free not allowed to use the store  
kit? It seems foolish to have an app the requires a subscription  
that is not a free download.

___

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

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

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

This email sent to luket...@apple.com




___

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

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

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

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


Re: What sound plays after an Installer runs? [OT]

2009-08-31 Thread Greg Guerin

Alastair Houghton wrote:


How does that differ from what I wrote?  (Answer: it doesn't)


It differs in the strength of the assertion: "is" is definitive;  
"may" isn't.


You essentially wrote "Technically that's copyright  
infringement ...", where "that's" is a contraction of "that is", and  
"is" is making a definitive assertion.  We don't know whether it *is*  
copyright infringement or not, because we don't know the ownership of  
the sound, or even if it has any.  Therefore, it *may* be copyright  
infringement, with or without the qualifying phrase "unless the owner  
of the aforementioned sound file (in this case Apple) says you can",  
which further assumes that Apple *is* the sound's copyright owner,  
and has not yet been proved.



I do agree that it isn't something we need debate at any length; I  
just thought that someone else might be able to locate the previous  
statement from Apple on the matter (since I don't recall where it  
was). I'm sure there was one, I just can't find it.


It wouldn't matter, unless the person was posting a legally binding  
statement, such as a license or permission statement, or a statement  
of corporate policy.  Personally, I doubt that.


  -- GG

___

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

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

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

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


10.6: Check Box Cells in NSTableViews always editable!

2009-08-31 Thread Gerd Knops
Seems that in Snow Leopard the "editable" setting in the column  
attributes is ignored for Check Box Cells in NSTableViews.


That is causing trouble, for example when the bound value is read-only.

Anyone knows of a workaround? I tried hooking up the editable binding  
of both column and cell to a method always returning "NO", but that  
did not help.


Thanks

Gerd

___

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

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

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

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


Re: 10.6: Check Box Cells in NSTableViews always editable!

2009-08-31 Thread Volker in Lists

Hi,

have you changed the binding conditionally sets enabled respectively  
conditionally sets editable ? That did the trick before on 10.5


volker

Am 31.08.2009 um 20:21 schrieb Gerd Knops:

Seems that in Snow Leopard the "editable" setting in the column  
attributes is ignored for Check Box Cells in NSTableViews.


That is causing trouble, for example when the bound value is read- 
only.


Anyone knows of a workaround? I tried hooking up the editable  
binding of both column and cell to a method always returning "NO",  
but that did not 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 arch...@mail-archive.com


Re: How To Unbind

2009-08-31 Thread Richard Somers

On Aug 31, 2009, at 7:05 AM, Klaus Backert wrote:

Have you tried the constant NSManagedObjectContextBinding defined in  
NSKeyValueBinding.h instead of your constant  
@"managedObjectContext"? I don't know, but may be  
NSManagedObjectContextBinding does not contain this string.


The problem was unbind was insufficient to de-couple the controller  
from its content binding. The controller content must also be set to  
nil. (Refer to Apple Cocoa Bindings Programming Topics, Providing  
Controller Content, De-coupling a Controller from its Content  
Bindings.) Also using NSManagedObjectContextBinding rather than  
@"managedObjectContext" for the controller as suggested is cleaner.


Part of the problem here is that the documentation (Apple Cocoa  
Bindings Reference) for NSArrayController lists the  
managedObjectContext under "Parameters Bindings". You would think that  
it should be listed under "Controller Content Bindings" or "Controller  
Content Parameters Bindings" because it provides controller content.


Here is the code that works.

 NSArrayController *controller;

Establish a binding programmatically.

 [controller bind:NSManagedObjectContextBinding
 toObject:self
  withKeyPath:@"managedObjectContext"
  options:nil];

Unbind programmatically.

 [controller unbind:NSManagedObjectContextBinding];
 [controller setManagedObjectContext:nil];

Richard

___

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

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

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

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


Re: Handling international text without text views

2009-08-31 Thread Aki Inoue
The bottom-line window approach was mainly for supporting Carbon  
applications that cannot be moved from the WNE design model due to its  
own legacy application structuring.


Since Cocoa is not based on responder message handling design, such  
event handling model is unnecessary.  And the user experience was  
mostly accepted unfavorably by users, and, thus, Apple is moving away.


We recommend applications to integrate NSTextVIew for all text input  
needs.  It allows you to take advantage of future text enhancements  
from the Cocoa framework transparently if applicable.


Another option is to implement the NSTextInputClient protocol for your  
text editing view.
There is a new sample at /Developer/Examples/AppKit/TextInputView  
coming with Xcode 3.2 showing how to interact with the protocol.


The 3rd option is to implement the bottom-line window behavior by  
yourself using NSTextView.


Aki

On 2009/08/22, at 19:52, Kyle Sluder wrote:

On Aug 22, 2009, at 12:57 PM, Wade Williams   
wrote:


When the application was Carbon, as I recall, I would setup a new  
TSM document, and that would automatically give me the bottom-line  
text input bar and I would process the input with my Carbon event  
handlers.  I've been doing some searching on how to accomplish the  
same thing on Cocoa (enable the bottom-line text entry window and  
getting events containing the Unicode text), but haven't been able  
to find anything yet.  It appears I might have to do something with  
NSInputManager, but I haven't really seen how I can accomplish what  
I want.


Not an expert in this field (though I find myself in the bowels of  
the text system more and more often), but take a look at the  
protocols NSText and NSTextView implement. I believe the one you  
want is NSTextInput.


As for the bottom bar, that might be a legacy Carbon thing. Cocoa  
input servers provide their own UI.


(But take a look at the stack trace that occurs in -keyDown:. Cocoa  
creates a TSM document and does all sorts of Carbony things anyway,  
but you don't get to play with them. Dunno about 64-bit, but you  
might be able to cross this bridge yourself in 32 bit code.)


Some text system engineers participate on this list. Hopefully one  
of them, or someone else more knowledgable than I am at the moment,  
can help you out more.


Good luck!

--Kyle Sluder



___

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

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

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

This email sent to a...@apple.com


___

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

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

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

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


Re: 10.6: Check Box Cells in NSTableViews always editable!

2009-08-31 Thread Gerd Knops


On Aug 31, 2009, at 1:28 PM, Volker in Lists wrote:


Hi,

have you changed the binding conditionally sets enabled respectively  
conditionally sets editable ? That did the trick before on 10.5


Tried that (BTW did not need that in 10.5, at least not in later  
versions). Didn't help in 10.6...


Gerd

___

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

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

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

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


Re: NSCollectionView item selection on Snow Leopard

2009-08-31 Thread Markus Spoettl

Hello Kevin,

  I'm not observing the selection indexes of the collection view, but  
those of the bound NSArrayController.


I've followed your advice and overwrote both -scrollRectToVisible and - 
setSelectionIndexes: with breakpoints in them. In the case of the  
scrolling on -mouseDown: within an item, both are called - these are  
the call stacks:


-scrollRectToVisible:

#0	0x00087819 in -[ActivityCollectionView scrollRectToVisible:] at  
ActivityCollectionView.m:117

#1  0x9508797a in -[NSCollectionView _scrollToVisibleItemAtIndex:]
#2	0x950894d5 in -[NSCollectionView  
observeValueForKeyPath:ofObject:change:context:]

#3  0x9633d294 in NSKeyValueNotifyObserver
#4  0x9633cd33 in NSKeyValueDidChange
#5	0x9632175c in -[NSObject(NSKeyValueObserverNotification)  
didChangeValueForKey:]

#6  0x94952f00 in -[NSWindow makeFirstResponder:]
#7  0x94a6fe89 in -[NSWindow sendEvent:]
#8  0x94988bef in -[NSApplication sendEvent:]
#9  0x9491c65b in -[NSApplication run]
#10 0x94914695 in NSApplicationMain
#11 0x6de1 in main at main.m:13

-setSelectionIndexes:

#0	0x00087877 in -[ActivityCollectionView setSelectionIndexes:] at  
ActivityCollectionView.m:122

#1  0x9508cfff in -[NSCollectionView mouseDown:]
#2  0x94985e9d in forwardMethod
#3  0x94a6ffc8 in -[NSWindow sendEvent:]
#4  0x94988bef in -[NSApplication sendEvent:]
#5  0x9491c65b in -[NSApplication run]
#6  0x94914695 in NSApplicationMain
#7  0x6de1 in main at main.m:13

I disabled all custom code in my custom NSCollectionView to rule out  
any bad interaction with the framework. I also removed all mouse event  
methods in my custom item view.


The only strange thing I noticed is this (I've since removed the mouse  
handlers to make sure this isn't causing the problem). I roll my own  
selection decision rather than using the collection view's inherited  
behavior because my collection item view has a transparent border  
where a click should not make it first responder:


- (void)mouseDown:(NSEvent *)theEvent
{
NSPoint pt = [self convertPoint:[theEvent locationInWindow]  
fromView:nil];


NSRect visibleRect = [self visibleViewBounds];

if (NSPointInRect(pt, visibleRect)) {
if (!selected) {
[controller setSelected:YES];  // let the item's  
controller know

   // we need to be selected
}
}
}

What I've noticed is that for rows where the strange auto-scrolling  
happens, pt.y is negative, even though the clicked point lies well  
within the view that was clicked. It is correct for the upper rows,  
where the selection works normally.


This indicates to me (maybe wrongly so) that NSCollectionView does  
some stuff behind my back with the coordinate system and it fails to  
convert the coordinates properly.


I thought I mention this because it's the only observation I can offer  
that might be useful.


Also, I'm compiling on 10.6 with the base SDK set to 10.5, in case  
that matters (it probably does).


Let me know if you need any more information, I can also provide you  
with a debug-compiled version of the app if that helps.


Regards
Markus

On Aug 31, 2009, at 7:07 PM, Kevin Perry wrote:


Markus,

I just tried running the IconCollection sample app and did not  
observe the problems you are seeing. Have you subclassed  
NSCollectionView in any way? Are you, perhaps,  observing - 
selectionIndexes and calling a method on the NSCollectionView that  
causes the scrolling you see? KVO notifications for - 
[NSCollectionView selectionIndexes] for mouse selections did not  
always work correctly in Leopard, but they do now in Snow Leopard.


Try breaking in the debugger on -scrollRectToVisible or - 
[NSCollectionView setSelectionIndexes:] and you may discover what is  
causing these problems.


-kp


From: Markus Spoettl 
Date: August 31, 2009 7:34:07 AM PDT
To: CocoaDev list 
Subject: NSCollectionView item selection on Snow Leopard

Hello,

 I have an NSCollectionView that used to work normally on Leopard,  
when the App is running on Snow Leopard, item selection using the  
mouse by clicking on it doesn't work correctly.


When clicking on an item in the bottom-most visible row, instead of  
selecting that item the collection view scrolls down a row (unless  
there is no item visible lower than the item that is clicked on).


Does anyone else see this issue?

Regards
Markus
--
__
Markus Spoettl





--
__
Markus Spoettl



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


Re: Why would NSViewController loadView fail?

2009-08-31 Thread Eric Gorr


On Aug 28, 2009, at 4:36 PM, Eric Gorr wrote:

I am pretty sure I've got my .xib setup correctly, but when I call  
loadView on my View Controller, my application crashes.


Unfortunately, I am not getting any useful information out of the  
crash. The only thing I appear to have is a stack trace, but I am  
not sure what it is telling me.


#0  0x906e9911 in __CFBasicHashDeallocate
#1  0x906d1bab in _CFRelease
#2  0x906fe5bd in _CFAutoreleasePoolPop
#3  0x92c1de62 in NSPopAutoreleasePool
#4  0x96811c95 in -[NSNib instantiateNibWithExternalNameTable:]
#5  0x96811968 in -[NSNib instantiateNibWithOwner:topLevelObjects:]
#6  0x96810de1 in -[NSViewController loadView]

Anyone have an idea?


Well, this problem just got a little stranger.

Apparently, I can build and run the same code on Leopard and it will  
work just fine.


Building and running it on Snow Leopard causes it to crash horribly.

Very weird.

If anyone has an idea, I'm interested.

___

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

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

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

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


Re: refresh issue with QLPreviewPanel..!

2009-08-31 Thread Julien Jalon
Needless to say that what you do is totally unsupported and will
totally break in 10.6.

10.6 now provides a public (incompatible with Leopard) API but even
with this API, what you do is greatly unsupported (and will break in
the future). Add to that the fact QL panel is very asynchronous, and
it's expected for you to encounter a *lot* of problems.

-- 
Julien

On Monday, August 31, 2009, Naresh Kongara
 wrote:
> Hi,
>
> I have  an app in which i need to display the view to be printed in QuickLook 
> preview. For this i thought os using the 
> (QlPreviewPanel)QuickLookUI.framework which is available at 
> /System/Library/PrivateFrameworks.
>
> QLPreviewPanel class is obtained using
>
> #define QLPreviewPanel NSClassFromString(@"QLPreviewPanel")
>
> and the QuickLookUI framework is loaded as below.
>
> [[NSBundle 
> bundleWithPath:@"/System/Library/PrivateFrameworks/QuickLookUI.framework"] 
> load];
>
> Using NSPrintOperation i'm saving the View to be printed a path say PDFPath.
> Then i'm passing the PDFPath URL to previewPanel as below.
>
>                 [[QLPreviewPanel sharedPreviewPanel] setURLs:[NSArray 
> arrayWithObject:[NSURL fileURLWithPath:PDFPath]]];
>                 [[QLPreviewPanel sharedPreviewPanel] 
> makeKeyAndOrderFront:self];
>
>
> The above code is working fine for the first time. If i close the panel  and 
> change the view to be printed(Which inturn changes the file  at PDFPath).Now 
> if the panel is shown again with above 2 lines of code then the panel is not 
> showing the updated one, it is showing the previous view only.
> If we wait for some time to show the panel, then it is showing the correct 
> view only.
> There is no problem with file at PDFPath.
> I don't know why the preview panel is taking the time to refresh.
>
> If any one has the idea on it, Please let me know.
>
>
>
>
>
> Thanks,
> Naresh Kongara
> naresh.kong...@prithvisolutions.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)http://lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/jjalon%40gmail.com
>
> This email sent to jja...@gmail.com
>
___

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

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

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

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


Re: Why would NSViewController loadView fail?

2009-08-31 Thread Kyle Sluder
On Mon, Aug 31, 2009 at 12:26 PM, Eric Gorr wrote:
> Building and running it on Snow Leopard causes it to crash horribly.

Try reopening/resaving your nib in the latest Interface Builder?

--Kyle Sluder
___

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

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

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

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


Core Data? -beginUndoGrouping does not always increment -groupingLevel

2009-08-31 Thread Jerry Krinock
In trying to eliminate extraneous undo groupings from my Core Data  
document-based applications, I've noticed a simple paradox maybe  
someone could explain.


In my persistent document's -init, I replace its undo manager, and  
that of its managed object context, with my own which, for now, is a  
subclass of NSUndoManager.  On occasion, while Core Data is flipping  
undo groups, I see that it somehow runs -beginUndoGrouping without the  
-groupingLevel being incremented as I expect.  This is easily observed  
by overriding -beginUndoGrouping to do some logging:


- (void)beginUndoGrouping {
NSInteger oldGroupingLevel = [self groupingLevel] ;
[super beginUndoGrouping] ;
NSString* alarm = ([self groupingLevel] == oldGl + 1) ? @"  
" : @" " ;

NSLog(@"2399 %s gl %d->%d%@ %p",
 __PRETTY_FUNCTION__,
 oldGroupingLevel,
 [self groupingLevel],
 alarm,
 self) ;
}

This often, but not always, appears to be associated with a similar no- 
op by -endUndoGrouping.  Some log excerpts:


12:45:22.165 Test[77155:10b] 2399 -[SSYUndoManager beginUndoGrouping]  
gl 1->1  0x173abdf0

...
12:45:24.809 Test[77155:10b] 2399 -[SSYUndoManager beginUndoGrouping]  
gl 0->0  0x173abdf0
12:45:24.809 Test[77155:10b] 2599 -[SSYUndoManager endUndoGrouping] gl  
0->0  0x173abdf0


Is not -beginUndoGrouping always expected to increment the - 
groupingLevel?  What could be going on here?


This is Mac OS 10.5.8.  I have been careful to always access the undo  
manager only from the main thread.


Sincerely,

Jerry Krinock

___

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

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

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

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


Markers below baseline in NSRulerView

2009-08-31 Thread Anders Lassen

Hi,

I have some problems with the NSRulerView that I hope to solve by this  
request.


The NSRulerView I am using is a horizontal ruler view in a NSScrollView.

In most examples seen in the developer documentation, the markers on  
the ruler are located above the baseline.  In my opinon, this does not  
look very nice. Therefore I am triying to put the markes below the  
baseline of the ruler view. I think this is not standard, and it gives  
me a lot of troubles.


In other words, I would like to make a ruler view, that is like the  
ruler seen in the apple program "Pages". Here the markers are located  
on the ruler itself.


So far, I am able to put the markers below the baseline by offseting  
them and hiding the area above the baseline. This makes it looks like  
the ruler in "Pages".


The problems begin, when I want to move the markers.

First the handleMouseDown function is called. This works fine:

	- (void)rulerView:(NSRulerView*)aRulerView handleMouseDown: 
(NSEvent*)event

{
[ruler trackMarker:marker withMouseEvent:event];
}

Hereafter, I expect these functions to be called.

	- (BOOL)rulerView:(NSRulerView *)aRulerView didMoveMarker: 
(NSRulerMarker *)aMarker

{
return YES;
}

	- (CGFloat)rulerView:(NSRulerView *)aRulerView willMoveMarker: 
(NSRulerMarker *)aMarker toLocation:(CGFloat)location

{
return location;
}

	- (BOOL)rulerView:(NSRulerView *)aRulerView shouldMoveMarker: 
(NSRulerMarker *)aMarker

{
return YES;
}

BUT, this will only happens, if the mouse pointer is above the  
baseline of the ruler.


If the mouse pointer is below the baseline, none of these delegates  
are called.


Any ideas for solving this are most welcome.


Kind regard,

Anders Lassen






___

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

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

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

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


Re: What sound plays after an Installer runs? [OT]

2009-08-31 Thread Alastair Houghton

On 31 Aug 2009, at 18:59, Greg Guerin wrote:

Therefore, it *may* be copyright infringement, with or without the  
qualifying phrase "unless the owner of the aforementioned sound file  
(in this case Apple) says you can", which further assumes that Apple  
*is* the sound's copyright owner, and has not yet been proved.


It's pointless arguing about this on-list.  The point, on which I  
think we both agree, is that taking assets from other peoples'  
software (including Apple's) is potentially a legal problem and people  
need to be aware of that.


Kind regards,

Alastair.

--
http://alastairs-place.net



___

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

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

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

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


Re: Why would NSViewController loadView fail?

2009-08-31 Thread Jonathan Hess


On Aug 28, 2009, at 1:36 PM, Eric Gorr wrote:

I am pretty sure I've got my .xib setup correctly, but when I call  
loadView on my View Controller, my application crashes.


Unfortunately, I am not getting any useful information out of the  
crash. The only thing I appear to have is a stack trace, but I am  
not sure what it is telling me.


#0  0x906e9911 in __CFBasicHashDeallocate
#1  0x906d1bab in _CFRelease
#2  0x906fe5bd in _CFAutoreleasePoolPop
#3  0x92c1de62 in NSPopAutoreleasePool
#4  0x96811c95 in -[NSNib instantiateNibWithExternalNameTable:]
#5  0x96811968 in -[NSNib instantiateNibWithOwner:topLevelObjects:]
#6  0x96810de1 in -[NSViewController loadView]

Anyone have an idea?



-[NSViewController loadView] is a method that's meant to be overridden  
instead of directly invoked. Does the crash reproduce if you call - 
[NSViewController view] instead?


Jon Hess



___

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

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

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

This email sent to jh...@apple.com


___

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

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

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

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


Re: Why would NSViewController loadView fail?

2009-08-31 Thread Eric Gorr


On Aug 31, 2009, at 3:58 PM, Kyle Sluder wrote:

On Mon, Aug 31, 2009 at 12:26 PM, Eric Gorr  
wrote:

Building and running it on Snow Leopard causes it to crash horribly.


Try reopening/resaving your nib in the latest Interface Builder?



Thanks. I did try that, but it didn't help.

I tried using this .xib file in a simple test application, created the  
view controller, sent it the loadView message...it worked.


I have also tried starting with a fresh .xib file, created with the  
newest IB, and it will crash while trying to load the view.


Clearly, I am doing something bad, which Leopard is tolerant of, but  
Snow Leopard isn't - What that is, I am not sure.



Here is a more complete stack trace:

#0  0x908b3911 in __CFBasicHashDeallocate
#1  0x9089bbab in _CFRelease
#2  0x908c85bd in _CFAutoreleasePoolPop
#3  0x90a3ce62 in NSPopAutoreleasePool
#4  0x95e8ac95 in -[NSNib instantiateNibWithExternalNameTable:]
#5  0x95e8a968 in -[NSNib instantiateNibWithOwner:topLevelObjects:]
#6  0x95e89de1 in -[NSViewController loadView]
#7	0x01275ef8 in -[BasePaletteController awakeFromNib] at  
BasePaletteController.mm:117
#8	0x95dd0622 in -[NSIBObjectData  
nibInstantiateWithOwner:topLevelObjects:]

#9  0x95dce5aa in loadNib
#10	0x95dcd9a4 in +[NSBundle(NSNibLoading)  
_loadNibFile:nameTable:withZone:ownerBundle:]
#11	0x95dcd8b5 in +[NSBundle(NSNibLoading)  
loadNibFile:externalNameTable:withZone:]

#12 0x95e5d6ab in -[NSWindowController loadWindow]
#13 0x95df441a in -[NSWindowController window]
#14 0x0007f180 in IsCocoaPaletteVisible at Palettes.Mac.mm:129

Basically, what happens is that the window controller that is managing  
the palette is asked if it is visible:


[[aController window] isVisible]

Since it hasn't been loaded yet, Cocoa loads the window and sends the  
controller the awakeFromNib message.


The view on the window has it's own controller. awakeFromNib needs  
access to the view, which causes the view controller to load it.


The moment it tries, the application crashes in Snow Leopard, but not  
Leopard.



___

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

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

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

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


Re: Why would NSViewController loadView fail?

2009-08-31 Thread Eric Gorr


On Aug 31, 2009, at 4:54 PM, Jonathan Hess wrote:



On Aug 28, 2009, at 1:36 PM, Eric Gorr wrote:

I am pretty sure I've got my .xib setup correctly, but when I call  
loadView on my View Controller, my application crashes.


Unfortunately, I am not getting any useful information out of the  
crash. The only thing I appear to have is a stack trace, but I am  
not sure what it is telling me.


#0  0x906e9911 in __CFBasicHashDeallocate
#1  0x906d1bab in _CFRelease
#2  0x906fe5bd in _CFAutoreleasePoolPop
#3  0x92c1de62 in NSPopAutoreleasePool
#4  0x96811c95 in -[NSNib instantiateNibWithExternalNameTable:]
#5  0x96811968 in -[NSNib instantiateNibWithOwner:topLevelObjects:]
#6  0x96810de1 in -[NSViewController loadView]

Anyone have an idea?



-[NSViewController loadView] is a method that's meant to be  
overridden instead of directly invoked. Does the crash reproduce if  
you call -[NSViewController view] instead?


Yes.

I actually modified the code to call load view directly. The original  
code did as you suggestedand, yes, it crashes.



___

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

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

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

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


Re: Why would NSViewController loadView fail?

2009-08-31 Thread Jonathan Hess
I would try running with zombies. It sounds like one of the objects  
loaded by the NIB file is being over released.


Jon Hess

On Aug 31, 2009, at 1:55 PM, Eric Gorr wrote:



On Aug 31, 2009, at 3:58 PM, Kyle Sluder wrote:

On Mon, Aug 31, 2009 at 12:26 PM, Eric Gorr  
wrote:

Building and running it on Snow Leopard causes it to crash horribly.


Try reopening/resaving your nib in the latest Interface Builder?



Thanks. I did try that, but it didn't help.

I tried using this .xib file in a simple test application, created  
the view controller, sent it the loadView message...it worked.


I have also tried starting with a fresh .xib file, created with the  
newest IB, and it will crash while trying to load the view.


Clearly, I am doing something bad, which Leopard is tolerant of, but  
Snow Leopard isn't - What that is, I am not sure.



Here is a more complete stack trace:

#0  0x908b3911 in __CFBasicHashDeallocate
#1  0x9089bbab in _CFRelease
#2  0x908c85bd in _CFAutoreleasePoolPop
#3  0x90a3ce62 in NSPopAutoreleasePool
#4  0x95e8ac95 in -[NSNib instantiateNibWithExternalNameTable:]
#5  0x95e8a968 in -[NSNib instantiateNibWithOwner:topLevelObjects:]
#6  0x95e89de1 in -[NSViewController loadView]
#7	0x01275ef8 in -[BasePaletteController awakeFromNib] at  
BasePaletteController.mm:117
#8	0x95dd0622 in -[NSIBObjectData  
nibInstantiateWithOwner:topLevelObjects:]

#9  0x95dce5aa in loadNib
#10	0x95dcd9a4 in +[NSBundle(NSNibLoading)  
_loadNibFile:nameTable:withZone:ownerBundle:]
#11	0x95dcd8b5 in +[NSBundle(NSNibLoading)  
loadNibFile:externalNameTable:withZone:]

#12 0x95e5d6ab in -[NSWindowController loadWindow]
#13 0x95df441a in -[NSWindowController window]
#14 0x0007f180 in IsCocoaPaletteVisible at Palettes.Mac.mm:129

Basically, what happens is that the window controller that is  
managing the palette is asked if it is visible:


[[aController window] isVisible]

Since it hasn't been loaded yet, Cocoa loads the window and sends  
the controller the awakeFromNib message.


The view on the window has it's own controller. awakeFromNib needs  
access to the view, which causes the view controller to load it.


The moment it tries, the application crashes in Snow Leopard, but  
not Leopard.



___

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

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

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

This email sent to jh...@apple.com


___

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

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

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

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


Re: Why would NSViewController loadView fail?

2009-08-31 Thread Corbin Dunn


On Aug 31, 2009, at 1:59 PM, Jonathan Hess wrote:


I would try running with zombies.



And now that you have SnowLeopard, this should be the first thing you  
(meaning, the collective of Cocoa programmers out there) should do:


In Xcode: Run -> Run with Performance Tool -> Zombies
Then, reproduce the crashing steps.

-corbin


It sounds like one of the objects loaded by the NIB file is being  
over released.


Jon Hess

On Aug 31, 2009, at 1:55 PM, Eric Gorr wrote:



On Aug 31, 2009, at 3:58 PM, Kyle Sluder wrote:

On Mon, Aug 31, 2009 at 12:26 PM, Eric Gorr  
wrote:
Building and running it on Snow Leopard causes it to crash  
horribly.


Try reopening/resaving your nib in the latest Interface Builder?



Thanks. I did try that, but it didn't help.

I tried using this .xib file in a simple test application, created  
the view controller, sent it the loadView message...it worked.


I have also tried starting with a fresh .xib file, created with the  
newest IB, and it will crash while trying to load the view.


Clearly, I am doing something bad, which Leopard is tolerant of,  
but Snow Leopard isn't - What that is, I am not sure.



Here is a more complete stack trace:

#0  0x908b3911 in __CFBasicHashDeallocate
#1  0x9089bbab in _CFRelease
#2  0x908c85bd in _CFAutoreleasePoolPop
#3  0x90a3ce62 in NSPopAutoreleasePool
#4  0x95e8ac95 in -[NSNib instantiateNibWithExternalNameTable:]
#5  0x95e8a968 in -[NSNib instantiateNibWithOwner:topLevelObjects:]
#6  0x95e89de1 in -[NSViewController loadView]
#7	0x01275ef8 in -[BasePaletteController awakeFromNib] at  
BasePaletteController.mm:117
#8	0x95dd0622 in -[NSIBObjectData  
nibInstantiateWithOwner:topLevelObjects:]

#9  0x95dce5aa in loadNib
#10	0x95dcd9a4 in +[NSBundle(NSNibLoading)  
_loadNibFile:nameTable:withZone:ownerBundle:]
#11	0x95dcd8b5 in +[NSBundle(NSNibLoading)  
loadNibFile:externalNameTable:withZone:]

#12 0x95e5d6ab in -[NSWindowController loadWindow]
#13 0x95df441a in -[NSWindowController window]
#14 0x0007f180 in IsCocoaPaletteVisible at Palettes.Mac.mm:129

Basically, what happens is that the window controller that is  
managing the palette is asked if it is visible:


[[aController window] isVisible]

Since it hasn't been loaded yet, Cocoa loads the window and sends  
the controller the awakeFromNib message.


The view on the window has it's own controller. awakeFromNib needs  
access to the view, which causes the view controller to load it.


The moment it tries, the application crashes in Snow Leopard, but  
not Leopard.



___

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

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

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

This email sent to jh...@apple.com


___

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

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

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

This email sent to corb...@apple.com


___

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

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

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

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


NSMenuItem's selectors messages not sent

2009-08-31 Thread Lorenzo Thurman
I have two applications, both NSStatusItems. Upon upgrading to Snow Leopard
(from 10.5), I've found that none of the messages associated with the menu
items are called. As near as I can tell, the messages are never dispatched,
at least the breakpoints in the methods are never hit. I can't find anything
in the release notes to provide a clue. Can someone provide me with some
guidance as to what may be wrong? And as a side note, how can I use the
debugger to detemine if a message is even dispatched.Thanks

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

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

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

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

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


Re: Why would NSViewController loadView fail?

2009-08-31 Thread Eric Gorr


On Aug 31, 2009, at 5:06 PM, Corbin Dunn wrote:



On Aug 31, 2009, at 1:59 PM, Jonathan Hess wrote:


I would try running with zombies.



And now that you have SnowLeopard, this should be the first thing  
you (meaning, the collective of Cocoa programmers out there) should  
do:


In Xcode: Run -> Run with Performance Tool -> Zombies
Then, reproduce the crashing steps.


Yep, I concur - especially since this appears to have found the  
problem, which, as it turns out, has nothing to do with loading my view.


I don't have a solution yet, but at least I believe I know where to  
look.


Thanks again.

My guess is that I am simply getting lucky in Leopard.

___

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

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

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

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


NSInternalInconsistencyException -- keyLoopGroupingView should be a NSToolbarView

2009-08-31 Thread David Riggle
How do I prevent this crash? It happens occasionally when I call  
[NSView nextValidKeyView] or [NSWindow selectKeyViewFollowingView:] in  
a window that has a toolbar. Here's a typical stack trace:


#6  0x948f2dcb +[NSException raise:format:arguments:]
#7  0x92e9fec4 -[NSAssertionHandler  
handleFailureInMethod:object:file:lineNumber:description:]
#8  0x968b411d +[%NSToolbarView  
_findFirstKeyViewInDirection:forKeyLoopGroupingView:]

#9  0x966a7590 -[NSControl needsPanelToBecomeKey]
#10 0x966a70eb -[NSView nextValidKeyView]
#11 0x96850a0f -[NSWindow selectKeyViewFollowingView:]
#12 0x106068 -[InfoController takeFocus]
#13 0x121299 -[ICSFileImporter processiTIPRequestFromOrganizer:]
#14 0x121c7b -[ICSFileImporter  
importFile:intoContainer:confirmContainer:]

#15 0x0c435c -[AppController openFile:viaEmail:]
#16 0x0c454b -[AppController procesEmailFile:]
#17 0x92dc188e -[NSRunLoop runMode:beforeDate:]

My keyloops are calculated automatically by NSWindow. One of my  
windows has an NSSearchField in the toolbar, another has preference  
pane style buttons. Both windows have crashed with this bug.


I sometimes move the keyboard focus programmatically as the user  
selects things from pop-ups, etc. In the crash above I'm moving the  
keyboard focus to an NSTextField in a subview of the main window in  
response to an email arriving.


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


Re: system(root) locale

2009-08-31 Thread Chris Kane

[NSLocale systemLocale] returns the root NSLocale.

If you are referring to the BSD/Unix-level locale, you can start by  
looking in /usr/include/xlocale.h, but I don't know anything else  
about that.



Chris Kane
Cocoa Frameworks, Apple


On Aug 31, 2009, at 12:53 AM, Maggie Zhang wrote:


Hi,
Does anyone know how to get the root locale in Objective-c or C or  
using
Unix commands? I tried NSLocale but it didn't give what I want.  
Though I can

get the user's current locale in different ways.

Thanks for you 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/ckane%40apple.com

This email sent to ck...@apple.com


___

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

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

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

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


Re: NSCollectionView item selection on Snow Leopard

2009-08-31 Thread Markus Spoettl
For those following: It turned out to be a bug in NSCollectionView  
that surfaces if the collection view items can become first responder.


Regards
Markus
--
__
Markus Spoettl



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

Re: NSInternalInconsistencyException -- keyLoopGroupingView should be a NSToolbarView

2009-08-31 Thread Greg Parker

On Aug 31, 2009, at 2:34 PM, David Riggle wrote:
How do I prevent this crash? It happens occasionally when I call  
[NSView nextValidKeyView] or [NSWindow selectKeyViewFollowingView:]  
in a window that has a toolbar. Here's a typical stack trace:


#6  0x948f2dcb +[NSException raise:format:arguments:]
#7  0x92e9fec4 -[NSAssertionHandler  
handleFailureInMethod:object:file:lineNumber:description:]
#8  0x968b411d +[%NSToolbarView  
_findFirstKeyViewInDirection:forKeyLoopGroupingView:]

#9  0x966a7590 -[NSControl needsPanelToBecomeKey]
#10 0x966a70eb -[NSView nextValidKeyView]
#11 0x96850a0f -[NSWindow selectKeyViewFollowingView:]
#12 0x106068 -[InfoController takeFocus]
#13 0x121299 -[ICSFileImporter processiTIPRequestFromOrganizer:]
#14 0x121c7b -[ICSFileImporter  
importFile:intoContainer:confirmContainer:]

#15 0x0c435c -[AppController openFile:viaEmail:]
#16 0x0c454b -[AppController procesEmailFile:]
#17 0x92dc188e -[NSRunLoop runMode:beforeDate:]

My keyloops are calculated automatically by NSWindow. One of my  
windows has an NSSearchField in the toolbar, another has preference  
pane style buttons. Both windows have crashed with this bug.


I sometimes move the keyboard focus programmatically as the user  
selects things from pop-ups, etc. In the crash above I'm moving the  
keyboard focus to an NSTextField in a subview of the main window in  
response to an email arriving.


That '%' in front of NSToolbarView's name means somebody is posing as  
NSToolbarView. Try turning off whatever hack is doing that.



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


___

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

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

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

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


Overriding NSMenu from an NSTextView

2009-08-31 Thread Chilton Webb

Hi!

I have a menu item that defines Command+Shift+Arrow (left and right)  
to do something.


But I'd also like to support the 'normal' NSTextView behavior for  
Command+Shift+Arrow.


How do I tell my app to ignore this particular menu command (and use  
the default NSTextView behavior) when editing a text view, and then to  
go back to using the menu command when I'm done editing the text view?


Thanks!
-Chilton
___

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

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

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

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


IKSlideshow reloadData should reload, yes?

2009-08-31 Thread Adam Knight
I'm using IKSlideshow to display images that I'm fetching from a  
server in the background.  There is a thumbnail and a full-size  
version of each image.  When IKSlideshow asks for an item at an index,  
if the full-size image is there, I give it the path to that cache  
file.  If it is not there, I give it the path to the thumbnail and  
then initiate the download for the FS version.


That latter part is tricky here because I get a notification that the  
download is complete and then I call -reloadData and/or - 
reloadSlideshowItemAtIndex on the IKSlideshow object and ... nothing  
happens.  In 10.5, I get -numberOfSlideshowItems called again on the  
data source, and in 10.6 absolutely nothing is called on my data source.


So ... what is it reloading?

More to the point: how can I get it to reload the image?  Or any way  
of changing the image after it's been displayed?


Regression: in 10.5, I could go next/prev and then the larger image  
would display as it called -slideshowItemAtIndex again.  In 10.6 it's  
caching that so I have to rely on the reload methods that don't appear  
to work...


Help?


AK

___

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

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

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

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


Re: Overriding NSMenu from an NSTextView

2009-08-31 Thread Jack Carbaugh
Change the Key equiv of the menu item when your textview takes on key  
focus, then set it back when finished.



On Aug 31, 2009, at 5:50 PM, Chilton Webb wrote:


Hi!

I have a menu item that defines Command+Shift+Arrow (left and right)  
to do something.


But I'd also like to support the 'normal' NSTextView behavior for  
Command+Shift+Arrow.


How do I tell my app to ignore this particular menu command (and use  
the default NSTextView behavior) when editing a text view, and then  
to go back to using the menu command when I'm done editing the text  
view?


Thanks!
-Chilton
___

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

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

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

This email sent to intrn...@aol.com


___

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

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

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

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


Re: "Format not a string literal and no format arguments"

2009-08-31 Thread Sean McBride
On 8/29/09 4:00 PM, Ken Thomases said:

>GCC knows about the standard formatting functions and applies the
>analysis to them automatically, by default.  However, it also allows
>the application of the __attribute__((format ...)) decoration to user-
>defined functions to have them checked in the same way.  This applies
>to all of the formatting-related warnings.
>
>There's -Wformat and -Wformat-security (among a few others).  The
>former checks the types, the latter also warns about a lone non-
>literal argument. -Wformat-security is ignored if -Wformat is not
>enabled, so -Wno-format disables both.
>
>Both warnings are available in GCC 4.0.1, but not enabled by default.
>They are apparently both enabled by default in GCC 4.2.1.  (Currently,
>-Wformat-security is a subset of -Wformat-nonliteral, which is
>apparently not enabled by default.  It warns when the format string is
>a non-literal even if it's followed by arguments.)

The following common usage now trips this warning:


#import 

int main (void)
{
NSString* foo = [NSString stringWithFormat:
NSLocalizedString(@"%d days ago", @"some comment"),
350];

return 0;
}


$ gcc-4.2 -Wformat=2 -framework Cocoa test.m
test.m: In function 'main':
test.m:7: warning: format not a string literal, argument types not checked


Other than removing the warning, or hacking the headers in the SDK (to
add compiler decorations), anyone have any suggestions on how to rewrite
this code to work with that warning?

Thanks,

--

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


___

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

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

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

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


Re: How to use NSTextView's new -checkTextInRange:types:options:?

2009-08-31 Thread Keith Blount
Just a quick update, as I've played with this some more: I have tried passing 
in various ranges to -checkTextInRange:types:options:, thinking that maybe it 
needed a typing range (of 1 in length), and trying to emulate the sorts of 
ranges that get passed into the method by the text view (by overriding and 
NSLogging to check the sort of ranges passed in); I've also tried specifying 
the types (e.g. NSTextCheckingTypeReplacement and NSTextCheckingAllSystemTypes) 
rather than relying on -enabledTextCheckingTypes and passing different things 
into the options dictionary (which shouldn't be necessary), all to no avail. 
For now kludging it with -checkTextInSelection: works, but I'd still love to 
know how to use the -checkTextInRange:types:options: method if anyone has any 
ideas...

Thanks and all the best,
Keith

-- Original message --

Hello,

I am trying to force text checking in an NSTextView on Snow Leopard using the 
new -checkTextInRange:types:options: method, but I can't seem to get this 
method to work at all. I am aware that the documentation clearly states that 
"this method *usually* would not be called directly" (although it does not say 
"never" or "should not be") as NSTextView calls it from its various text 
checking methods automatically, but my text view subclass adds other types of 
substitutions which mean I need to force text checking on the built-in types 
either before or after making my custom substitutions. (For instance, I have an 
auto-capitalisation method that gets called in -textDidChange:. If 
auto-capitalisation alters a word that is in the system "substitutions" list, 
though, it prevents substitutions from happening, presumably because the 
changed range gets affected before the substitutions code gets called. 
Therefore in the situation where auto-caps is going to change
the text, I need to force text checking beforehand.)

The -checkTextInRange:types:options: method doesn't seem to work as expected, 
though, presumably because the documentation is new and doesn't explain it 
properly as yet. For instance, I would expect this:

// (Note that "self" here is an NSTextView subclass.)
[self checkTextInRange:NSMakeRange(0,[[self textStorage] length]) types:[self 
enabledTextCheckingTypes] options:nil];

to have the same effect as this:

[self checkTextInDocument:nil];

or this:

[self setSelectedRange:NSMakeRange(0,[[self textStorage] length])];
[self checkTextInSelection:nil];

But it doesn't. Both of the latter methods - the action methods - work as 
expected, checking and replacing the text where necessary - but the code using 
-checkTextInRange:types:options: directly apparently does nothing at all - no 
text gets replaced. (Even though the docs clearly describe the method thus: 
"Check and replace the text in the range using the specified checking types and 
options.")

(Note: [self enabledTextCheckingTypes] is not 0 - it includes quotes and text 
replacement etc; hence the two action methods work. So I'm not doing anything 
as silly as passing the method no checking types.)

I can get my auto-caps to work with the new substitution methods if I just use 
-checkTextInSelection:, setting the selection before calling it and resetting 
the selection immediately afterwards, but this is a bit of a kludge and I would 
rather use the -checkTextInRange:... method directly if at all possible.

Has anybody tried this new method, encountered similar problems or found a 
solution? Is there something I need to do in conjunction with this method to 
get it working?

Many thanks in advance and all the best,
Keith


  
___

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

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

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

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


Re: Get error message about registered observers when Object receives dealloc message

2009-08-31 Thread Sean McBride
On 8/29/09 10:28 AM, Quincey Morris said:

>The second is that one of the behaviors he doesn't control --
>unregistration of observers -- is not permitted during the 'dealloc'
>of the observed object, and must be done before that.

Note that the wonderful AnalysisTool can catch this through static analysis:


--

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


___

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

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

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

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


saving files/folders in foreign language names

2009-08-31 Thread Nick Rogers

Hi,
I have the following hierarchy to save programatically (e.g.):

my english path name/some french dir name/some french file name.file

Now I'm using NSFileManager to do this:
1. create a folder at "my english path name". correctly done.
2. change current dir to "my english path name" and creating "some  
french dir name". correctly done.
3. change current dir to "my english path name/some french dir name".  
fails as the file is saved eventually in the folder "my english path  
name" 's last dir, and not in "some french dir name".
4. I write to the file using write(), for this I get the FileHandle  
(using NSFileHandle) and then file descriptor from file handle. The  
data goes into the file but after closing the file handle, the file is  
showing zero bytes.


I need to fix this immediately.
Please help.
What other options I have besides NSFileManager and NSFileHandle, that  
would work?


Wishes,
Nick

___

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

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

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

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


Re: NSMenuItem's selectors messages not sent

2009-08-31 Thread Steven Degutis
Lorenzo,
My first guess would be that you must have turned on garbage collection at
some point, and have a controller object that's not strongly referenced by
other objects, floating about in your NIB. If this is the case, the object
would deallocate pretty soon after your NIB loads, and no messages
associated with your menu items would get sent.

However, when menu items can find no targets matching their selector in the
responder chain, they usually are disabled, rather than enabled and doing
nothing. However, if you don't have them set to auto-enable themselves, this
isn't the case.

In any event, you can use gdb to trace the program's execution flow to find
out exactly when certain things are happening, and put breakpoints on
questionable lines of code.

-- 
Steven Degutis
http://www.thoughtfultree.com/
http://www.degutis.org/


On Mon, Aug 31, 2009 at 4:20 PM, Lorenzo Thurman wrote:

> I have two applications, both NSStatusItems. Upon upgrading to Snow Leopard
> (from 10.5), I've found that none of the messages associated with the menu
> items are called. As near as I can tell, the messages are never dispatched,
> at least the breakpoints in the methods are never hit. I can't find
> anything
> in the release notes to provide a clue. Can someone provide me with some
> guidance as to what may be wrong? And as a side note, how can I use the
> debugger to detemine if a message is even dispatched.Thanks
>
> --
> "My break-dancing days are over, but there's always the funky chicken"
> --The Full Monty
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/steven.degutis%40gmail.com
>
> This email sent to steven.degu...@gmail.com
>
___

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

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

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

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


Re: saving files/folders in foreign language names

2009-08-31 Thread Kyle Sluder
What does foreign language have to do with it?  Are you perhaps using
accented characters like é in your pathnames?  You need to be very
careful when doing that, because the filesystem stores it in
decomposed form as e + ´, whereas if you've hardcoded this path in
your code (or strings file), you will try to access it as the composed
form é.

So in short, don't do this.  Use low-ASCII characters in all of your
hardcoded paths, and localize the directory if the user might see it.
The documentation has more information on localized pathnames:
http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPInternational/Articles/LocalizingPathnames.html

--Kyle Sluder
___

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

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

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

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


Re: saving files/folders in foreign language names

2009-08-31 Thread Navneet Kumar

Hi,
Thanks for the reply.
Actually my program is a finder like program, which saves file (in  
path hierarchy).
And the hierarchy I mentioned earlier is the actual hierarchy on the  
user's file system.

I'm not hard coding anything.

What I think is happening is that NSFM's changeCurrentDirectoryPath:  
is failing, leading to a zero byte file.


Thanks,
Nick

On 01-Sep-09, at 5:27 AM, Kyle Sluder wrote:


What does foreign language have to do with it?  Are you perhaps using
accented characters like é in your pathnames?  You need to be very
careful when doing that, because the filesystem stores it in
decomposed form as e + ´, whereas if you've hardcoded this path in
your code (or strings file), you will try to access it as the composed
form é.

So in short, don't do this.  Use low-ASCII characters in all of your
hardcoded paths, and localize the directory if the user might see it.
The documentation has more information on localized pathnames:
http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPInternational/Articles/LocalizingPathnames.html

--Kyle Sluder


___

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

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

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

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


Re: Core Data observer exception in 10.6

2009-08-31 Thread David Sinclair


On Aug 29, 2009, at 18:18:42, Ben Trumbull wrote:

Hard to say without more details, but it does look like a Cocoa  
Bindings bug.  If you could create a new sample project with your  
NIB and your model and reproduce this, and then attach it to a bug  
report, that would be extremely helpful.



Thanks for the reply, Ben.  I've just sent a DTS request for help with  
this.  Follow-up ID "82245382".  I'll submit a bug report if it turns  
out to be an Apple bug instead of mine.


I included this demo project (extracted from the problem app, Narrator):



On running this app, it will automatically open a bundled document  
that demos the exceptions.  You can create a new document to show that  
basic document creation works fine.  Saving also works.  It's loading  
documents that fails (loading documents from previous versions (with  
no model changes) or from this version both fail.


--

David Sinclair, Dejal Systems, LLC - d...@dejal.com
Dejal blog - http://www.dejal.com/blog/
Cocoa code - http://www.dejal.com/developer/
Twitter - http://twitter.com/dejal/






___

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

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

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

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


Re: Two controllers in a window, how do I get one to run a function in another?

2009-08-31 Thread BareFeet

Hi Graham and all,

I also tried to use bindings, which I've made work well for linking  
text views, table columns, even outline view columns, to data in my  
model. But I can't seem to set up bindings to link an instance  
variable in one controller to another controller. So I guess  
bindings are only for linking view objects to model objects, yes?


First, forget bindings... bindings is really an advanced topic, so I  
suggest you'll be better off leaving it alone for now. Bindings are  
mostly designed for handling the view<-->controller connections.


Actually, as I mentioned, I've had great success with bindings for  
linking view objects to data. I am actually surprised at how bindings  
seems to always be taught as an advanced topic, whereas I think it  
should be introduced much earlier to newbie Cocoa programmers,  
especially since it eliminates so much code, but that's another story.


I just wondered whether bindings could be used to link instance  
variables in two controllers, but I guess not.


In this case you have a controller<-->controller connection, which  
is likely to be a lot simpler.


You have two controllers. Each controller can have an IBOutlet to  
the other one. Just declare the outlets then wire them up in your  
nib, e.g:


I kinda got that, but missed what exactly to wire up...


// MyController.h

@class MyDocument;

@interface MController : NSObject
{
   IBOutlet MyDocument*the_document;
}

...

@end


...
ahh, now that makes sense. That's what I was missing. I was trying to  
add IBOutlets for instance variables but needed to instead add  
IBOutlets for the class (eg MyDocument). Has this been documented  
anywhere? I couldn't find it. I would have thought it a common  
requirement, or is there a better approach to sharing data between  
controllers in the same nib?


When I try to compile the above, I get an error:

expected specifier-qualifier-list before 'MyDocument'

If I change the "MyDocument*" to "id", it works, but what's the problem?

Once you have added the outlets to your classes, they will be  
visible in IB, so just ctrl-drag from one object to the other and  
choose the outlet to connect it. In the .m files, #import the header  
for the other class:


#import "MyDocument.h"


Is this really necessary? It compiles without it. I did it anyway.


In your code, you can now do things like this, from your controller:

NSString* file = [the_document fileString];


the_document is showing as value nil. It doesn't seem to be linked to  
the instance of MyDocument. Am I missing something?


Thanks for all your help,
Tom
BareFeet

___

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

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

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

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


Re: Two controllers in a window, how do I get one to run a function in another?

2009-08-31 Thread Graham Cox


On 01/09/2009, at 12:25 PM, BareFeet wrote:

ahh, now that makes sense. That's what I was missing. I was trying  
to add IBOutlets for instance variables but needed to instead add  
IBOutlets for the class (eg MyDocument).



Whaaa? You're probably getting your terminology confused, but the  
above makes no sense to me. IBOutlets *are* instance variables. You  
don't/can't "add" an IBOutlet for an instance variable. The presence  
of "IBOutlet" is merely a marker that allows IB to parse the file. If  
you look up its definition you'll see it evaluates to nothing.


You are also not adding an IBOutlet for the class. You are adding an  
instance variable, tagged as an outlet, which will point to the  
MyDocument instance.


Has this been documented anywhere? I couldn't find it. I would have  
thought it a common requirement, or is there a better approach to  
sharing data between controllers in the same nib?


It must be documented somewhere, but it's also fundamental to the way  
Cocoa works with nibs, so usually it's something you learn about very  
early on. A better approach? Possibly, but this is generally what I  
do, and probably most people do - it's simple, direct and doesn't do  
anything very "magic" though I guess nib loading itself can seem quite  
magical at first.



When I try to compile the above, I get an error:

expected specifier-qualifier-list before 'MyDocument'

If I change the "MyDocument*" to "id", it works, but what's the  
problem?


Did you include the @class MyDocument; line? That's important - it's a  
forward declaration, which informs the compiler that the MyDocument*  
is merely a pointer, and so it doesn't need to know anything else  
about the class - it has all it needs to proceed to lay out this  
object. You can use id, which is a bit like void*, an anonymous type  
that will shut the compiler up, but it's better to type things  
specifically where you can do so, and here is one such place.



#import "MyDocument.h"


Is this really necessary? It compiles without it. I did it anyway.



Yes, it's really necessary. If you want to properly call the methods  
of the MyDocument class, the code needs to know what they are. By  
typing the_document as id, you allowed the thing to compile using some  
built-in assumptions about what the methods (of class 'id') look like,  
but typically those assumptions are false, so it might work, or it  
might lead to hard to find bugs that keep you guessing for days or  
weeks. If you correctly type the ivar as MyDocument*, it then becomes  
essential to #import its header in your code in order to call its  
methods, but at the same time it eliminates a major source of bugs at  
a stroke.



In your code, you can now do things like this, from your controller:

NSString* file = [the_document fileString];


the_document is showing as value nil. It doesn't seem to be linked  
to the instance of MyDocument. Am I missing something?



Well, have you actually linked it to the instance of MyDocument? If  
these objects exist as part of the nib (which is the simplest  
approach) then you link them together in Interface Builder by ctrl- 
dragging from one to the other. In the case of the document class,  
it's "File's Owner" in the nib. The other controller would typically  
be dragged in as an NSObject (blue cube icon) and have its class set  
to MyController. IB will display the outlets "the_document" and  
"the_controller" and then it's up to you to connect them.


--Graham








___

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

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

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

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


[MEET] September CocoaHeads Mac Developer Meetings

2009-08-31 Thread Stephen Zyszkiewicz

Greetings,

CocoaHeads is an international Mac programmer's group. Meetings are  
free and open to the public. We specialize in Cocoa, but everything  
Mac programming related is welcome.


Upcoming meetings:
Australia
Denmark- Tuesday, September 8, 2009 19:00.

Germany
Bonn- Thursday, September 24, 2009 19:00.

Spain
Barcelona- Friday, September 25, 2009 15:30.

Sweden
Malmö- Tuesday, September 8, 2009 19:00.
Stockholm- Monday, September 7, 2009 18:45.

Switzerland
Zürich- Thursday, September 10, 2009 19:00.

United States
Ann Arbor- Thursday, September 10, 2009 19:00.
Boston- Thursday, September 10, 2009 19:00.
Boulder- Tuesday, September 8, 2009 19:00.
Colorado Springs- Thursday, September 10, 2009 19:00.
Columbia- Tuesday, September 8, 2009 19:00.
Columbus- Tuesday, September 8, 2009 19:00.
Denver- Tuesday, September 8, 2009 19:00.
Fayetteville- Thursday, September 10, 2009 18:00.
Golden- Thursday, September 20, 2007 20:00.
Lake Forest- Wednesday, September 9, 2009 19:00.
Nashville- Thursday, September 10, 2009 19:00.
New York- Thursday, September 10, 2009 18:00.
Pittsburgh- Thursday, September 10, 2009 19:30.
St. Louis- Saturday, September 26, 2009 14:00.
Upper Connecticut River Valley- Thursday, September 10, 2009 19:00.

United Kingdom
Swindon- Monday, September 7, 2009 20:00.

Some chapters may have yet to post their meeting for next month.  
Meeting times may change. Locations and more information here:

http://cocoaheads.org

Also be sure to check for an NSCoder Night in your area:
http://nscodernight.com/


Steve
Silicon Valley CocoaHeads
___

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

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

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

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


How can file packages become unpackaged?

2009-08-31 Thread Graham Cox

Here's a strange one.

In my app I have a bunch of templates which are packaged documents  
loaded directly from my app's resources. On my system and the vast  
majority out there, they work fine. But a couple of users have  
reported that they don't see them.


I've tracked down the issue to the check for a file package. On these  
few systems, - (BOOL)isFilePackageAtPath:(NSString *)fullPath is  
returning NO, so the package gets treated as a folder and has its  
contents scanned (by NSDirectoryEnumerator) instead of being added to  
the list of templates. Similarly, the Finder shows the package as a  
folder not a file, so somewhere the package flag is getting blitzed.


Anyone got any idea how that can happen? The app is downloaded as a  
zip file, unzipped and is simply drag-installed to /Applications (or  
wherever). Does the package flag rely on the unzipper utility knowing  
how to deal with it correctly? Maybe these few people used a different  
unzip utility...  Can permissions have a bearing  
on this? The containing resources folder is read/write for the owner,  
read for 'everyone' and has no group permissions set at all (7-0-5).  
Then again, it works for the vast majority, so it can't really be that.


--Graham
___

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

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

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

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


Re: Setting default button to Window containing box.

2009-08-31 Thread Vijay Kanse
I came to know that setting alpha for box and window content view is rising
this problem.

I don't understand what is connection between setting alpha for view and box
with default buttoncell.

what should be done to avoid vibration for Mouse vibration.


Thanks.

On Sat, Aug 29, 2009 at 10:59 AM, Vijay Kanse wrote:

> Hello list,
>
> My application have window containing button, box , ImageView and Labels.
> box contains some text field and popup buttons.
> I am making one Button as default button cell for Window, and running the
> application, Mouse is Vibrating under the Application window Area. I tried
> to set default button from Interface builder and I got same result.
>
> I am not getting why Mouse is Vibrating under window Area by setting
> default button cell ?
>
> What could be the problem with assigning default button cell ?
>
>
> 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 arch...@mail-archive.com


Re: Two controllers in a window, how do I get one to run a function in another?

2009-08-31 Thread BareFeet

Hi Graham and all,

ahh, now that makes sense. That's what I was missing. I was trying  
to add IBOutlets for instance variables but needed to instead add  
IBOutlets for the class (eg MyDocument).


Whaaa? You're probably getting your terminology confused


but the above makes no sense to me. IBOutlets *are* instance  
variables. You don't/can't "add" an IBOutlet for an instance  
variable. The presence of "IBOutlet" is merely a marker that allows  
IB to parse the file. If you look up its definition you'll see it  
evaluates to nothing.


Yes, bad terminology, sorry. I know IBOutlets are just a label/marker  
for instance variables which Interface Builder recognises. What I  
meant was that I was trying to add in MyController the IBOutlet label  
for an instance variable in the MyDocument class, but should have  
instead labeled an instance of the MyDocument class itself. I don't  
know if that's any clearer.


You are also not adding an IBOutlet for the class. You are adding an  
instance variable, tagged as an outlet, which will point to the  
MyDocument instance.


Yes, that's what I meant ;-)


When I try to compile the above, I get an error:

expected specifier-qualifier-list before 'MyDocument'

If I change the "MyDocument*" to "id", it works, but what's the  
problem?


Did you include the @class MyDocument; line?


Doh!, no, missed that. Thanks for that.

That's important - it's a forward declaration, which informs the  
compiler that the MyDocument* is merely a pointer, and so it doesn't  
need to know anything else about the class - it has all it needs to  
proceed to lay out this object.


Again, I'd like to see where this is documented, in the context of  
linking controllers. Thanks so much for the tip.


You can use id, which is a bit like void*, an anonymous type that  
will shut the compiler up, but it's better to type things  
specifically where you can do so, and here is one such place.


Yes, I'm familiar with id being like void, used as a non-specific  
pointer etc. I prefer to use specific classes, but just used id  
temporarily to isolate the problem. I've specified the type now that  
the error is gone (thanks to @class).



In your code, you can now do things like this, from your controller:

NSString* file = [the_document fileString];


the_document is showing as value nil. It doesn't seem to be linked  
to the instance of MyDocument. Am I missing something?


Well, have you actually linked it to the instance of MyDocument? If  
these objects exist as part of the nib (which is the simplest  
approach) then you link them together in Interface Builder by ctrl- 
dragging from one to the other. In the case of the document class,  
it's "File's Owner" in the nib. The other controller would typically  
be dragged in as an NSObject (blue cube icon) and have its class set  
to MyController. IB will display the outlets "the_document" and  
"the_controller" and then it's up to you to connect them.


Yes, I've done that, control dragged from MyController to File's Owner  
and selected the_document. For simplicity, I'm just creating  
the_document in MyController (I've no need for MyDocument to refer to  
the_controller).


I still get nil for the_document at runtime.

Any other ideas?

Thanks,
Tom
BareFeet

___

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

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

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

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


Re: Two controllers in a window, how do I get one to run a function in another?

2009-08-31 Thread Graham Cox


On 01/09/2009, at 2:55 PM, BareFeet wrote:


Doh!, no, missed that. Thanks for that.

That's important - it's a forward declaration, which informs the  
compiler that the MyDocument* is merely a pointer, and so it  
doesn't need to know anything else about the class - it has all it  
needs to proceed to lay out this object.


Again, I'd like to see where this is documented, in the context of  
linking controllers. Thanks so much for the tip.


Well, it isn't specifically documented in that context, as it's a  
generic feature of the Objective-C language, used for the purpose I  
described - namely, to avoid a dependency between headers when all  
that the compiler really needs to know at that point is the pointer  
size. Most other languages have similar features.


Well, have you actually linked it to the instance of MyDocument? If  
these objects exist as part of the nib (which is the simplest  
approach) then you link them together in Interface Builder by ctrl- 
dragging from one to the other. In the case of the document class,  
it's "File's Owner" in the nib. The other controller would  
typically be dragged in as an NSObject (blue cube icon) and have  
its class set to MyController. IB will display the outlets  
"the_document" and "the_controller" and then it's up to you to  
connect them.


Yes, I've done that, control dragged from MyController to File's  
Owner and selected the_document. For simplicity, I'm just creating  
the_document in MyController (I've no need for MyDocument to refer  
to the_controller).


I still get nil for the_document at runtime.



OK, my antennae are twitching. You're going to have to show your code,  
because it sounds like you're doing something very strange here.


You say you're creating the document in your controller. Huh? I could  
just about imagine the other way around would be OK, but this?  
Nooo. The document is created for you by NSDocumentController, and  
that in turn uses your info.plist to find out what class of document  
is needed for what types of file. The document then loads the  
associated nib, and becomes File's Owner. You will not be creating a  
document anywhere - it's invariably done for you. Realise that the  
objects in a nib are real - you don't have to instantiate them in your  
code - doing so is an error. The objects are instantiated when you  
drag them into the nib window in IB.


The document might then own the controller, and that would be either  
instantiated in the nib (by far the simplest approach) or in your code  
and hooked up manually. Sound like something somewhere is seriously  
bass-ackwards...


Post the code where you create the document.

--Graham


___

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

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

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

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


Re: refresh issue with QLPreviewPanel..!

2009-08-31 Thread Naresh Kongara

Hi,

In snowleopard the framework is provided under quartz framework, and  
some changes are made for preview panel also, i.e instead of setting  
URLS we need to implement datasource methods. I had a seperate  
implementation for snowleopard. This is working fine for Snowleopard.


Only issue is with leopard. ?

Any way thanks for your valuable suggestions.

Thanks,
Naresh K


On Sep 1, 2009, at 1:16 AM, Julien Jalon wrote:


Needless to say that what you do is totally unsupported and will
totally break in 10.6.

10.6 now provides a public (incompatible with Leopard) API but even
with this API, what you do is greatly unsupported (and will break in
the future). Add to that the fact QL panel is very asynchronous, and
it's expected for you to encounter a *lot* of problems.

--
Julien

On Monday, August 31, 2009, Naresh Kongara
 wrote:

Hi,

I have  an app in which i need to display the view to be printed in  
QuickLook preview. For this i thought os using the  
(QlPreviewPanel)QuickLookUI.framework which is available at /System/ 
Library/PrivateFrameworks.


QLPreviewPanel class is obtained using

#define QLPreviewPanel NSClassFromString(@"QLPreviewPanel")

and the QuickLookUI framework is loaded as below.

[[NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/ 
QuickLookUI.framework"] load];


Using NSPrintOperation i'm saving the View to be printed a path say  
PDFPath.

Then i'm passing the PDFPath URL to previewPanel as below.

   [[QLPreviewPanel sharedPreviewPanel] setURLs: 
[NSArray arrayWithObject:[NSURL fileURLWithPath:PDFPath]]];
   [[QLPreviewPanel sharedPreviewPanel]  
makeKeyAndOrderFront:self];



The above code is working fine for the first time. If i close the  
panel  and change the view to be printed(Which inturn changes the  
file  at PDFPath).Now if the panel is shown again with above 2  
lines of code then the panel is not showing the updated one, it is  
showing the previous view only.
If we wait for some time to show the panel, then it is showing the  
correct view only.

There is no problem with file at PDFPath.
I don't know why the preview panel is taking the time to refresh.

If any one has the idea on it, Please let me know.





Thanks,
Naresh Kongara
naresh.kong...@prithvisolutions.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)http://lists.apple.com

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

This email sent to jja...@gmail.com










___

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

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

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

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


Snow Leopard bug?

2009-08-31 Thread Graham Cox

Anyone else seeing this on Snow Leopard?

No apps that have one are properly maintaining their "Recent Items"  
menus. At first I thought it was just my app, since I'm overriding the  
standard behaviour, but it's happening for all apps, XCode included.


--Graham


___

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

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

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

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


Re: Snow Leopard bug?

2009-08-31 Thread Kyle Sluder

On Aug 31, 2009, at 10:32 PM, Graham Cox  wrote:

No apps that have one are properly maintaining their "Recent Items"  
menus. At first I thought it was just my app, since I'm overriding  
the standard behaviour, but it's happening for all apps, XCode  
included.


AppKit on Snow Leopard now obeys the System Preference for the Recent  
menu on te File menu, not just the Apple menu. Make sure your settings  
in System Preferences are as you wish.


--Kyle Sluder



___

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

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

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

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


Build Issue?

2009-08-31 Thread Thomas Willson
I am having a really odd issue while developing my program. I was  
developing my program and went to build. It built fine but when I ran  
it, I got no data back from an NSTask. If I copy the XCode project to  
my other mac, it builds fine. A copy built on the other computer works  
fine on both and a copy built on the first computer doesn't work on  
either. I have since upgraded to Snow Leopard and XCode 3.2 on the  
first computer and still experience the same problem.


Any ideas?

Thanks,
Thomas
___

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

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

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

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


Re: Snow Leopard bug?

2009-08-31 Thread Graham Cox


On 01/09/2009, at 3:41 PM, Kyle Sluder wrote:

On Aug 31, 2009, at 10:32 PM, Graham Cox   
wrote:


No apps that have one are properly maintaining their "Recent Items"  
menus. At first I thought it was just my app, since I'm overriding  
the standard behaviour, but it's happening for all apps, XCode  
included.


AppKit on Snow Leopard now obeys the System Preference for the  
Recent menu on te File menu, not just the Apple menu. Make sure your  
settings in System Preferences are as you wish.


--Kyle Sluder





Ah thanks, hadn't picked that change up.

A trifle annoying, as I dislike the main recents menu filling up with  
irrelevant documents (so it was set to 0) but each app tracks their  
own. I guess I can't have it my way now .


--Graham


___

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

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

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

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


Re: IKSlideshow reloadData should reload, yes?

2009-08-31 Thread Joar Wingfors

Hello Adam,

If you don't get any other replies here, please make sure to file a  
bug report:




Include a sample project if possible.

Thanks,

j o a r


On 31 aug 2009, at 14.50, Adam Knight wrote:

I'm using IKSlideshow to display images that I'm fetching from a  
server in the background.  There is a thumbnail and a full-size  
version of each image.  When IKSlideshow asks for an item at an  
index, if the full-size image is there, I give it the path to that  
cache file.  If it is not there, I give it the path to the thumbnail  
and then initiate the download for the FS version.


That latter part is tricky here because I get a notification that  
the download is complete and then I call -reloadData and/or - 
reloadSlideshowItemAtIndex on the IKSlideshow object and ... nothing  
happens.  In 10.5, I get -numberOfSlideshowItems called again on the  
data source, and in 10.6 absolutely nothing is called on my data  
source.


So ... what is it reloading?

More to the point: how can I get it to reload the image?  Or any way  
of changing the image after it's been displayed?


Regression: in 10.5, I could go next/prev and then the larger image  
would display as it called -slideshowItemAtIndex again.  In 10.6  
it's caching that so I have to rely on the reload methods that don't  
appear to work...


Help?


AK

___

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

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

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

This email sent to j...@joar.com


___

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

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

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

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


Re: Two controllers in a window, how do I get one to run a function in another?

2009-08-31 Thread BareFeet

Hi again Graham and anyone else interested,

Yes, I've done that, control dragged from MyController to File's  
Owner and selected the_document. For simplicity, I'm just creating  
the_document in MyController (I've no need for MyDocument to refer  
to the_controller).


I still get nil for the_document at runtime.


OK, my antennae are twitching. You're going to have to show your  
code, because it sounds like you're doing something very strange here.


You say you're creating the document in your controller. Huh?


No, I'm not specifically creating "the document" (ie an instance of  
NSDocument). I'm just creating the_document instance variable, as per  
your code sample. Perhaps my use of the word "creating" was  
misleading, sorry.


To try to isolate the issue, I created a "Refresh" button and hooked  
it up to a refresh method in MyController. It just calls "init" (as  
below). When the program runs and instantiates a document that I open,  
debugging the init call shows the_document as nil. But when I click  
"Refresh" to call init again, it shows the_document as not nil and  
fileString is assigned correctly etc.


So perhaps it's a problem with the instantiation?

My code is below.

Thanks for your help with this. This is one thorn in a project port  
(from AppleScript Studio) that is otherwise going very well.


Tom

//  MyDocument.h

#import 

@interface MyDocument : NSDocument
{
}
@end


//  MyDocument.m

#import "MyDocument.h"

@implementation MyDocument
// usual template code
@end


//  MyController.h

#import 

@class MyDocument;

@interface MyController : NSObject
{
IBOutlet MyDocument* the_document;
}

- (IBAction) refresh:(NSButton*)sender;

@end


//  MyController.m

#import "MyController.h"
#import "MyDocument.h"

@implementation MyController

- (IBAction) refresh:(NSButton*)sender
{
[self init];
}

- (id) init
{
[super init];
NSString* fileString = [[the_document fileURL] path];
// more code that uses fileString
}

- (void) dealloc
{
[super dealloc];
}

@end

___

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

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

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

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


Re: Two controllers in a window, how do I get one to run a function in another?

2009-08-31 Thread Graham Cox


On 01/09/2009, at 4:13 PM, BareFeet wrote:

To try to isolate the issue, I created a "Refresh" button and hooked  
it up to a refresh method in MyController. It just calls "init" (as  
below). When the program runs and instantiates a document that I  
open, debugging the init call shows the_document as nil. But when I  
click "Refresh" to call init again, it shows the_document as not nil  
and fileString is assigned correctly etc.


So perhaps it's a problem with the instantiation?

My code is below.

Thanks for your help with this. This is one thorn in a project port  
(from AppleScript Studio) that is otherwise going very well.


Tom

//  MyDocument.h

#import 

@interface MyDocument : NSDocument
{
}
@end


//  MyDocument.m

#import "MyDocument.h"

@implementation MyDocument
// usual template code
@end


//  MyController.h

#import 

@class MyDocument;

@interface MyController : NSObject
{
IBOutlet MyDocument* the_document;
}

- (IBAction) refresh:(NSButton*)sender;

@end


//  MyController.m

#import "MyController.h"
#import "MyDocument.h"

@implementation MyController

- (IBAction) refresh:(NSButton*)sender
{
[self init];
}



This is very suspect. You can't send a message to an object that  
hasn't already been inited, and you can't init twice. So one of those  
things is wrong here.


Why don't you just do:

- (IBAction) refresh:(id) sender
{
NSLog( @"file string = %@", [the_document fileString]);
}

and see what you get?


- (id) init
{
[super init];
NSString* fileString = [[the_document fileURL] path];
// more code that uses fileString
}


 is not going to be valid at init time, because your  
init method isn't initialising it. That's why it's nil. However, since  
the document is made for you, and the controller is loaded from the  
nib, you can't set it up here anyway. The nib load itself will set it  
up, assuming you have it connected in IB.


Also, as an aside, pay attention to the correct idiom for init methods:

- (id) init
{
self = [super init];
if( self )
{
// ... local ivar initialisation ...
}

return self;
}



The ivar  won't be valid until at least -awakeFromNib is  
called. That's the earliest point you can access it.


I think you're over-thinking this. Is MyController an object in the  
nib? If so, connect  to File's Owner and you're done. By  
the time your document is ready to use, the controller will be valid,  
exist, and be working. Init time for any of these objects is too early  
- debugging in there won't tell you much because at that time the nib  
hasn't been fully loaded so none of the outlets will have been set.  
Also, for most objects instantiated from a nib, -init isn't even  
called, -initWithCoder: is instead.


If on the other hand you're instantiating MyController in code, stop  
it, and just add it in IB. If you instantiate it yourself you have to  
connect up the outlets yourself, and in that case you're back to  
square one - trying to find the document without a reference to it. It  
can be done, but it's long-winded and unnecessary. Just instantiate  
the controller in the nib, wire up the outlet and you're done.


This is all thoroughly covered in the documentation on nib concepts.

--Graham





___

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

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

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

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