Re: Which is the lightest way to draw images and text?

2011-02-03 Thread Erik Buck
On Feb 2, 2011, at 9:22 PM, Omar Hagopian wrote: Hi there! I am planning to implement a component similar to the iphone's photo album.. I guess that using uviews will make the component to have a bad performace , I mean scrolling slow and all of the stuff ... so which way should I take?

Re: sending a message from an initializer method

2011-01-13 Thread Erik Buck
Fair enough. On Jan 13, 2011, at 1:19 PM, Uli Kusterer wrote: On Jan 13, 2011, at 1:27 AM, Erik Buck wrote: Class or instance method makes no difference in this case with regard to polymorphism. It does. He's only passing the two instance variables to the class method. And, being

Re: sending a message from an initializer method

2011-01-12 Thread Erik Buck
Class or instance method makes no difference in this case with regard to polymorphism. On Jan 12, 2011, at 4:51 PM, Gordon Apple wrote: What I would do use a class method and pass the two arrays as parameters. On 1/12/11 2:03 PM, cocoa-dev-requ...@lists.apple.com

Re: NSView drawing with superimposed text

2011-01-02 Thread Erik Buck
Each time -drawRect: is called, the rect parameter is a dirty rectangle calculated by the frameworks to be the smallest area that needs to be redraw. With your implementation, you are probably filling several small sub-rectangles of the view's bounds with white and then stroking lines in only

Re: Ensuring no selection in a table view

2010-12-29 Thread Erik Buck
Enabling empty selection in IB should do the trick. You can also control selection programmatically with the delegate. http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/NSTableViewDelegate_Protocol/Reference/Reference.html Out of curiosity: Why not allow selection? Users

Re: NSTextView vs NSTextField

2010-11-11 Thread Erik Buck
NSTextField doesn't display or edit text at all. It uses an instance of NSTextView calle dthe filed editor to provide all text dispay and editing. So you are right: NSTextFiled cannot do anythingthat NSTextView can't because NSTextField uses NSTextView. NSTextView is a large and heavy weight

Re: NSTextView vs NSTextField

2010-11-11 Thread Erik Buck
Change Filed to Field where appropriate. Grumble...auto-correct...grumble. --- On Thu, 11/11/10, Erik Buck erik.b...@sbcglobal.net wrote: From: Erik Buck erik.b...@sbcglobal.net Subject: Re: NSTextView vs NSTextField To: Cocoa Dev cocoa-dev@lists.apple.com, Eric Gorr mail...@ericgorr.net

[ANN] A new book by Erik M. Buck

2010-09-27 Thread Erik Buck
Of interest to Cocoa and OpenGL ES programmers: OpenGL ES for iOS: All of the Important Parts Addison-Wesley Professional (Developer's Library) [Paperback] Expected publication November 29, 2010. http://cocoadesignpatterns.squarespace.com/updates/ This book contains an introduction to modern

Re: NSImage

2010-09-19 Thread Erik Buck
On Sep 19, 2010, at 12:36 PM, k...@highrolls.net wrote: Am I on the right track or is there something even easier? IMHO, No. Please explain why you would subclass NSImage to accomplish any of your goals. I suspect that the effort of making that explanation will be insightful. Hint:

Re: Programmatic Cocoa (Interface Builder accessibility)

2010-09-15 Thread Erik Buck
http://www.informit.com/articles/article.aspx?p=1211756seqNum=5 http://lapcatsoftware.com/blog/?s=without+a+nib http://lapcatsoftware.com/blog/2007/05/16/working-without-a-nib-part-1/ http://lapcatsoftware.com/blog/2007/07/10/working-without-a-nib-part-5-open-recent-menu/

Re: keyDown:theEvent

2010-09-15 Thread Erik Buck
http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/CocoaFundamentals/Introduction/Introduction.html See NSResponder or, in UIKit, UIResponder

Re: UIView animation

2010-09-03 Thread Erik Buck
I would add that any graph of objects that implements the NSCoding protocol can also be trivially copied. Interface Builder encodes and decodes object graphs when saving the xib/nib files and also when entering test interface mode. As a blatant plug: See Cocoa Design Patterns ISBN:

Re: Sample App Similar to Core Data Data Modeler?

2010-08-24 Thread Erik Buck
You will find a similar connected lines to inputs and outputs interface in Quartz Composer. I don't think Apple has provided source code for either approach, but it is not that hard. One of my company's products contained a similar interface in NeXTstep (proto-Cocoa) in ~1996. We

Re: Making an NSMethodInvocation from the current method

2010-08-22 Thread Erik Buck
use blocks and gcd, or use a proxy http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSProxy_Class/Reference/Reference.html A proxy can forward all invocations to the main thread. Create a subclass of NSProxy. Implement –

Re: Design pattern for core data, document based, graphical application

2010-08-17 Thread Erik Buck
You have too many design options on the table.  Try some of them in mini-prototypes to see how well they work and then drop some of the ideas.   I have used Core Data to store Model data for 2D and 3D drawing/visualization applications.  My approach was to use the Core Data designer to specify

Re: concludeDragOperation

2010-08-16 Thread Erik Buck
I have never seen the specific problem reported, but I have some suggestions: 1) Are you using a retained or non-retain window as opposed to a buffered window?  You want a buffered window. 2) Is the view layer backed?  I don't know ifthat could cause the problem, but I is a path to investigate.

