• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Defining Accessors in a Custom Palette for a NSArray for Cocoa Bindings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Defining Accessors in a Custom Palette for a NSArray for Cocoa Bindings


  • Subject: Re: Defining Accessors in a Custom Palette for a NSArray for Cocoa Bindings
  • From: Tim Lucas <email@hidden>
  • Date: Wed, 12 Jan 2005 09:44:59 +1100

On 12/01/2005, at 12:14 AM, E. Wing wrote:
Thank you again for the response. I think I need a few more concrete
details to get over this hurdle if you don't mind...

It's a little difficult to tell exactly what your intent is, but I
*think* you could do it either way.

My intent was to create a self-contained palette that could draw a line (say with an OpenGL backend). I wanted the users of my palette to drag my palette-view into their application and be able to define how to draw the line by adding an NSTableView (with 3 columns for x, y, z) to their application. Using Cocoa bindings, I was hoping my palette could see all the points inserted in the table and then update itself to draw lines between each point.

I'd imagine you'd have a graph view (NSView subclass -- view) and a graph controller (NSArrayController -- nonview) in your palette.


The view would be bound to the controller, the controller would be bound to the tableview.

The less the enduser of my palette knows of my implementation, the
better, as I don't want to burden them with the details of my
implementation. But, for now, I would settle for whatever I can get
working because much of this is a proof of concept project I need to
get done to convince my managers that this can actually be done.

Can't see why they'd have to know of your implementation. Worst case is that they may have to know the keys to use when creating the bindings.


You could probably create a self-contained palette item that includes
an array controller, and which provides bindings such that you could
hook up the controller much as you would a stand-alone controller.

In this first case you describe, are you suggesting I create a second palette (a non-view based palette) which is merely an array controller? Then I would attempt to bind my Line-drawing palettle and the final application's palette to this controller palette?

Why are you trying to bind palettes?

I'd
be more inclined, though, to go for the simpler approach of just
putting the view on the palette and hooking it up to a standard array
controller that you bind in turn to whatever is appropriate.

And in the simpler approach you describe, can you elaborate more on what I need to? I didn't quite understand this. I currently have my palette. It contains an NSMutableArray as an ivar and expose it as a binding. My 2 failures seem to be that I am unable to specify its behaviors for things like insert and remove (where I want to invoke OpenGL code for drawing), and I have been unable to specify that this array has elements of type "LinePoint". To fix this, you are saying I need to get an NSArrayController into this some how, which does actually make sense to me. But I'm still blank on the how part.

Your graph view's 'setter' for it's mutable array would be bound to the array controller's "arrangedObjects" key.
In your view's 'setter' you would update your ivar and call [self setNeedsDisplay].


It would be great if you could combine the view and controller creation step into one, so when the user drags out the graph view it instantiates a correspdoning graph controller and sets the outlets correctly. Then the user just has to bind the controller with the tableview. I'm not 100% sure you can do this. Specifically, i'm not sure if you can add an object instance to the 'instances' palette... but they say anything's possible with IB ;)

- tim lucas

http://www.toolmantim.com

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Defining Accessors in a Custom Palette for a NSArray for Cocoa Bindings
      • From: "E. Wing" <email@hidden>
References: 
 >Re: Defining Accessors in a Custom Palette for a NSArray for Cocoa Bindings (From: "E. Wing" <email@hidden>)

  • Prev by Date: custom focus ring ?
  • Next by Date: Saving, file types, and non-document-based apps
  • Previous by thread: Re: Defining Accessors in a Custom Palette for a NSArray for Cocoa Bindings
  • Next by thread: Re: Defining Accessors in a Custom Palette for a NSArray for Cocoa Bindings
  • Index(es):
    • Date
    • Thread