On Jul 5, 2008, at 10:07 PM, Chris Hanson wrote:
Can you give an example of a framework method that's documented to
return an autoreleased CF object?
NSBitmapImageRep:
- (CGImageRef)CGImage
Returns an autoreleased CGImage object (an opaque type) from the
receiver’s current bitmap
On Jul 5, 2008, at 11:04 PM, mmalc crawford wrote:
On Jul 5, 2008, at 10:07 PM, Chris Hanson wrote:
Can you give an example of a framework method that's documented to
return an autoreleased CF object?
NSBitmapImageRep:
- (CGImageRef)CGImage
Returns an autoreleased CGImage object (an
On Jul 5, 2008, at 22:07, Chris Hanson wrote:
On Jul 5, 2008, at 3:52 PM, Quincey Morris wrote:
The other thing worth noting is that, when GC is enabled, any CF
object that is documented to be *returned* already autoreleased
from a frameworks function is actually returned with a reference
El 06/07/2008, a las 2:05, mmalc crawford escribió:
On Jul 5, 2008, at 3:00 PM, Joan Lluch (casa) wrote:
However, let me copy an excerpt of the Cocoa documentation on the
GC algorithm that Cocoa uses.
You haven't updated your documentation since the beginning of
November last year.
Hi Guys
I've set up matrix with 2 radio buttons (1 and 2) with a delegate method that
gets run when the matrix gets clicked. Lets say radio button 1 is highlighted
and someone clicks on radio button 2. The delegate method has some code that
checks whether the radio buttons are allowed to be
Hello fellow developers,
Is there any of you can give me an idea on the cause of this uncaught exception:
'NSInvalidArgumentException', reason: '*** -[NSCFArray
insertObject:atIndex:]: attempt to insert nil'
I can't seem to find where I should look to trace for this problem,
even though I
On Jul 6, 2008, at 1:25 AM, Jesse Armand wrote:
Is there any of you can give me an idea on the cause of this
uncaught exception:
'NSInvalidArgumentException', reason: '*** -[NSCFArray
insertObject:atIndex:]: attempt to insert nil'
It means something tried to insert nil into an
Each application has its own address space and can access only windows
in its space.
So an application cannot draw content into anoter one and so, it's not
possible to grab a window from an other application.
Le 6 juil. 08 à 01:28, Michael Moore a écrit :
No, I mean actually capture the
Try NSLog(@%@, self) and make sure your are working with the same
document instance and not with two distincs documents objects (one
with a full array and one with an empty array).
Le 6 juil. 08 à 12:26, Mark Wales a écrit :
Do you actually have an accessor method for arrayOfReferences?
Do you actually have an accessor method for arrayOfReferences?
Yes, there is one. I didn't copy the full code in, but there is a
synthesised setter for arrayOfReferences. I tried doing it manually
too and added an NSLog in there. Again the array only came up as empty
when called from that
Try NSLog(@%@, self) and make sure your are working with the same
document instance and not with two distincs documents objects (one
with a full array and one with an empty array).
Ok, that seems to have done something. When I use the NSLog(@%@,
self) in all the other methods I get:
On Sun, Jul 6, 2008 at 4:26 AM, Mark Wales [EMAIL PROTECTED] wrote:
So the document instance changes I guess. Why would that happen and how can
I stop it?
Only your code could tell us why.
-Shawn
___
Cocoa-dev mailing list
So the document instance changes I guess. Why would that happen and
how can
I stop it?
Only your code could tell us why.
The MyDocument.m file is pretty long so I don't want to post it on
here, and it links to other files too. So here's the full source code
instead:
On Jul 6, 2008, at 3:04 AM, Jeff Brown wrote:
The delegate method has some code that checks whether the radio
buttons are allowed to be changed from 1 to 2 and if not, sends an
alert to the user.
My problem is how can I stop the radio buttons themselves changing
from 1 to 2. When
Le 6 juil. 08 à 13:47, Mark Wales a écrit :
So the document instance changes I guess. Why would that happen
and how can
I stop it?
Only your code could tell us why.
The MyDocument.m file is pretty long so I don't want to post it on
here, and it links to other files too. So here's the
You should not create a new instance of MyDocument in your xib file.
So, the solution is pretty simple. Delete the MyDocument object in
your xib file, and bind all action, target and other that was
targetting it to the 'File Owner'.
That works perfectly! Thanks very much – that'll teach
The preferred way to do this is to prevent the user clicking the
button if it's not appropriate by greying it out.
This is far more user-friendly than rebuking a user for having the
audacity to click your button when they shouldn't have, even though
they had no visual cue that they
on 2008-07-06 2:04 AM, mmalc crawford at [EMAIL PROTECTED] wrote:
On Jul 5, 2008, at 10:07 PM, Chris Hanson wrote:
Can you give an example of a framework method that's documented to
return an autoreleased CF object?
NSBitmapImageRep:
NSEvent, too:
- (const void *)eventRef -- returns a
on 2008-07-06 2:45 AM, Quincey Morris at [EMAIL PROTECTED] wrote:
It also occurs to me that the OP is going to have to be careful to
document the behavior of methods in *his* framework that return new CF
objects (if there are any). He'll have to decide whether to use CF
rules (retain count ==
on 2008-07-06 1:07 AM, Chris Hanson at [EMAIL PROTECTED] wrote:
On Jul 5, 2008, at 3:52 PM, Quincey Morris wrote:
The other thing worth noting is that, when GC is enabled, any CF
object that is documented to be *returned* already autoreleased from
a frameworks function is actually returned
on 2008-07-05 6:14 PM, William J. Cheeseman at [EMAIL PROTECTED] wrote:
it would be very helpful to have some good examples of ways to
move cleanup code out of dealloc/finalize and into what you call
deterministic methods.
It occurs to me that this is a question that will eventually be
I agree with you but here is JoelOnSoftware saying virtually the
complete opposite. http://www.joelonsoftware.com/items/
2008/07/01.html. Fortunately most of his commenters disagree.
On 06/07/2008, at 10:21 PM, Graham Cox wrote:
The preferred way to do this is to prevent the user clicking
Le 6 juil. 08 à 14:45, Bill Cheeseman a écrit :
on 2008-07-06 2:45 AM, Quincey Morris at [EMAIL PROTECTED]
wrote:
It also occurs to me that the OP is going to have to be careful to
document the behavior of methods in *his* framework that return new
CF
objects (if there are any). He'll
Not only his commenters disagree.
http://daringfireball.net/linked/2008/07/01/spolsky-menu-items
http://www.red-sweater.com/blog/515/disabled-menus-are-usable
And I disagree too.
Le 6 juil. 08 à 15:41, Peter Zegelin a écrit :
I agree with you but here is JoelOnSoftware saying virtually the
Wow, I'm really surprised that Joel Spolsky of all people would say
this - and so recently too.
I used to like System 7's Balloon Help approach - grey out the menu
but the help balloon would explain why it wasn't available (at least
in an app that took the trouble to implement this).
Some of the commenters suggest a tool tip over the disabled menu
explaining why it is disabled, which sounds reasonable. As a newby
here would this be easy to implement in Cocoa?
On 07/07/2008, at 12:02 AM, Graham Cox wrote:
Wow, I'm really surprised that Joel Spolsky of all people would
Hi, I am in the situation where I want to launch a helper tool,
retrieve the data that it dumps to stdout, and monitor the output of
stderr for error messages and progress control. I did figure out that
the standard way of doing this is along the lines of the Moriarity
sample code. The problem is
On Sun, Jul 6, 2008 at 5:45 AM, Bill Cheeseman [EMAIL PROTECTED] wrote:
on 2008-07-06 2:45 AM, Quincey Morris at [EMAIL PROTECTED] wrote:
It also occurs to me that the OP is going to have to be careful to
document the behavior of methods in *his* framework that return new CF
objects (if there
on 2008-07-06 9:49 AM, Jean-Daniel Dupas at [EMAIL PROTECTED] wrote:
If __strong is so dangerous, why is it used in Cocoa (see NSDrawer,
NSDateFormatter, NSNumberFormatter, NSKeyedArchiver, NSURL, ) ?
Those are interesting examples, especially NSDrawer.
In NSDrawer, only the
On Sat, Jul 5, 2008 at 12:45 PM, Erik Elmgren [EMAIL PROTECTED] wrote:
I think I understand how to solve the display part by using
tableView:dataCellForTableColumn:row: and supplying a full-width cell
(custom subclass), and then painting the fields inside by drawing other
cells. But how do I
On Sun, Jul 6, 2008 at 11:25 AM, Bill Cheeseman [EMAIL PROTECTED] wrote:
on 2008-07-06 9:49 AM, Jean-Daniel Dupas at [EMAIL PROTECTED] wrote:
If __strong is so dangerous, why is it used in Cocoa (see NSDrawer,
NSDateFormatter, NSNumberFormatter, NSKeyedArchiver, NSURL, Š) ?
Those are
I haven't test but -[NSMenuItem setToolTip:] look fine to do this.
Now, just chek if this methods works even when the item is disabled.
Le 6 juil. 08 à 16:31, Peter Zegelin a écrit :
Some of the commenters suggest a tool tip over the disabled menu
explaining why it is disabled, which sounds
Le 6 juil. 08 à 17:35, Michael Ash a écrit :
On Sun, Jul 6, 2008 at 11:25 AM, Bill Cheeseman
[EMAIL PROTECTED] wrote:
on 2008-07-06 9:49 AM, Jean-Daniel Dupas at [EMAIL PROTECTED]
wrote:
If __strong is so dangerous, why is it used in Cocoa (see NSDrawer,
NSDateFormatter,
On Sun, Jul 6, 2008 at 9:05 AM, Jean-Daniel Dupas
[EMAIL PROTECTED] wrote:
I think the rule may be:
use __strong for retained/copied ivars, and nothing for assigned ivars.
There is no equivalent of zeroing ref, but weak ref are really common in
Cocoa. For example, delegate are not retain. the
On Jul 6, 2008, at 05:45, Bill Cheeseman wrote:
So, back to the OQ. I am now inclined to think that, at least in my
circumstances (a shared framework properly balancing CFRetain and
CFRelease), I do NOT need to use the __strong keyword for the CFType-
derived
instance variables, in order to
Yes:
http://ignorethecode.net/blog/2008/07/01/disabling-inactive-menu-
items/
(by way of DaringFireball)
--Andy
On Jul 6, 2008, at 11:57 AM, Jean-Daniel Dupas wrote:
I haven't test but -[NSMenuItem setToolTip:] look fine to do this.
Now, just chek if this methods works even when the item
On Jul 6, 2008, at 05:48, Bill Cheeseman wrote:
So here's a possible approach that was suggested to me privately,
for use in
a framework that supports garbage collection. Comments?
@interface MyFrameworkClass : NSObject {
BOOL wrappedup;
}
- (void)wrapup;
- (void)someMethod;
@end
on 2008-07-06 10:50 AM, Clark Cox at [EMAIL PROTECTED] wrote:
He even goes so far as to suggest that it would be
dangerous or at least inefficient to use __strong in a mixed environment
such as a shared framework that supports both garbage collection and
retain/release, due in part to the
on 2008-07-06 11:35 AM, Michael Ash at [EMAIL PROTECTED] wrote:
You might use __weak if you want a zeroing weak reference. But this
is
extremely uncommon in a dual-mode framework such as what you're
writing,
because there's no equivalent to __weak in the non-GC world.
There is a weak retain
I have an object that I would like to respond to a potentially large
number of KVC compliant to-many accessors of the form:
-countOfkey
-objectInkey:atIndex:
so that they can be used with valueForKey: to return a proxy array, or
just called directly.
Rather than implement these as
on 2008-07-06 1:40 PM, Quincey Morris at [EMAIL PROTECTED] wrote:
The purpose of keeping stuff out of finalize is first and foremost
about safety, and only secondarily about timing or collection-time
overhead. Collectable memory that is referred to by an object being
finalized may itself
On Jul 6, 2008, at 12:56 PM, Steve Weller wrote:
I had thought that implementing forwardInvocation would do this, but
-forwardInvocation is only called if -respondsToSelector says NO.
And if -respondsToSelector says NO, then the tests for -countOfkey
and -objectInkey:atIndex: will always
How can you read a plist file from C?
Unless you're looking for a pure C solution which isn't dependent on
any Mac OS libraries, you could always use CFXMLParser and it's SAX
based callbacks.
Keith Duncan
[EMAIL PROTECTED], 33software.com
___
I have a rather complicated undo setting
I encountered a similar situation where I had multiple plugins each
with their own NSManagedObjectContext and thus their own undo manager.
I solved it by implementing an NSProxy subclass which held references
to all the undo managers and was
On Jul 6, 2008, at 1:44 PM, Keith Duncan wrote:
How can you read a plist file from C?
Unless you're looking for a pure C solution which isn't dependent on
any Mac OS libraries, you could always use CFXMLParser and it's SAX
based callbacks.
I think I missed the original post, so forgive
Le 6 juil. 08 à 20:44, Keith Duncan a écrit :
How can you read a plist file from C?
Unless you're looking for a pure C solution which isn't dependent on
any Mac OS libraries, you could always use CFXMLParser and it's SAX
based callbacks.
If you can use CFXMLParser, you can use
Thanks Michael,
I had deleted that MainMenu NSMenu from the MainMenu.nib thinking I didn't
need it as I had another NSMenu statusItem for my app. But putting it back from
an empty project's nib file solved the issue. Now the textFields accept
cut,copy and paste key equivalents and since i
Note that plist have 3 formats, text, xml, and binary.
That's true, but there's actually a bigger problem at hand here which
I previously overlooked.
located inside the file /Library/Preferences/
com.apple.xgrid.agent.plist
I failed to pick this one up earlier, you shouldn't be assuming
On Sun, Jul 6, 2008 at 12:05 PM, Jean-Daniel Dupas
[EMAIL PROTECTED] wrote:
Le 6 juil. 08 à 17:35, Michael Ash a écrit :
Do you want to keep a reference to a CF object? If yes, use __strong.
End of story.
You might use __weak if you want a zeroing weak reference. But this is
extremely
I have a preferences controller (PreferencesController) that controls
a preferences window. It would be quite nice if I could observe
changes to all of the preferences via key-value observing. In IB I
also have an NSUserDefaultsController that's hooked up to all the
controls, I've tried
On Jul 6, 2008, at 3:12 PM, Keith Duncan wrote:
The only reliable* way to access system preferences is through the
CFPreferences API which NSUserDefaults is built on.
CFURLCreateDataAndPropertiesFromResource() and
CFPropertyListCreateXMLData() for read.
CFPropertyListCreateXMLData() and
Problem:
I would like/need to know the height that would be required to render
a string inside a fixed width box.
Solution that does not work:
So far, I've been using a solution found from a google search and
which looks like this:
- (float)
Le 6 juil. 08 à 21:25, Stéphane Sudre a écrit :
Problem:
I would like/need to know the height that would be required to
render a string inside a fixed width box.
Solution that does not work:
So far, I've been using a solution found from a google
Silly me, I needed to observe the controller itself, not the values...
duh! :-p
[[NSUserDefaultsController sharedUserDefaultsController]
addObserver:self
forKeyPath:[@values. stringByAppendingString:preferenceKey]
options:NSKeyValueObservingOptionNew
context:NULL];
On 7/4/08, Chris Hanson [EMAIL PROTECTED] wrote:
Under non-GC, an object's memory may not be reclaimed until the current
autorelease pool is drained. However, under GC, an object's memory can be
reclaimed as soon as the collector can tell there are no more references to
it -- no matter when
My experience has been that almost every time I've convinced myself
that it was safe to use a particular collectable object in another's
finalize, I was just plain wrong.
This has been my experience as well.
Because the ordering of finalization is undefined, it will often work
anyway, making
Hi,
I'm designing an application that will consist of a main UI app plus
about three agents that will perform various aspects of the product.
I want to support multiple documents for the app, displayed in a
single-window UI in the main app (i.e. using a source list rather than
separate
Steve,
First, have you considered the low tech approach of using a gcc
variadic macro (#define) ? http://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html
You can generate a lot of template code this way. With one line
of code per key you can generate all the accessors you need.
A
The only reliable* way to access system preferences is through the
CFPreferences API which NSUserDefaults is built on.
CFURLCreateDataAndPropertiesFromResource() and
CFPropertyListCreateXMLData() for read.
CFPropertyListCreateXMLData() and
CFURLWriteDataAndPropertiesToResource() to
I need to read and write a .dict file to keep state for my application. i'm new
to cocoa so i don't know how a cocoa app should handle state files.
i do have .dict files as resources in xcode; i've heard, but don't know how to,
that you can save .dict file inbetween an application; and that
Thanks Andy and Jean-Daniel.
Peter
On 07/07/2008, at 3:34 AM, Andy Lee wrote:
Yes:
http://ignorethecode.net/blog/2008/07/01/disabling-inactive-menu-items/
(by way of DaringFireball)
--Andy
On Jul 6, 2008, at 11:57 AM, Jean-Daniel Dupas wrote:
I haven't test but -[NSMenuItem
Store your state information in an NSDictionary, and write it out
using the writeToFile:atomically: method. When you want to read it in,
use the NSDictionary class method +dictionaryWithContentsOfFile:.
Works great.
On Jul 6, 2008, at 7:51 PM, Lemon Obrien wrote:
I need to read and
On 6 Jul 2008, at 6:02 PM, Keith Duncan wrote:
It's all very well that you can read and write to them directly; but
it really isn't advisable. I'm certain the docs state NOT to assume
the preference format either though I can't find it now, you simply
need to take package receipts as an
I've been enjoying NSUserDefaults when going through the Hillegeass book.
I've decided to do a small app that has two colors it stores. I get these
colors from a colorwell via Preference Pane.
I have bounded the values of the wells to backGroundWell and lineWell in IB.
I have the appropriately
On Jul 6, 2008, at 5:02 PM, Ben Trumbull wrote:
First, have you considered the low tech approach of using a gcc
variadic macro (#define) ? http://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html
You can generate a lot of template code this way. With one line
of code per key you can
On Jul 6, 2008, at 10:51 PM, Lemon Obrien wrote:
I need to read and write a .dict file to keep state for my
application. i'm new to cocoa so i don't know how a cocoa app should
handle state files.
i do have .dict files as resources in xcode; i've heard, but don't
know how to, that you
Indeed. Both the setters and getters are being called. I looked in the plist
file for my app and I see BgColor and LineColor
as values with a bunch of digits/hex for its value.
On Sun, Jul 6, 2008 at 10:13 PM, Thomas Mueller
[EMAIL PROTECTED] wrote:
Hi,
Are the setters actually being called?
Sorry. forgot something.
I should add this: I tried reading NSColorPanel from the file (it's a
NSString) and I WAS able to read that just fine.
I think it has something to do with NSKeyedArchive/NSKeyedUnarchiver
On Sun, Jul 6, 2008 at 10:40 PM, Alex Wait [EMAIL PROTECTED] wrote:
Indeed. Both
On 2008 Jul, 05, at 15:55, [EMAIL PROTECTED] wrote:
But when i run the app, the After statement with timed out
message is logged after 30 seconds from the Before statement. When
I set the timeoutInterval between 30.1 to 59.9, it is printed after
60 seconds and so on. I don't know how to
Well, I see a couple problems here
1) Even though you're getting directly passed a color in your setters,
you're ignoring that and trying to find out the color from the wells. That's
bad form for many reasons, and if those backGroundWell and lineWell
variables weren't hooked up correctly, that
70 matches
Mail list logo