Questions about Nib Object Retention

2009-10-20 Thread an0
Nib Object Retention Mac OS X - managed memory model Objects in the nib file are initially created with a retain count of 1. As it rebuilds the

Re: Questions about Nib Object Retention

2009-10-20 Thread an0
m their share of ownership. 3. Outlets to non-top-level objects should always use the "retain" logic if they want to claim their ownership, since there are no reserved initial retain count for them. Am I getting it all right? On Wed, Oct 21, 2009 at 11:55 AM, Graham Cox wrote: >

How to sort smoothly when NSTableColumn's Sort Key is empty

2008-06-03 Thread an0
I know how to sort items in NSTableView when each NSTableColumn corresponds to a property of the item object. But what if there is only one NSTableColumn and it is just mapped to the item object itself instead of a property of it? I set the Selector to "compare:" and leave the Sort Key to empty for

Why does this https post request always return "404 Not Found"

2008-06-21 Thread an0
- (void) login { NSString *userName = [[userNameField stringValue] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSString *password = [[passwordField stringValue] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSURL *url = [NSURL URLWithString:@"h

Re: Why does this https post request always return "404 Not Found"

2008-06-21 Thread an0
Cool, it works. Thanks a lot. But as to APIs, I really can't find the login API, or I would of course use that instead of posting forms. Can you tell me where the login API is? On Sun, Jun 22, 2008 at 6:32 AM, Jens Alfke <[EMAIL PROTECTED]> wrote: > This is pretty weird. After some experimenting,

Re: Is it possible for several NSURLConnection instances to share one delegate?

2008-06-25 Thread an0
So it forces me to keep all the fired NSURLConnections, right? Otherwise, I can't tell which is which in my delegate methods. On Wed, Jun 25, 2008 at 10:57 PM, I. Savant <[EMAIL PROTECTED]> wrote: > On Wed, Jun 25, 2008 at 10:17 AM, Ling Wang <[EMAIL PROTECTED]> wrote: >> I can't find a way to ide

Re: Is it possible for several NSURLConnection instances to share one delegate?

2008-06-25 Thread an0
Thank you. Now I'm convinced of it. On Wed, Jun 25, 2008 at 11:20 PM, I. Savant <[EMAIL PROTECTED]> wrote: > On Wed, Jun 25, 2008 at 11:02 AM, an0 <[EMAIL PROTECTED]> wrote: >> So it forces me to keep all the fired NSURLConnections, right? >> Otherwise, I can'

Re: Is it possible for several NSURLConnection instances to share one delegate?

2008-06-25 Thread an0
Sure, I see that. But since it is what both of us could think up, it makes me more confident. On Wed, Jun 25, 2008 at 11:22 PM, I. Savant <[EMAIL PROTECTED]> wrote: >> I believe so, yes. > > It's important to note that I've never had reason to build anything > that handles multiple requests. I'v

Re: Is it possible for several NSURLConnection instances to share one delegate?

2008-06-26 Thread an0
Thank you all. I am going to try what I've learnt from this thread:) On Thu, Jun 26, 2008 at 12:01 AM, I. Savant <[EMAIL PROTECTED]> wrote: >> Just to mention, the natural approach would be a dictionary whose >> keys are connection objects with a value being a request, or maybe >> another dictiona

Why can't I name a property `tag'?

2008-07-10 Thread an0
I have a NSString * property named `tag' in my class Foo, and use Foo instances to populate an NSOutlineView. In one delegate method of NSOutlineView, I pass the `tag' property of an item to a method as an NSString * argument as follows: - (void)outlineViewSelectionDidChange:(NSNotification *)a

Re: Why can't I name a property `tag'?

2008-07-10 Thread an0
t of the method signature. > > You have two choices: > > a) rename your property something else > > b) type the object explicitly where used, and don't use id. > > > hth, > > Graham > > > > > On 10 Jul 2008, at 11:25 pm

Any good advice for naming parameters of init methods?

2008-07-10 Thread an0
I've been always stumbling on the embarrassment of "warning: local declaration of 'xxx' hides instance variable" for my init methods, because I really can't figure out a nice naming pattern for parameters used to assign to instance properties, and I am always apt to write code like this: - (id)ini

Re: Why can't I name a property `tag'?

2008-07-10 Thread an0
have a pet Dog just because my elder brother has one? And should I be accused of lying every time I say I have a pet Cat? On Thu, Jul 10, 2008 at 10:10 PM, I. Savant <[EMAIL PROTECTED]> wrote: > On Thu, Jul 10, 2008 at 9:49 AM, an0 <[EMAIL PROTECTED]> wrote: >> Thanks. But isn&#

Re: Any good advice for naming parameters of init methods?

2008-07-10 Thread an0
> code far more readable by indicating at a glance where a given variable > lives. > > > Graham > > > On 11 Jul 2008, at 12:25 am, an0 wrote: > >> I've been always stumbling on the embarrassment of "warning: local >> declaration of 'xxx' hides

Re: Why can't I name a property `tag'?

2008-07-10 Thread an0
brother's on and it will > be happy (see the cast in the following line): > > > filteredPosts = [[self filterPosts:postNodes WithTag:[(Foo *)[tagView > itemAtRow:row] tag]] retain] > > > Le 10 juil. 08 à 16:50, an0 a écrit : > >> We are Cocoa family. I am a RedCocoa, a

Re: Why can't I name a property `tag'?

2008-07-10 Thread an0
der to read at times. > > Graham > > > > On 11 Jul 2008, at 1:19 am, an0 wrote: > >> However, if you don't know what exact type of Cocoa I am, how could >> you call me BlackCocoa so surely? > > ___ Cocoa-dev m

Re: Why can't I name a property `tag'?

2008-07-10 Thread an0
m the inner message is treated as an NSInteger at the first place, then is passed as an NSString * to the outer message) guessed by compiler? On Thu, Jul 10, 2008 at 11:40 PM, Jens Alfke <[EMAIL PROTECTED]> wrote: > > On 10 Jul '08, at 8:19 AM, an0 wrote: > > However, if you d

Re: Why can't I name a property `tag'?

2008-07-11 Thread an0
It is just simple as you said. And it is cool just after I know what's on earthing happening there. Thanks a lot. On Fri, Jul 11, 2008 at 2:03 AM, Bill Bumgarner <[EMAIL PROTECTED]> wrote: > On Jul 10, 2008, at 8:55 AM, an0 wrote: >> >> Sure. >> I'm gratefu

How to enable/disable buttons immediately after focus transfer

2008-08-05 Thread an0
I know how to do this for NSValidatedUserInterfaceItem by implementing `- (BOOL)validateUserInterfaceItem:(id < NSValidatedUserInterfaceItem >)anItem'; however, NSSegmentedControl and NSButton do not conform to NSValidatedUserInterfaceItem protocol, then how can I switch the enable status of these

Re: How to enable/disable buttons immediately after focus transfer

2008-08-06 Thread an0
you try a subclass of NSWindow and overriding -setFirstResponder:? > > Amin > Am Di,05.08.2008 um 15:36 schrieb an0: > >> I know how to do this for NSValidatedUserInterfaceItem by implementing >> `- (BOOL)validateUserInterfaceItem:(id < NSValidatedUserInt

Why do all these methods of measuring string metrics with font attribute fail?

2008-09-03 Thread an0
I should declare up front that I know there are some arcane ways to measure string metrics using things like NSTextStorage, NSLayoutManager and the kin. Given the string and the font used to render it, it is reasonable there should be some straightforward way to tell the metrics of the string when

Re: Why do all these methods of measuring string metrics with font attribute fail?

2008-09-03 Thread an0
the exact relationship between these two metrics? On Thu, Sep 4, 2008 at 12:38 AM, Douglas Davidson <[EMAIL PROTECTED]> wrote: > > On Sep 3, 2008, at 6:01 AM, an0 wrote: > >> So, can anyone tell me why all these fell through so badly, and what >> is the true straightforwar

Re: Why do all these methods of measuring string metrics with font attribute fail?

2008-09-04 Thread an0
On Thu, Sep 4, 2008 at 11:33 AM, Peter Ammon <[EMAIL PROTECTED]> wrote: > > On Sep 3, 2008, at 6:01 AM, an0 wrote: > >> I should declare up front that I know there are some arcane ways to >> measure string metrics using things like NSTextStorage, >> NSLayoutManager

Re: Why do all these methods of measuring string metrics with font attribute fail?

2008-09-04 Thread an0
for and in what ways. On Thu, Sep 4, 2008 at 4:40 PM, Uli Kusterer <[EMAIL PROTECTED]> wrote: > On 04.09.2008, at 03:57, an0 wrote: >> >> IMO, the size of a string with font attribute is an intrinsic property >> determined only by the string and the font(and the layout o

Re: Why do all these methods of measuring string metrics with font attribute fail?

2008-09-04 Thread an0
more subtle typesetting details, also. Thanks for your hint, anyhow. On Thu, Sep 4, 2008 at 10:05 PM, Graham Cox <[EMAIL PROTECTED]> wrote: > > On 4 Sep 2008, at 11:27 pm, an0 wrote: > >> If they give no useful information for >> application programmers, > > > Y

Re: A cursor bug in DragItemAround example

2008-04-23 Thread an0
> Chances are, calling '[[self enclosingScrollView] > setDocumentCursor:[NSCursor closedHandCursor]]' in 'mouseDown:' will fix the > problem you're seeing. NSScrollView/NSClipView's way of changing the cursor > conflicts with autoscrolling or drag-scrolling, but AFAIK there's no way of > preventin

Failure on unarchiving a NSBezierPath

2008-04-23 Thread an0
I was building a very simple drawing application, but met problems when reading the file saved by my application. The two functions as to archiving/unarchiving are as follows: - (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError { return [NSKeyedArchiver archivedDataWithRootO

Re: Failure on unarchiving a NSBezierPath

2008-04-25 Thread an0
Thanks. But it seems you haven't read to the end. As I said in my first mail: > Besides, I found the value returned by [NSKeyedUnarchiver > unarchiveObjectWithData:data] was nil, but I didn't understand why, > since it was normal when I saved the file using [NSKeyedArchiver > archivedDataWithRootOb

Re: Failure on unarchiving a NSBezierPath

2008-04-25 Thread an0
he data without any error as I can see. Thanks a lot if you or others can give me some more hint. On Fri, Apr 25, 2008 at 4:29 PM, Kyle Sluder <[EMAIL PROTECTED]> wrote: > On Fri, Apr 25, 2008 at 4:11 AM, an0 <[EMAIL PROTECTED]> wrote: > > Thanks. But it seems you haven't rea

Re: A cursor bug in DragItemAround example

2008-04-26 Thread an0
> Does this sample application still use cursorRects/NSTrackingRects? > Leopard introduced a new mechanism -- NSTrackingArea and cursorUpdate > events -- which doesn't have some of the problems that the old > mechanism supposedly had. > > With NSTrackingArea and cursorUpdate you should be able to g

Re: A cursor bug in DragItemAround example

2008-04-26 Thread an0
> My guess is that the cursor you set is getting changed back to the > arrow by the cursorUpdate: method of another view. > > IIRC, you have a NSScrollView whose document view (view A) is > something like a canvas, and has some smaller subviews (each a view B) > that are like graphic objects on the

Re: A cursor bug in DragItemAround example

2008-04-27 Thread an0
On Sun, Apr 27, 2008 at 3:34 PM, Quincey Morris <[EMAIL PROTECTED]> wrote: > > On Apr 26, 2008, at 23:14, an0 wrote: > Setting a cursor always "works", but is useless if something else changes > it immediately afterwards. I think that might be what's happening he

Re: A cursor bug in DragItemAround example

2008-04-29 Thread an0
handling *responsibility* > for the cursor. You should only change the cursor when you are responsible > for it, and when you are responsible for it you should make sure that you > set it. So, for example: > > > On Apr 27, 2008, at 02:35, an0 wrote: > - (IBAction)setItemPropertiesToDef

Re: Failure on unarchiving a NSBezierPath

2008-04-29 Thread an0
On Tue, Apr 29, 2008 at 12:01 AM, Kyle Sluder <[EMAIL PROTECTED]> wrote: > You know what? I don't think you've ever said that you know that > view.drawing != nil. Check that. > > --Kyle Sluder > Oh, what a shame for me to overlook such a critical check! Thank you for helping me find this fooli

Re: How to make NSURLConnection send delegate messages during runModalForWindow

2008-12-16 Thread an0
currentRunLoop must be modal panel's run loop, and currentMode of it must be the mode in which I wanted my connection's delegate methods called. But it turned out that I still missed something here. On Tue, Dec 16, 2008 at 11:49 PM, Michael Babin wrote: > On Dec 16, 2008, at 8:3