Re: Sent Actions, Delegates, Outlets

2008-07-24 Thread Erik Buck
Warning: Blatant self serving plug: Target/Action, Delegates, and Notifications are all software design patterns. They aren't even unique to Cocoa, but Cocoa has particularly elegant implementations. You can read/review all about these patterns and more including analysis of the m

A study of the Cocoa Indie Island

2008-07-23 Thread Erik Buck
There is an interesting study regarding the sociology of Cocoa Indie developers at http://madebysofa.com/indiefever/ which I read and enjoyed via http://daringfireball.net/. My wife and I used to describe the various Cocoa developer forums, WWDC, the old MacHack, Stepwise, etc. as my "islan

Re: Dumb question: How does NSScrollView know the size of the thing it's scrolling?

2008-07-23 Thread Erik Buck
As is the case with all NSViews, the frame of the view defines the area occupied by the view in its superview's coordinate system. The bounds of a view defines that view's own coordinate system irrespective of the frame. Therefore, if the frame size and bounds size for a particular view are d

Re: drawRect infinite loop -- argh!

2008-07-19 Thread Erik Buck
See a break point in drawRect: and then tell us why it is being called. Seriously, do you have some philosophical objection to using the debugger ? Isn't this what it's for ? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not

Re: Inverse Regex Library?

2008-07-17 Thread Erik Buck
You ask an interesting computer science question (that's unrelated to Cocoa). Surely the following sequence of words would produce Word[1-9]{1,2} instead of Word[0-9]{1,2} because there is no representative 0 in the sample ? "Word1" "Word2" "Word5" "Word8" "Word11" "Word19" "Word23" "W

Re: how to add modal dialog once application begin to run

2008-07-15 Thread Erik Buck
Have a look at http://www.stepwise.com/Articles/2006/eb1/index.html ___ 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

Re: hitTest question

2008-06-20 Thread Erik Buck
You are off to a good start by trying to mimic something as well conceived and implemented as Cocoa's -hitTest: approach. Now, because you want to re-invent the solution, you will need to know a lot of details about graphics programming and associated mathematics. Determining whether a 2D

Re: Drawing in CALayers

2008-06-17 Thread Erik Buck
I am a little bit confused by Scott's statement that "if you use layers-hosting views, then you should not rely on view drawing at all ... conversely, if you use layer-backed views then you should not directly access the views." I may just misunderstand what Scott means, but I have used lay

Re: How does an instance variable in the ObjC code get connected to an interface element in the NIB file? BACK ON TRACK

2008-06-16 Thread Erik Buck
Over 130 outlets! Holy Sassafras Tea! That is ten to fifteen times more outlets than I have ever seen in a single class in 20 years of Objective-C programming! I suspect you are doing something very wrong. First, use the Model-View-Controller pattern. Don’t store application state

Re: ObjectController and ArrayController tutorials

2008-06-14 Thread Erik Buck
Ashley, As it happens, I have written a chapter in "Cocoa Design Patterns" about "why" NSArrayController and friends exist and how to use them. I am interested in feedback on the chapter. Contact me privately if you want to see if we can arrange some way for you to review the chapter.

Re: adding a delegate to a class

2008-06-10 Thread Erik Buck
See http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CommunicatingWithObjects/chapter_6_section_4.html ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list

Re: using Undo with portable C++ data model

2008-06-06 Thread Erik Buck
There are many pure C++ applications in the world that implement undo. You don't have to use the Cocoa undo at all if portability is important. Implement undo in C++ using the Command pattern or whatever technique you want. Then integrate Cocoa GUI support via menu items etc. for invokin

Will programmers new to Cocoa benefit from a Cocoa Design Patterns Book ?

2008-06-02 Thread Erik Buck
In answering some private email about the forthcoming "Cocoa Design Patterns" book, I made the following observations. Design patterns describe high quality practical solutions to recurring programming problems and can sometimes be quite abstract. Design patterns state how to solve pr

ANN: “Cocoa Design Patterns” content availa ble via the Safari Rough Cuts

2008-06-02 Thread Erik Buck
ANN: The publisher of the upcoming “Cocoa Design Patterns” book has made approximately half of the content available via the Safari Rough Cuts system. Customers can (for a fee) start reading and commenting on the book now while it is still in development. Readers get early access to the conten

Re: Another newbie question

2008-05-30 Thread Erik Buck
A better subjuct might have been "How should I use interface objects to select command line arguments?" or something like that. The current subject adds no value and will not help others search for information in the future. Having said that... One approach you might take (that will

Re: Okay I have those pieces... now where's the g lue?

2008-05-27 Thread Erik Buck
> How do I allow controller A to send commands to controller B and vice > versa? If controller A initialized controller B, then A knew about B, but > what about the other way round? 1) A can have an instance variable that points to B. 2) B can have an instance variable that points to A.