Wow! Just installed OPENSTEP ENTERPRISE 4.2

2010-08-06 Thread Erik Buck
I had a shrinkwraped OPENSTEP Enterprise 4.2 CD from March 1997 in my file cabinet, so I just installed it on a crap 1.83GHz Core 2 (not-duo) running Windows XP SP3.   - OPENSTEP Enterprise 4.2 installes from CD in less than 1 minute (not counting the neccessary reboot that follows)   It is

Wow! Just installed OPENSTEP ENTERPRISE 4.2

2010-08-06 Thread Erik Buck
For comparison, I installed MS Visual Studio 2010 Express Edition C++ on the same machine.  It takes 14 minutes not counting the 2 reboots required.  The first time Visual Studio 2010 C++ starts, it takes more than one minute to get past the splash screen.   The user interface MS Visual Studio

What patterns did we miss in Cocoa Design Patterns?

2010-04-04 Thread Erik Buck
Don Yacktman and I have received feedback that Cocoa Design Patterns should have more coverage of multi-threaded and distributed design patterns. Some readers have asked for comparison and contrast between Cocoa design patterns and patterns in .Net or other frameworks. Is it worthwhile to

Re: Carbon is C++?

2010-02-28 Thread Erik Buck
On Feb 28, 2010, at 10:49 PM, David Rowland wrote: On Feb 28, 2010, at 7:24 PM, Erik Buck wrote: I disagree. I have written very low latency device drivers in Objective-C. Why do you think Objective-C has too much latency for audio? When properly used, Objective-C programs

Re: High Level Toolkit -- is it obsolete or not?

2010-02-26 Thread Erik Buck
Never call -drawRect: directly. It is a Template Methods i.e. Don't call us; we'll call you. (Note: there might be some exceptions that prove the rule.) As of Leopard and possibly sooner, individual dirty rectangles are available through the - getRectsBeingDrawn:count: method if you use it

Re: Stop editing session of NSTextField

2010-02-24 Thread Erik Buck
send [[textField window] makeFirstResponder:[textField window]]; to finish any editing in progress in textField or any other text field within the window. or see Forcing the End of Editing at

Re: Core Data with OpenGL

2009-10-13 Thread Erik Buck
For a variety of reasons, I use Core Data with OpenGL all of the time.  One of my presentations this weekend at Voices That Matter: iPhone Developers Conference uses a Core Data application with two different Views as an example of the MVC design pattern.  One View presents information about

Re: enabling/ disabling a uitextfield

2009-09-15 Thread Erik Buck
Do you have some objection to [myTextFiled setEnabled:YES]; and  [myTextFiled setEnabled:NO]; ?Perhaps you prefer myTextFile.enabled = NO; ? UITextField is a subclass of UIControl which means that all of UIControls properties and methods are available in UITextField.

Re: XC IB 3.2 overlapping siblings

