> I have recently started programming on Mac using Objective-C and Cocoa. I am > coming from C++/C# world.
Recant, heretic! ;-) > In first line, I was expecting something like [self setColor:[NSColor > blackColor]]; (similar to this.color = NSColor.blackColor; in C#/C++) > how NSColor object knows about where to set the color? In all seriousness, you'll need to read the Cocoa Drawing Guide. The answer to this quesiton is found there. NSColor's -set method tells the current drawing context to use that color as the current drawing color. All drawing actions will happen with that color because it's set as the current color. > In second line, NSRectFill(), I was expecting it to be called using square > bracket [] notation. Again how this function knows where to fill the > rectangle? There is no reference of NSView passed into the function? Using brackets means you're sending an object a message: [someObject message]; As you might guess, NSRectFill() is a standard c function. Obviously, the signature gives you a good clue. Again, this applies to the current graphics context (which knows what view currently has focus, and therefore its bounds). -- I.S. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]