Re: Resizing a view to match the main NSWindow size?

2008-05-25 Thread Erik Buck
Changing the opengl viewport every time you draw is generally a poor practice. Setting the viewport is traditionally one of the most expensive open gl operations. The window will not resize anywhere near as often as the view will be redrawn. That is why it is usually better to reset the

Re: Detecting a resize window event?

2008-05-25 Thread Erik Buck
I use the -resize method within an NSOpenGLView subclass. Is there some reason you don't use an NSOpenGLSubclass ? @implementation EBNMapOpenGLView - (id)initWithFrame:(NSRect)frame { static NSOpenGLPixelFormatAttribute attribs[] = { NSOpenGLPFANoRecovery, NSOpenGLPFAWindow

Re: Detecting a resize window event?

2008-05-25 Thread Erik Buck
I would like to dispatch a message to a C++ controller letting it know that the window has been resized to x,y dimensions. Then you want the window delegate messages. - (void)windowDidResize:(NSNotification *)notification Also, please use the available documentation. http://developer.apple.

How hard is it to learn Cocoa - Survey ?

2008-05-25 Thread Erik Buck
I have been working with Cocoa and its predecessors for so long that I can't remember how long it took me to learn to use the frameworks. One of my first non-trivial NeXTstep applications was a Tetris game. It was about 1989 or early 1990 when a friend was admiring my NeXT cube. She aske

Re: Is there anything pathological with the following NSView simple subclass?

2008-05-24 Thread Erik Buck
Try this search http://developer.apple.com/cgi-bin/search.pl?q=NSOpenGLView&num=10&site=(samplecode) Take insight from the samples. Start with NSOpenGLView unless you have some strong reason to poll your own. ___ Cocoa-dev mailing list (Cocoa-de

Re: File's Owner

2008-05-23 Thread Erik Buck
On May 23, 2008, at 5:30 PM, [EMAIL PROTECTED] wrote: On May 23, 2008, at 2:49 PM, Johnny Lundy wrote: I decided to once again go verbatim through Cocoa Fundamentals. So far it has been largely "uh-huh, yep", but the File's Owner, my nemesis, comes up again. [deleted] Again, I'm sensing a very fun

Re: NSTableView

2008-05-23 Thread Erik Buck
Your question was very good. My only criticism of the way you asked you question is the vague title of the post. Ask as many questions like this per day as you want. change the following: - (id) directoryTable: (NSTableView *) aTableView objectValueForTableColumn:(NSTableColumn *) aTableCo

Re: File's Owner

2008-05-23 Thread Erik Buck
What programming experience do you have? Perhaps I can explain File's Owner in terms of some other framework you already know ? You use the File’s Owner “proxy” in each nib file to enable connections or key paths to objects that are not instantiated within that nib file. Interface Builder ne

Re: Method -fax: in IB's First Responder?

2008-05-21 Thread Erik Buck
Apple removed fax support in Mac OS X 10.0 and then restored it in OS X 10.3. http://developer.apple.com/technotes/tn2002/tn2082.html ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to

Documenting and editing nib files was Re: Cocoa et al as HCI usability problem

2008-05-21 Thread Erik Buck
[deleted] But there is no clear specific conceptual reason (that I know of) why a list of these connections could not be made more user-editable. What's more, this makes documenting simple code examples much harder, as the drags all need to be documented in a necessarily less-rigourous way (and p

Re: Method -fax: in IB's First Responder?

2008-05-21 Thread Erik Buck
In the NeXTstep 2.0 or 3.0 time frame, NeXT added AppKit framework support for faxing. Anything that could be printed could be faxed. The cool part was that all existing AppKit based applications automatically got fax support via the print panel without even being recompiled. This is ano

ANN: Step by step introduction to programming with Cocoa

2008-05-21 Thread Erik Buck
I have started a guided introduction to Cocoa programming at the Cocoadev wiki site: http://www.cocoadev.com/ The goal is to provide an sequence in which to learn Cocoa and links to the basic information. My hope is that by just stating a step by step sequence of topics, users will be abl