2009-09-11 Thread Erik Buck
Remember that all controls are views. Overlapping sibling controls have a definite user interface smell. Assuming that the overlapping controls are visible at the same time, the appearance is likely to be unsatisfactory. Issues of mouse based picking arise. Which control will be hit by

Re: XC IB 3.2 overlapping siblings

2009-09-10 Thread Erik Buck
Don't overlap sibling views.  Even though it works reliably now, it is still a poor practice for controls and has a definite user interface smell. If you must use the same area of the user interface for different purposes at different times, consider using a tab view with no visible tabs and

Re: NSImage rotation regression?

2009-09-07 Thread Erik Buck
The -bestRepresentationFirDrevice: method is doing nothing better than [anImage size] would do for you. You are not doing anything useful with rotatedSize in your code. Your test for if (degrees == 180.0) is completely pointless. If you were going to do it anyway, you should be looking for

Re: What's actually important to do before exiting?

2009-09-02 Thread Erik Buck
- Posix message queues are a finite kernal resource that is not freed when processes terminate incorrectly. - Posix semaphores are a finite kernal resource that is not freed when processes terminate incorrectly. - MACH IPC message queues are a finite kernal resource that is not freed when

Re: How to find active user in the cocoa

2009-08-10 Thread Erik Buck
http://developer.apple.com/qa/qa2001/qa1133.html answers your question perfectly. That was the first hit when I typed console user into the search field at developer.apple.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post

Dynamic UI with scroll view

2009-07-28 Thread Erik Buck
NSLog(@%@, [scrollView documentView]); //outputs (null) What does NSLog(@%@, scrollView ); tell you ? // the following is a memory leak if you are not using garbage collection [scrollView setDocumentView:[[NSView alloc]  initWithFrame:NSMakeRect(0, 0, 500, 500)]]; Try [scrollView

RE: dragging to move objects around?

2009-07-22 Thread Erik Buck
I didn't see any actual question.  I think you also need to post more code if you want anything better than wild guesses about what you are doing. Start here: http://developer.apple.com/documentation/Cocoa/Conceptual/DragandDrop/DragandDrop.html I assume you are using -

List FAQ and Cocoa learning resources

2009-07-21 Thread Erik Buck
Didn't there used to be a FAQ list for Cocoa-Dev? Several people recently asked me for links to introductory Cocoa and Cocoa Touch information. I pointed iPhone folks to http://developer.apple.com/iphone/library/navigation/GettingStarted.html and the others to

Found Re: List FAQ and Cocoa learning resources

2009-07-21 Thread Erik Buck
Sorry. Right after I posted, I found http://www.cocoadev.com/index.pl?FAQs On Jul 21, 2009, at 6:07 PM, Erik Buck wrote: Didn't there used to be a FAQ list for Cocoa-Dev? Several people recently asked me for links to introductory Cocoa and Cocoa Touch information. I pointed iPhone folks

Re: iTunes COM interface for Windows; need the equivalent for

2009-07-17 Thread Erik Buck
I doubt Apple is going to port Cocoa/CoreData to Windows just for iTunes database� Not that I disagree, but what makes you think Cocoa doesn't already work on Windows? Openstep worked on Windows before it worked on Mac OS X. Cocoa is derived from Openstep. Project Builder (the

Re: Clarification on accessors? (was: Yet another memory management question)

2009-07-08 Thread Erik Buck
I have re-written the Accessors chapter of Cocoa Design Patterns several times because of controversy over whether accessors should, can, must or must not be used in initializers and dealloc.  The bottom line is that accessors are the only way to set synthesized instance variables to nil in the

Re: Clarification on accessors? (was: Yet another memory management question)

2009-07-08 Thread Erik Buck
and -dealloc.  Remind me again why I shouldn't ? --- On Wed, 7/8/09, Bill Bumgarner b...@mac.com wrote: From: Bill Bumgarner b...@mac.com Subject: Re: Clarification on accessors? (was: Yet another memory management question) To: Sean McBride s...@rogue-research.com Cc: Erik Buck erik.b

Re: What is the best way to store some kind of identifying string in an interface builder object?

2009-06-19 Thread Erik Buck
: On 19/06/2009, at 3:59 AM, Erik Buck wrote: use [[myBox subviews] makeObjectPerformSelector:@selector(setEnabled:) withObject:NO]; or similar. Are you certain that works? 'NO' isn't an object, so I didn't think you could use -makeObjectsPerformSelector:withObject: in this fashion

Re: What is the best way to store some kind of identifying string in an interface builder object?

2009-06-18 Thread Erik Buck
See the - (void)setRepresentedObject:(id)anObject method of NSCell.  You can set a string or dictionary and the represented object and retrieve it via -representedObject.   You can also instantiate an array and add objects to the array within IB.  Then you only need an outlet instance variable

Re: Group CGAffineTransform Animations?

2009-06-17 Thread Erik Buck
Only a little bit of math is neccessary to use affine transforms.  A lot of math is needed for general 3D programming, but let's ignore that for now.   My third grader was tought about associative and communitive math operstions.  Some matrix operations are associative and some are communitive. 

Re: Group CGAffineTransform Animations?

2009-06-17 Thread Erik Buck
My third grader was taught about associative and commutative math operations.  Some matrix operations are associative and some are commutative.  That's why the order of operations matters.   Just in case: I didn't mean to imply that even third graders should understand matrix math.  It

Re: to NIB or not to NIB

2009-06-16 Thread Erik Buck
I have a pet theory about why IB is totally obvious at the first encounter for some people and prompts other people to write about ...5 failed attempts (over the  years) to learn IB...   Before I share my theory and bias the responses, I hereby ask those readers who resisted IB for a long time

Re: Card Game (like Spider-Solitaire) in Cocoa -- Conceptual ideas needed

2009-06-12 Thread Erik Buck
http://developer.apple.com/samplecode/GeekGameBoard/ ___ 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: NSButtonCell never asked to draw its whole rect -- clips at width 54.0

2009-06-08 Thread Erik Buck
Set the frame of the NSMatrix. Use -sizeToFit. - or- create and size the matrix the way you want it in IB; save it as a stand alone view; load it; add it as a subview, and add/remove cells to suit your needs. ___ Cocoa-dev mailing list

Re: A couple questions about graphics

2009-06-08 Thread Erik Buck
Announced publicly today: Digital Asset Exchange support. Collada Digital Asset Exchange (.dae) files are a popular way to share 3D models and scenes between applications. Preview now displays these files with OpenGL-powered 3D graphics, so you can zoom and rotate around a 3D scene and play

RE: A couple questions about graphics

2009-06-06 Thread Erik Buck
I have not used any of these VRML resources, but some may be helpful. I think that Blender can output VRML. SketchUp definitely can. http://www.apple.com/downloads/macosx/imaging_3d/freewrlvrmlx3dviewer.html http://sketchup.google.com/support/bin/answer.py?hl=enanswer=114420

Re: NSString initWithFormat and stringWith

2009-05-27 Thread Erik Buck
Don't ever write either of the following lines: NSString *string1 = [NSString stringWithFormat:@myFirstString]; NSString *string2 = [[NSString alloc] initWithFormat:@mySecondString]; the WithFormat methods parse the argument string. If your argument string contains any '%' characters

Re: Categories and splitting an app into logical blocks.

2009-05-15 Thread Erik Buck
Is it a good idea to split all those classes into categories for  writing, reading and testing? For example, Database (Writing),  Database(Reading), Database(Testing) and so on? Or is it a silly thing  to do for some reason?   Maybe ?  What trade-offs have you considered ?  On reason to use

Re: custom NSViews and subviews - creating in IB

2009-05-11 Thread Erik Buck
Do you have a question ? Why don't you just create a subview with various controls in IB. Then, in code, make a copy of that object and in turn make modifications to some of the objects in that view. For example, set a text field to a value. Then, add it to a super view. You seem to

Re: question about mutable vs. non-mutable

2009-05-04 Thread Erik Buck
The whole debate about mutable and immutable classes, the inheritance hierarchy, what it means to return a pointer to a supposedly immutable object, what it means to store a pointer to a supposedly immutable object, the substitutability principle of object oriented programming, whether

Full content of Cocoa Design Patterns available as Rough-Cut on-line

2009-05-04 Thread Erik Buck
The full content of the forthcoming book, Cocoa Design Patterns, is now available as Rough-Cut on-line: http://my.safaribooksonline.com/9780321591210?portal=informit ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin

Any interest in an article comparing and contrasting Cocoa with MS Managed C++ with CLI

2009-03-14 Thread Erik Buck
I am a Cocoa expert, and I have been teaching myself Microsoft Managed C++ (a language very different from ANSI/ISO standard C++) along with Microsoft's CLR/CLI (.Net) frameworks. I am still a novice with Managed C++ and .Net, but I have already drawn some conclusions that were surprising

Re: MVC, storing VIEW-specific information and core data

2009-03-09 Thread Erik Buck
Let me explain how I solved the same problem:   I have an application that stores large data files via Core Data.  Multiple users access the same data at different times, and each user has a preferred way of visualizing the data.  E.g. starting point, filter sets, color coding, etc. all differ

Re: MVC - Model View Control

2009-03-05 Thread Erik Buck
As an author, I humbly recommend http://my.safaribooksonline.com/9780321591210.  Check out the table of contents. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the

Re: NSTextView very slow, any remedies?

2009-02-26 Thread Erik Buck
Why is NSTextView slow for you ?  What profiling have you done, and what does it say is taking all the time ?   I have used NSTextView happily with 100 MB text files before.    I have seen slow behavior under the following conditions: - Change the text content (NSTextStorage) from within

Running Cocoa applications from file servers

2009-02-25 Thread Erik Buck
There is a interesting but long rant about software installers at http://www.bynkii.com/archives/2009/02/on_installers.html.  Most of the rant is about problems with pushing applications to remote client computers.   I'll try to keep this Cocoa related:  All of the applications I develop are

I like the addition of Related Sample Code sections to Cocoa Docs.

2009-02-15 Thread Erik Buck
I like the addition of Related Sample Code sections to the Cocoa reference Docs.  Good work Apple.  Keep it up. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the

Re: I like the addition of Related Sample Code sections to Cocoa Docs.

2009-02-15 Thread Erik Buck
I just used the feedback button at the bottom of every Cocoa document page to tell Apple that I like the addition of the Related Sample Code sections. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or

Re: How to force a message to a overriding method from within an init method

2009-02-11 Thread Erik Buck
Calling a subclass's overridden implementation of a superclass member function from within the super class constructor is very very dangerous in C++. I don't believe if is even supported by the ANSI/ ISO standard, and to the extent it works at all, it is probably compiler and linker

Re: NSTextField - dynamic resizing while editing

2009-02-09 Thread Erik Buck
The Sketch.app example on your hard disk may provide guidance. ___ 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: Sliding Split Views, part II

2009-01-23 Thread Erik Buck
As I recall, this sample code does exactly what you want: http://developer.apple.com/samplecode/Reducer/   I haven't looked at it for a while, so I may be mistaken. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin

Re: NSScroller buttons not scrolling?

2009-01-21 Thread Erik Buck
One possibility that answers the following question which is similar to yours: When I drag the scroll bar, the view scrolls appropriately. When I click in the empty space beside the scroll bar, the view scrolls appropriately. When I click on the scroll arrows, they highlight, but the view

Cocoa and the need for a dynamic language

2009-01-17 Thread Erik Buck
In this forum, Scott Ribe recently wrote ...but just as you can't rewrite Cocoa in C++ as we've seen demanded by people who don't really understand Objective-C... I claim that a relatively dynamic language is necessary to effectively use Cocoa. I also claim to have very deep and thorough

Re: NSTableView

2009-01-14 Thread Erik Buck
The code provided looks very unusual and clearly does not follow the Model-View-Controller design.  It is almost always a bad idea to store information in the user interface.     The following line is extremely suspect: int count =  _browserView-fileList.GetCount();   Why doesn't your

Re: Quartz Composer For Games?

2009-01-07 Thread Erik Buck
http://www.quartzcompositions.com/phpBB2/upload/details.php?file=378 ___ 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

Re: NSApp beginSheet:NSWindow notification of sheet opening?

2008-12-12 Thread Erik Buck
Custom sheets don't spontaneously show themselves.  Right before you send messages to display a sheet, reconfigure the sheet as desired.  Better yet, add a method to the window controller for the sheet and implement that method to both do the special configuration and show the sheet on the