Re: Cocoa et al as HCI usability problem

2008-05-20 Thread Erik Buck
I agree completely with Mark Roseman's analysis: 1) Too many chioces 2) Too many concepts 3) Too much housekeeping 4) Doesn't support everything 5) Too much hype. The only additions I can make are the following: 1) Many folks from the Windows worls are certainly familiar with

Re: Conceptual MVC Help

2008-05-20 Thread Erik Buck
Given your class: // Popup.h // TestPopup #import @interface Popup : NSObject { NSArray *popupArray; NSString *selectedGame; } @property (readwrite, copy) NSArray *popupArray; @property (readwrite, copy) NSString *selectedGame; @end To start with, in my opinion you have a brok

Re: Initialize a subclass object with a base class object

2008-05-20 Thread Erik Buck
1) NSCell is often used along with the Prototype design pattern. See the -setPrototype: method of NSMatrix. When so configured, NSMatrix copies its prototype cell as needed to create new instances. 2) Of course NSCell implements . Otherwise it couldn't be used in Interface Builder becau

Re: Initialize a subclass object with a base class object

2008-05-19 Thread Erik Buck
I am not sure I understand the OP's question, but the shortest answer seems to be to override the super class's designated initializer. http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/chapter_3_section_6.html http://developer.apple.com/documentation

Dynamic langauge support for fault implementation in Enterpise Objects Framework

2008-05-19 Thread Erik Buck
One of the coolest examples of dynamic language untility was provided By Apple's Enterpriise Objects Framework (EOF). Here is a brief quote from http://developer.apple.com/documentation/LegacyTechnologies/WebObjects/WebObjects_4.5/System/Documentation/Developer/EnterpriseObjects/DevGuide/EOFDevGu

Examples of dynamic language feature exploitation by Cocoa from .Net perspective

2008-05-19 Thread Erik Buck
First, let me say that I have enjoyed the Kevin Hoffman's .Net Addicts Blog posts comparing Cocoa and Objective-C to .Net and C#. I personally think C# is a great language and I appreciate .Net as well. There are many programming tasks which are easier and simpler with the aid of dynamic langu

Re: Cocoa et al as HCI usability problem

2008-05-18 Thread Erik Buck
FROM : Peter Duniho DATE : Mon May 19 07:03:25 2008 [deleted] Real people are having real problems getting into Cocoa. I don't see the kind of repeated commentary about poor documentation and difficult APIs in the C#/.NET forums or Java forums. It comes up once in a blue moon, but not with the

Re: Cocoa et al as HCI usability problem

2008-05-18 Thread Erik Buck
On Sun, May 18, 2008 at 8:41 PM, Julius Guzy <> wrote: Tthe fact is that there will be others like me who do not find it easy to get into cocoa. At this stage I'll not be jumping ship but believe me I've had sleeples nights about it. Mainly i'll not do it because although I'm far from attack spee

Cocoa bindings and reluctance to use NSPopupButon

2008-05-18 Thread Erik Buck
Johnny Lundy had a difficult time using NSPopupButon along with bindings. The struggles are archived via www.cocoabuilder.com for posterity. Mr. Lundy recently wrote "...I am still very very hesitant to put another NSPopUpButton on my interface, because of the complete absence of guidance

Re: Cocoa et al as HCI usability problem

2008-05-18 Thread Erik Buck
There are conventions and metaphors of human computer interfaces. Apple used to provide interactive training programs to explain the use of a mouse to customers in stores. My own father who is a brilliant scientist could not initially master double-click and fifteen years later frequentl

The challenge for Cocoa's on-line documentation

2008-05-16 Thread Erik Buck
The potential audience for a computer programming documentation can range from beginner's who don't know what a compiler is to people who are experts themselves and just want a quick reference. Beginners are frustrated when prerequisite knowledge is assumed, and experts are frustrated when they

Subject: Re: Bypassing Interface Builder

2008-05-15 Thread Erik Buck
> OK - I really don't need the name then, but I am puzzled as to > how my new class got instantiated. Here's what I did: > 1. Create the class, the .h and .m files. Great. This is how Objective-C classes are generally created. Good job. > 2. Code the ivars, their @property directives, an

Re: Basic info about outlets

2008-05-15 Thread Erik Buck
But, just exactly HOW does the actual documentWindow object get passed so that someMethod can look at one of its properties? This question is oriented to "behind the scenes" For the current version of Interface Builder, see - (void)connectOutlet:(NSString *)outletofSourceObject:(id)sou