Re: Problem drawing outside of drawRect: in a custom table cell

2008-12-10 Thread Erik Buck
You don't have to draw outside of -drawRect:. Instead of invalidating the table, just call -setNeedsDisplayInRect: or -displayInRect: and pass only the rect of the row that needs to be redrawn. ___ Cocoa-dev mailing list

Re: How to display simple dialog at application startup?

2008-12-04 Thread Erik Buck
See 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: Live image preview, huge memory usage...

2008-12-04 Thread Erik Buck
See http://theocacao.com/document.page/497 See http://www.wilshipley.com/blog/2005/09/jpeg2000-cool-but-slow.html See http://www.macresearch.org/cocoa-tutorial-image-kit-and-image-browser-views-part-i See

Re: Core Data vector modeling query

2008-12-01 Thread Erik Buck
I use Core Data to store large amounts of 3D vector data.  I solved your problem in the following way:   I have a Vector3D entity that you can think of as an end point in your model.  My Vector3D entity has x,y,z attributes.   I have a Vector3DReference entity.   Vector3D has a to many

Re: Core Data vector modeling query

2008-12-01 Thread Erik Buck
As another refinement, store all of your end points as an array of float.  Store the array in NSData.  Have an entity called EndPointStorage that has an NSData attribute, endpoints.   The Vector3DReference entity can then have an integer attribute called endPointIndex.  Use endPointIndex to

Re: Outlets / IBOutlet declarations (was Re: Interface Builder Wiring Objects)

2008-11-18 Thread Erik Buck
If you write correct accessors for all outlets, then the retain/release memory management is entirely handled in one method.  the -set retains the new value and releases the old value.   Any confusion regarding memory management for IB outlets seems to stem from failure to write the accessors

Re: OpenGL + NSTextView/NSTextContainer?

2008-11-18 Thread Erik Buck
Open GL has no built-in capability for drawing text.  Open GL provides lower level primitives like lines and curves and meshes.  Open GL also provides texture compositing.   There are some free and some open text drawing/font solutions for Open GL.  You can use the GLUT library up to a point.  

Re: Enumerating outlets automatically?

2008-11-06 Thread Erik Buck
See http://www.cocoabuilder.com/archive/message/cocoa/2002/6/16/69399   Just put an array in you nib.  Connect all of the objects of interest to the array.  In you controller code, use one outlet to the array. ___ Cocoa-dev mailing list

Re: MVC

2008-10-23 Thread Erik Buck
Blatant plug: See also http://safari.informit.com/9780321591210 Part I: One Pattern to Rule Them All Model View Controller Examples of MVC in Apple Frameworks Chapter 1. Model View Controller ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

What's the modern solution for sharing data between Cocoa to Windows

2008-10-19 Thread Erik Buck
If you watch this video from 1995 and the particularly three subsequent parts of the video, you'll see that NeXT offered an interesting technology for seamless communication between Openstep/ Cocoa objects on the server and rich Windows clients running Excel and Visual Basic applications:

Re: wasting space?

2008-10-06 Thread Erik Buck
--- On Mon, 10/6/08, I. Savant [EMAIL PROTECTED] wrote: What of the Graphics Bindings example mmalc has on his examples page? Here: http://homepage.mac.com/mmalc/CocoaExamples/controllers.html I am not sure what Mmalc was attempting in his example. I looked at it again just now.It seems to

Re: wasting space?

2008-10-06 Thread Erik Buck
I am very confused here. KVO has nothing to do with a call like valueForKeyPath:, other than the obvious fact that they are both built on the idea of key paths. The observeValueForKeyPath:ofObject:change:context: method doesn't interact with valueForKeyPath: in any way, and so I don't really

Re: How to track Slider's value while dragging the mouse?

2008-09-24 Thread Erik Buck
- setContinuous:   setContinuous: Sets whether the receiver’s cell sends its action message continuously to its target during mouse tracking. - (void)setContinuous:(BOOL)flag Parameters flag YES if the action message should be sent continuously; otherwise, NO.

Re: Validating MenuItems before adding them to the menu

2008-09-23 Thread Erik Buck
See the - (id)targetForAction:(SEL)aSelector method.  When adding context menu items, if the target for the menu item's action would be nil, just don't add the menu item.   However, I recommend adding all menu items that are ever available and just disabling the ones that aren't currently

Naming alert panel buttons.

2008-09-23 Thread Erik Buck
We have all seen the ubiquitous OK Cancel buttons.  Many people have recommended more descriptive names that include verbs for button labels.    I just ran across a Cocoa application that shall remain nameless.  I attempted to cancel a long running operation by pressing a Cancel button, and an

Re: Programmatically inserting text into NSTextView and scrolling

2008-09-21 Thread Erik Buck
To add to the answer: http://www.cocoabuilder.com/archive/message/cocoa/2005/9/30/147205 It's also worth noting that a search of the archives reveals literally 100 answers to this and similar questions. ___ Cocoa-dev mailing list

Re: Design Question: Bindings Custom Views

2008-08-29 Thread Erik Buck
Cocoa Design Patterns Chapter 29, Controllers, contains an MVC solution to exactly the problem Oleg Krupnov describes. The chapter presents a relatively simple MVC MYShapeDraw application. The chapter leads the reader through the step by step process of re-inventing NSArrayController

Re: Design Question: Bindings Custom Views

2008-08-29 Thread Erik Buck
Sorry. When I posted about the problem Oleg Krupnov describes, I wasn't caught up on my reading of the list. The VC MYShapeDraw application I describe is a drawing application and not related to image thumbnail caching. Of course, the pattern is general and applicable to image thumbnail

Re: Design Question: Pro Cons of KVC/KVO

2008-08-21 Thread Erik Buck
On Aug 21, 2008, at 7:12 PM, Ken Thomases wrote: I have some quibbles... On Aug 21, 2008, at 12:54 PM, Erik Buck wrote: So, in summary, the whole point of KVC is to standardize the way an object’s properties are accessed regardless of how they are stored. Well, the real point, to my mind

Does NSNotificationCenter have zeroing weak references to observers ?

2008-08-13 Thread Erik Buck
Does NSNotificationCenter use zeroing weak references to observers ? I want to say When using Cocoa’s automated memory garbage collection, NSNotificationCenter automatically un-registers observers that are no longer in use somewhere else in the application. I'm just not sure it's true.

Re: Challenge 18 in Hillegass Book

2008-08-10 Thread Erik Buck
But the question I think is still valid and one I'm I'm trying to figure out myself. How, for instance, would you have the view request data from the document (or any other object for that matter). I understand that it may not always be the best design choices but how is it done? Posting

Re: Bindings to display an NSArray of NSStrings as a single NSString?

2008-08-05 Thread Erik Buck
You could add a category to NSArray... @implementation NSArray (ArrayOfStringsAsSingleString) - (NSString *)arrayOfStringsAsSingleString { return [self componentsJoinedByString:@, ]; } @end ...and then bind to values.arrayOfStringsAsSingleString. Um, why not just bind to

Re: guidelines/tutorial for implementing custom controls

2008-08-04 Thread Erik Buck
Can anybody point me to some good tutorials/guides for implementing custom controls? Do you have some objection to the examples at developer.apple.com ? http://developer.apple.com/samplecode/Clock_Control/index.html http://developer.apple.com/samplecode/TrackBall/

Re: private methods and variables

2008-07-29 Thread Erik Buck
@implementation MyClass int privateVariable; // this is an instance variable @end and int privateVariable; // this is a global variable @implementation MyClass @end ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post

Re: private methods and variables

2008-07-29 Thread Erik Buck
On Jul 29, 2008, at 7:19 PM, Erik Buck wrote: @implementation MyClass int privateVariable; // this is an instance variable @end and int privateVariable; // this is a global variable @implementation MyClass @end Never mind. both declarations above are global variables. @interface

Re: Repositioning a content view w/in a window

2008-07-28 Thread Erik Buck
Is something like this a decent Cocoa approach: // create the window myWindow = [[NSWindow alloc] initWithContentRect: ... ]; // insert the existing matrix as it's content view [myWindow setContentView:myMatrix]; // alter the position of the matrix NSPoint newPoint = ...

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

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

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 Word45 Word77

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

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

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

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

  1   2   >