Guidance for Cocoa's steep learning curve

2008-05-14 Thread Erik Buck
The obstacles, misconceptions, and prerequisite concepts that need to be mastered when learning Cocoa vary dramatically based on the past experience of the learner. I am a very experienced Cocoa programmer. I am also an author of the thickest Cocoa Programming book and have another Cocoa

Re: Group rotation

2008-05-07 Thread Erik Buck
Regarding flowing text around objects, do you have a function for breaking an arbitrary shape into a series of line rectangles that you'd be prepared to share with the world? http://www.cocoabuilder.com/archive/message/cocoa/2007/2/22/179186 ___ Cocoa

Re: Another graphical challenge...

2008-04-18 Thread Erik Buck
Micro Tile Arrays are a general solution for minimal rectangular decomposition of arbitrary shapes. The overlapping rectangles problem is the simplest case and easily solved by utas. Here is an open source implementation: http://www.levien.com/libart/uta.html ___

Re: Enabling File Open/Save etc in a non-document-based application

2008-04-16 Thread Erik Buck
See the TextEdit example code on you hard disk. The last time I looked, it was not a document based application, and it certainly displays an Open dialog. Or, you can look at the sample in Cocoa Programming which explains in detail how the Cocoa document infrastructure works including a partia

Using the debugger with local variables was Re: is this badly written code?

2008-04-15 Thread Erik Buck
>1) Write each portion of the code by assigning to intermediate ivars. >This of course is easiest if you just type them in-line as you write >them, but then of course they will not show up in the debugger so it > is better to go ahead and type them in the @interface section. Say what ? Loca

Re: Obj-C idioms for list based tasks

2008-04-07 Thread Erik Buck
This is a prime use for Higher Order messaging: http://www.metaobject.com/papers/Higher_Order_Messaging_OOPSLA_2005.pdf http://www.cocoadev.com/index.pl?HigherOrderMessaging http://www.oreilly.com/pub/a/mac/2004/07/16/hom.html HOM takes this // which of these employee objects earn more than 10

Re: How to create process independent of current process AND that takes command line arguments?

2008-04-04 Thread Erik Buck
open a terminal or your favorite internet search and type "man nohup". ___ 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.

Re: NSMatrix

2008-03-26 Thread Erik Buck
Wow! Dave Hersey wrote a very detailed and comprehensive post that must have taken a long time. Sadly, I disagree with almost all of it. NSMatrix is an "older" class that predates the "data source" design pattern that emerged (i think) in NeXTstep 3.0 in about 1994 as I recall. I think NSMat

Re: Garbage collection - was Beginner with Cocoa

2008-03-25 Thread Erik Buck
We have been asked not to paraphrase or restate the memory management rules in this forum because slight inaccuracies, imprecisions, misstatements, or just idiocy confuses people. Here is a quote: From file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.doc

Re: Garbage collection - was Beginner with Cocoa

2008-03-24 Thread Erik Buck
In Ruby GC just works dandy without thought. Why is it so different in Cocoa Obj2.0? What kinda of real headaches will I have jumping into osx programing compared to ruby ? The short answer is that Ruby is a nifty high level scripting language that insulates the programmer thoroughly from poin

Re: Beginner with Cocoa

2008-03-24 Thread Erik Buck
> You'll probably have to learn the old way, "retain and release," > which is unique to Objective-C. For the record, reference counting for memory management is one of the oldest techniques in software and is not unique to Objective-C or Cocoa. Microsoft Foundation Class CString uses it. CO

Re: Intercepting retain/release of object

2008-03-21 Thread Erik Buck
When dealing with an over release problem, just turn on NSZombieEnabled, and you will quickly find the problem. If you restrict retains and releases to accessors, you won't have very many places you need to look. ___ Cocoa-dev mailing list (Cocoa-dev

Re: Custom Shaped Buttons

2008-03-20 Thread Erik Buck
If all you want is a custom shape button, subclass NSButton and override a few methods, -hitTest:. http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/Reference/NSView.html#//apple_ref/occ/instm/NSView/hitTest: Use whatever image you want. Then implemen

Re: Button on a button

2008-03-11 Thread Erik Buck
There is this example of buttons on a button: http://www.stepwise.com/Articles/Technical/NSCell.html But from your description, I suspect you want Core Animation Layers: http://developer.apple.com/documentation/Cocoa/Conceptual/CoreAnimation_guide/Introduction/Introduction.html __

<    1   2