[Meet] Amsterdam CocoaHeads

2010-03-10 Thread Cathy Shive
Hi!

The Amsterdam CocoaHeads group will be meeting tonight, March 10, from 7-9PM.  
Klass Pieter Annema will be presenting Cappuccino and Objective-J. 
http://cappuccino.org/

Directions and other info can be found here:
http://groups.google.com/group/cocoaheads-amsterdam/web/next-meeting-wednesday-march-10-2010?hl=en_US

Hope to see you there!
Cathy


___

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 arch...@mail-archive.com


[MEET] Amsterdam CocoaHeads - Wednesday, Feb 10 7-9PM

2010-02-08 Thread Cathy Shive
Hello, 

The next meeting of the Amsterdam CocoaHeads group will be this Wednesday, 
February 10 from 7-9PM.   This month, Martijn Walraven will present MacRuby.  

More information and directions can be found on the GoogleGroup page:
http://groups.google.com/group/cocoaheads-amsterdam/web/next-meeting---wednesday-february-10-7-9pm?hl=en_US

Hope to see you there!
Cathy___

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 arch...@mail-archive.com


[MEET] Amsterdam CocoaHeads this Wednesday (Jan 13th) 7-9PM

2010-01-11 Thread Cathy Shive
Hello Amsterdam CocoaHeads,

There will be a meeting this Wednesday, January 13th.  More info and a
map to the Sofa office can be found on the meeting page.

http://groups.google.com/group/cocoaheads-amsterdam/web/next-meeting---wednesday-jan-13?hl=en

See you then!
Cathy


___

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 arch...@mail-archive.com


Re: NSColorPanel flat out lies

2009-05-26 Thread Cathy Shive

Hi Seth,

I have a subclass of NSColorWell that broadcasts a  
ColorWellDidBecomeActive notification on activate:.


Objects using the color panel listen for the notification and set some  
internal flag so that they can either ignore the changeColor message  
or not depending on which color well sent the notification.


Kind of sucky work-around but maybe something like this could help you  
in your situation.


Best,
Cathy

On 27 May 2009, at 2:11AM, Seth Willits wrote:



I have a color well, which I am clicking on, and whenever I change  
the color in the color panel, the color panel sends a changeColor:  
message down the responder chain. Every time.


I *don't* want this, because it's sending changeColor to the wrong  
object. It's a bit long-winded to explain, but it boils down to the  
fact that I have this color well bound to a color property in a  
model object and I don't want any actions sent.


So I read the docs:

When you select a color in the color panel, NSColorPanel sends its  
action to its target, provided that neither the action nor the  
target is nil.



Ok, so I figured the color panel must have changeColor: set as its  
action. I went to inspect what it was set to but... YOU CAN'T. There  
is no -target or -action method in NSColorPanel. *lovely*. So I  
tried setting both to nil in my controller, and tried it again...  
Same deal. changeColor: is being called.


So I figured it must be the color well which is setting the action  
when the color well becomes active. So I created a custom color well  
subclass, and did:


- (void)activate:(BOOL)exclusive;
{
[super activate:exclusive];
[[NSColorPanel sharedColorPanel] setTarget:nil];
[[NSColorPanel sharedColorPanel] setAction:nil];
}


... which should hopefully fix the problem. It doesn't. changeColor:  
is *STILL* called.


What the heck do I have to do to make it NOT send an action message?


--
Seth Willits



___

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/catshive%40gmail.com

This email sent to catsh...@gmail.com


___

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 arch...@mail-archive.com


[MEET] Amsterdam CocoaHeads tonight!

2009-05-26 Thread Cathy Shive

Hello!

The Amsterdam chapter of CocoaHeads is meeting tonight, May 27,  from  
7-9 pm.  Please join us if you can make it.


Tonight's speaker is Klass Pierter Annema, who will talk about the  
iPhone app he's been developing for Sofa (http://www.madebysofa.com/).


Location and other info can be found here:
http://groups.google.com/group/cocoaheads-amsterdam/web/next-meeting---may-27-7-9pm?hl=en

Hope to see you there!

Cathy
___

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 arch...@mail-archive.com


[MEET] Amsterdam CocoaHeads Wed, April 22

2009-04-20 Thread Cathy Shive

Hello,

The next meeting of the Amsterdam CocoaHeads will be this Wednesday,  
April 22 from 7-9PM.


Location and presentation info can be found here:
http://groups.google.com/group/cocoaheads-amsterdam/browse_thread/thread/4221ef40dbf68e7d?hl=en

Hope to see you there!

Cathy
___

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 arch...@mail-archive.com


[MEET] Amsterdam CocoaHeads - Wed, Feb 11 7PM

2009-02-09 Thread Cathy Shive

Hello Amsterdam CocoaHeads!

Our next meeting is this Wednesday, 11 February, from 7 - 9 PM.

This month, Austin Sarner will give a presentation on the iPhone's  
table view - UITableView - and Axel Roest will tell us about his  
recent CocoaBootcamp training from the Big Nerd Ranch.


Visit the Google Groups page for location and other information:

http://groups.google.com/group/cocoaheads-amsterdam/web/meeting-20090211?msg=ns#

See you there :)

Cathy


___

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 arch...@mail-archive.com


[MEET] Amsterdam CocoaHeads, Wed Jan 14

2009-01-13 Thread Cathy Shive

Hello Cocoa developers in and near Amsterdam!

The Amsterdam chapter of CocoaHeads will be meeting again this  
Wednesday (tomorrow), January 14 from 7-9PM.


Information about the location and presentation can be found on our  
Google Groups page:


http://groups.google.com/group/cocoaheads-amsterdam

See you there!

Cathy
___

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 arch...@mail-archive.com


[MEET] Amsterdam CocoaHeads - December 10

2008-12-01 Thread Cathy Shive

Hello Cocoa devs!

The next meeting of the Amsterdam CocoaHeads will be Wednesday,  
December 10th from 7-9 PM.


Please visit the Google Group page for location and other information:
http://groups.google.com/group/cocoaheads-amsterdam/web/meeting-20081210

Hope to see you there!

Cathy

___

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]


Re: Custom view controller

2008-11-05 Thread Cathy Shive

Hi Tom,

Setting the view controller as the nib's 'file's owner' won't create  
the problem.  The problem described in the documentation occurs when  
you have set up bindings between objects in that nib file and the  
'file's owner' (your view controller).


If you have done this, it could, indeed, be the reason that your  
dealloc isn't being called, if not, you should check your app for a  
different memory management issue...


Another thing to consider in your view controller is that you're going  
to have to release the objects from the nib file in your view  
controller, or you'll be leaking those objects as well.


I do two things to handle these problems -


1. BINDINGS FROM THE NIB:

I create a method in the view controller called removeObservations -  
could be called cleanUp or removeBindings - whatever.  In this  
method, I unbind any bindings that I set up in the nib file or any  
other kinds of observations that have been set up in code.  This  
method must be called before the view controller is released.   
Subclasses of my view controller implement the method if they have any  
bindings created in a nib file.


// In View Controller Subclass - called right before the view  
controller is released

- (void)removeObservations
{
// unbind bindings from nib file
[oTextField unbind:@bindingName];
[oButton unbind:@bindingName];
// ...etc.

// remove any other observations set up in code
[mArrayController removeObserver:self forKeyPath:@selectedObjects];
[[NSNotifcationCenter defaultCenter] removeObserver:self];
// ...etc.
}

Keep in mind that any time you create a binding or set up  
observations, you need to balance it out by unbinding and removing the  
observation.  Bindings from the nib file are no exception to this.   
NSViewController and NSWindowController just have something built into  
their implementations to take care of it for you.



2.  RELEASING NIB TOP-LEVEL OBJECTS:

I have two methods in the view controller dedicated to the task of  
releasing the nibs top level objects.  The first is a method my view  
controller uses to load a nib file.  It uses NSNib to load the nib and  
to get a list of the objects in the nib. The second is a  
releaseNibObjects method - which just goes through the list and  
releases each object.



// In View Controller - called from 'init'
- (BOOL)loadNibNamed:(NSString*)theNibName bundle:(NSBundle*)theBundle
{
BOOLaSuccess;
NSArray *   anObjectList = nil;
	NSNib *		aNib = [[[NSNib alloc] initWithNibNamed:theNibName  
bundle:theBundle] autorelease];
	aSuccess = [aNib instantiateNibWithOwner:self  
topLevelObjects:anObjectList];

if(aSuccess)
{
int i;
for(i = 0; i  [anObjectList count]; i++)
[_topLevelNibObjects addObject:[anObjectList 
objectAtIndex:i]];
}
return aSuccess;
}


// In View Controller - called from 'dealloc'
- (void)releaseNibObjects
{
int i;
for( i = 0; i  [_topLevelNibObjects count]; i++)
{
[[_topLevelNibObjects objectAtIndex:i] release];
}
[_topLevelNibObjects release];
}

HTH,
Cathy


On Nov 5, 2008, at 8:26 AM, Tomaž Kragelj wrote:


Hello

My application should be tiger compatible, so I can't use  
NSViewController. I created a custom view controller class with  
similar interface albeit much simpler. However I am not sure about  
the following (taken from NSViewController documentation):  
...taking the same care to prevent reference cycles when controls  
are bound to the nib file's owner.


Since my view controlle's dealloc is never called although I release  
it and it is set as nib file's owner, I suspect this is the problem.  
Can someone point me in direction of what is meant with preventing  
reference cycles in this situation?


Thanks, Tom
___

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/catshive%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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]


Re: Custom view controller

2008-11-05 Thread Cathy Shive

Hi Tom,

The design from the posts is identical to the one I use for the non- 
NSViewController based view controllers that I have to use (for the  
same reason as you) - so it can still work for you :) The concepts are  
the same.   You just have to deal with the extra issues that you're  
talking about here.  I have no idea what NSWindowController and  
NSViewController do to solve the problem, I agree, it would be great  
to know!


One other possible issue - is there a table view in the mix?  Is its  
data source or delegate set to be the view controller?  If so, try  
setting its delegate and data sources to 'nil' in the same method you  
use to remove the bindings.   This was the cause of a similar problem  
I had in a custom view controller  - it's a shot in the dark and I  
can't explain it, but maybe...


Best of luck,
Cathy



Hi Raphael and Cathy - thanks both for your replies.

I already implemented top-level objects relasing, that was simple
(although the objects are not released because dealloc is not
called...) - in fact my code is almoust identical to the one shown
below. On the other hand I do bind an NSArrayController within the nib
to the file's owner, so this is probably the cause. I'll check your
code and see how I can adapt it to my case.

Looking at your answer, my original question could be translated into
what do NSWindowController and NSViewController 'just have something
built into their implementations to take care of it for you'... Would
be nice to know... good shot huh... ;-)

By the way, I also looked at yours and Jonathans excellent
XSViewController code and articles, but it is built on top of
NSViewController, so cannot work for me unfortunately. I'll check more
closely to see when you're sending the mentioned messages.

Tom






___

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]


Re: Please help. At wit's end binding NSPopupButtonCell selection

2008-11-04 Thread Cathy Shive
The 'anIndex'  in my snippet is just nothing - you'd have to determine  
that.  I guess it would be something like the selected object index of  
the array controller you're binding the popup's content to?


As for whether or not it's possible to do this with bindings, I'm not  
100% sure...


When the table is first displayed, are the proper selections displayed  
for each row?  Does this problem only come up when you change the  
selection selection in one of the pop up cells?


On Nov 4, 2008, at 11:49 AM, Ken Tozier wrote:


Hmmm. So there's no way to set this up just through bindings?

Also, in your snippet, where does anIndex come from?

On Nov 4, 2008, at 5:32 AM, Cathy Shive wrote:


On Nov 4, 2008, at 10:05 AM, Ken Tozier wrote:

What happens is that when I choose an item in one row's popup  
cell, the selection in every popup in the entire table changes to  
the new selection.


Don't forget that there is only one NSPopUpButtonCell per column.   
If you change it's selection, it's actually correct that when the  
table redraws, the other rows will redraw to show the new selection.


Basically - If you have 5 rows, it appears that there are 5  
different popup menus, but really, there is one that has been drawn  
5 times at different locations.


The table view tells you when it's about to draw a cell and you can  
set the correct selection of your popup cell here.  All you need to  
do is implement the delegate method:


- (BOOL)tableView:(NSTableView *)theTableView willDisplayCell: 
(id)theCell forTableColumn:(NSTableColumn*)theTableColumn row: 
(int)theRowIndex

{
	if([[theTableColumn identifier]  
isEqualToString:@MyPopUpButtonColumn])

[theCell selectItemAtIndex:anIndex];
}


HTH,
Cathy



___

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/catshive%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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]


Re: Please help. At wit's end binding NSPopupButtonCell selection

2008-11-04 Thread Cathy Shive

On Nov 4, 2008, at 10:05 AM, Ken Tozier wrote:

What happens is that when I choose an item in one row's popup cell,  
the selection in every popup in the entire table changes to the new  
selection.


Don't forget that there is only one NSPopUpButtonCell per column.  If  
you change it's selection, it's actually correct that when the table  
redraws, the other rows will redraw to show the new selection.


Basically - If you have 5 rows, it appears that there are 5 different  
popup menus, but really, there is one that has been drawn 5 times at  
different locations.


The table view tells you when it's about to draw a cell and you can  
set the correct selection of your popup cell here.  All you need to do  
is implement the delegate method:


- (BOOL)tableView:(NSTableView *)theTableView willDisplayCell: 
(id)theCell forTableColumn:(NSTableColumn*)theTableColumn row: 
(int)theRowIndex

{
	if([[theTableColumn identifier]  
isEqualToString:@MyPopUpButtonColumn])

[theCell selectItemAtIndex:anIndex];
}


HTH,
Cathy

___

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]


[MEET] Amsterdam CocoaHeads Thursday 10/30 7:00pm

2008-10-27 Thread Cathy Shive
The first meeting of CocoaHeads Amsterdam chapter will be this  
Thursday - October 30th - from 7:00 - 9:00pm.


The meeting will be at the Sofa (http://www.madebysofa.com) office:

Hasebroekstraat 10-12
1053 CT, Amsterdam

Map:
http://maps.google.com/maps?f=qhl=engeocode=q=Hasebroekstraat+10-12+amsterdamsll=37.0625,-95.677068sspn=48.555061,66.796875ie=UTF8t=hz=16g=Hasebroekstraat+10-12+amsterdamiwloc=addr

The agenda for this first meeting is simply to get to some Cocoa  
developers in and around Amsterdam together in one room.  There will  
be beer in the room.


Hope to see you there!
Cathy

___

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]


Re: Design Question: Bindings Custom Views

2008-08-28 Thread Cathy Shive


On Aug 28, 2008, at 11:06 AM, Oleg Krupnov wrote:


In other words, I need a way to associate additional
custom-view-specific properties with model object, without adding them
as transitive properties to the model. What is the best way to do
this? Or maybe your point is that this is a bad idea at all and such
problem should not arise, and I need to include everything in the
model? What is the standard workaround suggested in Cocoa?


Hi Oleg,

I think there are times when it's appropriate to have wrapper objects  
- that are view related - for your model objects.  In an image  
browser, it's likely that there is a thumbnail object that draws  
image objects.


So maybe  your custom view creates thumbnails for the shapes it  
needs to draw and keeps the view-related properties and states in  
those objects - instead of adding them to the shape objects  
themselves?  It's a little crude - but from what I can understand  
about your problem - it could be a place for you to start separating  
the model and view in your design.



HTH,
Cathy











___

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]


Re: Design Question: Bindings Custom Views

2008-08-28 Thread Cathy Shive


On Aug 28, 2008, at 12:26 PM, Oleg Krupnov wrote:

I think there are times when it's appropriate to have wrapper  
objects - that
are view related - for your model objects.  In an image browser,  
it's likely

that there is a thumbnail object that draws image objects.


Yeah, maybe view-related wrapper objects for model objects is the  
right term.


In your image browser example, this problem sounds as follows: where
to store the cached thumbnail images, to avoid re-creating them anew
in each drawRect call? Also, if a thumbnail is in process of dragging
inside the custom view, where to save the flag that the thumbnail
should be highlighted, the next time we draw it in drawRect?



You can go about this several ways.  the crude way ;)  is to have a  
thumbnail for each image that needs to be drawn and have the thumbnail  
cache a bitmap (maybe two or three different sized bitmaps for  
different zoom levels) for each image.  So the thumbnail just creates  
them once and then keeps them around as long as the image is on the  
screen for quick drawing.


A less crude way is to implement some type of caching system - so, if  
the images are drawn in several views at the same time, all the views  
can share a centralized cache of bitmaps.


As far as the view keeping states like which objects need to be  
highlighted, the view can set a isHighlighted flag in a thumbnail  
when it is selected, so the thumbnail can draw itself differently, or  
the view can keep track of the selected image indexes and draw  
selection highlights itself.


If you look at the design of NSTableView, it keeps track of which row  
indexes are selected and draws each highlight right before it draws  
the cells.  If you are customizing the NSCell drawing in a table  
view, the cell object can check if it isHighlighted and adjust its  
drawing based on that.  The return value of isHighlighted is  
something that the view determines for the cell.




I thought this kind of problem should be well-known and commonplace
among Cocoa developers...



I think this is more of a general interface widget design problem than  
a Cocoa problem.  Cocoa developers get this kind of GUI behavior out  
of the box - NSTableView, IKImageBrowser, etc., so it won't come up  
unless you're doing something very custom - as I'm guessing you are.   
Looking at the API for these classes can certainly lead you in the  
right direction for designing your own custom views, if you're looking  
for the Cocoa way to do it.


Also, I have to ask, but is it possible for you to use a pre-made  
object like an NSOutlineView for your UI?



So maybe  your custom view creates thumbnails for the shapes it  
needs to
draw and keeps the view-related properties and states in those  
objects -
instead of adding them to the shape objects themselves?  It's a  
little crude
- but from what I can understand about your problem - it could be a  
place

for you to start separating the model and view in your design.


I am not sure I understood this phrase. Why is it crude? Anyway, I am
looking to solve the problem in the standard way, not reinvent
anything.



The reason I say it's crude is because what I'm suggesting to you is  
to have your view make a separate thumbnail object for each model  
object you need to draw.  You can use this object to cache things and  
to keep track of states of each individual object for the view.  It  
will work well as a way to keep the view related properties out of  
your model.  This wrapper class will also make the needs of your view  
very clear.  Eventually, you can evolve the design of your view so  
that it can handle all of the states, positioning, hit tests, caching,  
etc. itself, maybe eliminating the need for a wrapper thumbnail class  
altogether.


I usually start with the most simple, or crude (maybe that was the  
wrong word ;)) solution and evolve the design from there.


Again, there is no standard Cocoa way to design a custom view like  
this - but taking a look at how some of the comparable Cocoa GUI  
widgets are implemented can give you some good hints.  I've learned  
tons from NSTableView - it's a very flexible design and can be used to  
display any model object you can throw at it.  Look at how NSTableView  
and the IKImageBrowser use delegate and data source designs and how  
they work with cells - their thumbnails - to draw.


If you can use one of these widgets instead of implementing your own  
with very similar behaviors, that would be the best solution - but I  
certainly understand that there are types of interactions that are  
very custom and then you need to roll your own - but even in this case  
you can use NSTableView or IKImageBrowser for inspiration.


http://developer.apple.com/documentation/GraphicsImaging/Reference/IKImageBrowserView/IKImageBrowserView_Reference.html#/ 
/apple_ref/occ/cl/IKImageBrowserView


Re: NSViewController Binding Problem continued

2008-07-19 Thread Cathy Shive



I haven't yet come across a situation in which it would be desirable
for an NSTableView and its associated NSArrayController to be in
separate nibs. I guess Apple haven't, either ;)



Actually, I would think that it's quite common in apps that use  
NSViewController.  Imagine a view managed by one view controller  
displaying a list of items in a table view.  Then another view,  
managed by another view controller, displays details about the  
selected object using several text fields and maybe you can edit the  
selected object's attributes with sliders and pop up buttons.


I'd want to use the same array controller as the data source for the  
views in the different nib files, so I'd keep it somewhere central,  
like the document  or the window controller (in a non-doc based  
app) .  I'd give the view controllers access to the array controller  
by setting their representedObject to either the array controller  
itself or the document/window controller that's keeping the array  
controller.


Am I thinking about this in the wrong way?


I guess that it would be nice if IB would let you bind directly to
representedObject when the File's Owner's class is set to an
NSViewController so that when the nib is loaded, the table view  
gets what it

wants.


Seems like a bit of a special case to me to circumvent something that
Apple could just fix properly! Mind you, it might be nice not to have
to type representedObject. in front of every binding in a view
nib...


Yeah, that's not a bad side effect :)

Cathy

___

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]


Re: NSViewController Binding Problem continued

2008-07-18 Thread Cathy Shive

On Jul 17, 2008, at 10:26 PM, Hamish Allan wrote:


You might wish to file an enhancement request for NSViewController to
provide an init method taking a representedObject to be set up before
attempting bindings etc., which would circumvent this issue.



I wonder if it would actually make a difference in this case.  Since  
the nib doesn't get loaded until the 'load view' method is called and  
she's setting the rO directly after the initializer (before requesting  
the view), the result would be the same, right?  Either way, the  
object you're binding to is the view controller and not the array  
controller that the NSTableView requires.



Or you could argue that, according to the principles of duck typing,
NSTableView shouldn't care, just as long as
representedObject.arrangedObjects.displayText quacks like an array. In
which case it's a bug.



Seems like this is the real issue ;)

I'm really curious to find a solution to this, too - one that doesn't  
involve adding another array controller to the app or moving the  
bindings setup to code.   Going to code isn't too bad, tho...


I guess that it would be nice if IB would let you bind directly to  
representedObject when the File's Owner's class is set to an  
NSViewController so that when the nib is loaded, the table view gets  
what it wants.


Just some wishful thinking.

Best,
Cathy


___

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]


Re: Changing views from within another view

2008-07-04 Thread Cathy Shive

Hi Wayne,

One way you could do this is to connect the control to the First  
Responder object in Interface Builder, instead of to the File's  
Owner.  This means that when the action is triggered,  it will go to  
the window's first responder (probably the view at that point), and  
then move through the responder chain until it finds an object that  
implements the action method.   If you implement the action method in  
your App Delegate class, instead of your view, it will receive the  
action.


Click on First Responder in your nib and add the action to its list  
of actions in the inspector window (in the identity tab).  Then  
connect the control to the First Responder object as the target and  
select the method you added as the action.


Best,
Cathy

On Jul 4, 2008, at 4:02 AM, Wayne Pascoe wrote:


Hi all,

I think I've hacked myself into a corner and I could use some  
advice / clarity in getting out of it.


I am trying to build a tool that uses multiple views inside one  
window as well as additional windows when appropriate.


The code for changing between views (changeViewController and  
displayViewController) lives in the App Delegate class. This class  
has the outlet to the window that all the views are shown in. This  
class is also the delegate for the File's Owner in my main menu nib.


I then have NIBs for each different view. Each NIB has a  
corresponding viewcontroller class which is the class for the File's  
Owner of that NIB.


When the application launches an initial view is loaded and  
displayed in the window from within the App Delegate class. The  
problem I then have is that I can't work out how to change to  
another view. Any methods I try and use are sent to the  
viewcontroller class for that view and not the App Delegate.


The examples that I started out from all used a control outside of  
the view. For example, the view was loaded into a box in the window,  
and outside that box was an NSPopUp that you could use to switch  
views. I understand how this works, as this control sends messages  
to the App Delegate. This then has the code to change the view, and  
it also has the outlet to the window and the box, so it can update  
these.


Is there a way for the viewcontroller class to receive the change  
view request from the user and forward that to the App delegate  
class? Or is this the wrong way to do it?


Any pointers to reading on the correct way to do this would be  
greatly appreciated!


Thanks,
--
Wayne Pascoe(gpg --keyserver www.co.uk.pgp.net --recv-keys  
79A7C870)

Hanlon's Razor:
Never attribute to malice that which is adequately
explained by stupidity

___

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/catshive%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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]


Re: NSReponder chain and controllers

2008-06-19 Thread Cathy Shive
NSArrayController isn't an NSResponder, so you can't add your  
subclasses to the responder chain.  I think the problem is that you  
should be using NSWindowController and NSViewControllers to handle  
menu actions, not NSArrayController.  Those objects can be added to  
the responder chain so you don't have to worry about dispatching  
anything in your code.


On Jun 19, 2008, at 3:05 PM, Adam Knight wrote:

Add your controllers to the responder chain when appropriate and  
then put the IBAction methods in the relevant controllers.  If you  
duplicate methods (like delete: or cancel:) take care as to what  
order you add them into the chain because the first to respond wins  
(though it can always send it to its next responder if it doesn't  
make sense at the moment, like cancel: without an operation running).


Adam Knight
Every man is guilty of all the good he didn't do.  -- Voltaire



On Jun 19, 2008, at 1:20 PM, Robert Douglas wrote:

My code is getting ugly so I suspect I'm doing something wrong.   
I'm trying to hook up menu items in my main menu to actions that  
I've defined in my controllers.  I have a Core Data doc with a  
multiple master-detail view hierarchy, and for testing purposes  
have buttons connected to  a wide variety of methods.  The  
NSArrayController subclasses are not in the responder chain so I'm  
connecting the menu items to the first responder, catching the  
action messages in my document and then dispatch them to the  
correct controller.  That translates into a lot of simple dispatch  
code.  I could move all the intelligence to the document level but  
that strikes me as  equally ugly.  Any suggestions?


___

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/catshive%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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]


NSViewController and Nib files

2008-05-20 Thread Cathy Shive

Hi,

I'm hoping that one of the Cocoa engineers out there can answer a  
question about NSViewController for me.


In the documentation, it states that the view controller will handle  
memory management for the objects in its nib file.  Does this only  
apply to nib files that are loaded by NSViewController behind the  
scenes during the loadNib method?  Lets say that you pass in nil for  
the arguments for nibName and nibBundle in the initializer, and then  
load a nib using NSBundle's 'loadNibNamed:owner' method later on  
(setting the owner to self), will the memory management magic still  
happen?


Thanks,
Cathy


___

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]


Re: Inserting my own Responder before App?

2008-04-23 Thread Cathy Shive
Does your window know about the window controller and vice-versa?   
It's not clear how you're setting this up from your post, but you  
might need to tell the window about your window controller subclass:


[window setWindowController:windowController];

Or the other way around?

[windowController setWindow:window];

Or using brute force, the window controller can add itself to the  
responder chain after the window like this:


[window setNextResponder:self];

If they know about each other, it shouldn't be necessary to  
explicitly set the window's next responder, though.


Best,
Cathy


On Apr 23, 2008, at 9:46 AM, Rick Mann wrote:



On Apr 23, 2008, at 12:37 AM, Ken Thomases wrote:


See this:

http://developer.apple.com/documentation/Cocoa/Conceptual/ 
EventOverview/EventArchitecture/chapter_2_section_6.html


and also -[NSResponder setNextResponder:].

However, NSWindowController automatically uses that method to add  
itself as the next responder after the window it manages.  That's  
illustrated in the above link.  So, I don't think you need to do  
anything special.



I did all that; that's not really what I want.

My NSWindowController subclass is not automatically hooked up (I  
tried). I am able to use the setNextResponder et al. to put it  
*after* the app, but I can't figure out how to set it up so it'll  
be *before* the app.


What I have works, but kinda bugs me, because the app is more  
final than my controller.


--
Rick

___

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/catshive%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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]


Re: copyWithZone error

2008-04-05 Thread Cathy Shive

Hi Nick,

When you return your item to the table column, I believe this is  
setting the cell's object value to this item.  The object value of an  
NSCell needs to conform to the NSCopyingProtocol.

If you implement the method:

- (id)copyWithZone:(NSZone *)zone

in HDIR to return a copy of the object, you won't get this error  
anymore.


Best,
Cathy


On Apr 5, 2008, at 10:25 AM, Nick Rogers wrote:


Hi,
when i return the item for a tableColumn in NSOutlineView, the  
following error is there:


*** -[HDIR copyWithZone:]: selector not recognized [self = 0x39b670]

Here HDIR is the item that i return for a particular tableColumn of  
outline view.

HDIR also inherits from NSObject.

WIshes,
Nick

___

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/catshive%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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]


Re: Modifying the clip view before scrolling.

2008-04-02 Thread Cathy Shive

Hi Peter,

NSScroller has the following methods that might help:

- (void)trackKnob:(NSEvent *)theEvent



- (void)trackScrollButtons:(NSEvent *)theEvent




I've never subclassed NSScroller, so can't comment on the havoc that  
may ensue if you go down this path.



NSClipView also receives a notification when the document view  
changes its frame during a scroll:


-(void)viewFrameChanged:(NSNotification *)notification;

This is the method I use to do things *during* a scroll.

Best,
Cathy

On Apr 2, 2008, at 10:25 AM, Peter Zegelin wrote:

I have a custom view inside a scrollview and need to modify the  
clip view before a user begins to scroll as I have some custom  
rulers built into my view. Is there any way of being notified when  
a user is about to scroll? I tried overriding the mousedown of the  
scrollview but was only able to trap a mousedown in the bottom  
right corner, not in the scrollbars themselves.


thanks!

Peter
___

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/catshive%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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]


Re: Subviews of a borderless window - autoresizing mask does not work for me

2008-04-02 Thread Cathy Shive

Hi Hendrik,

It seems that you're using the correct mask.  The documentation  
states that NSViewMinYMargin would make the bottom margin flexible,  
which is what you want.


I notice that you originally set the frame for the subview at (0,  
0).  Is this because the subview is originally the same size as the  
window's content view?  If not, you should calculate the proper  
origin so that the subview is positioned exactly where you want in to  
be in the window's content view before you set the autoresizing  
mask.  Also, make sure that your top margin isn't something strange.   
If, for example, the top of the subview is beyond the top of the  
window's content view when the mask is set, there will probably be  
strange behavior with autoresizing.  Double check your original  
layout code so that the subview is without a doubt completely within  
the frame of the superview.


Another long shot.  Try using the plain -(void)addSubview method  
instead of the one you're using.  I'm not sure why this would effect  
autoresizing except that it seems that it might be effecting the view  
hierarchy in some way so maybe the superview isn't autoresizing that  
view for some weird reason.  Like I said, real long shot


Good luck,
Cathy

On Apr 2, 2008, at 4:35 PM, Hendrik Holtmann wrote:


Hi,

I am creating a borderless window in source like this:

containerWindow = [[[ContainerWindow alloc]  
initWithContentRect:NSMakeRect 
(rect.origin.x,rect.origin.y-22-34,387,34)  
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered  
defer:NO] retain];


Then I add a custom view (created in interface builder) as a  
subview using the following code:


NSRect frame = [mySearchView bounds];
[mySearchView setFrame:NSMakeRect 
(0.0,0,frame.size.width,frame.size.height)];
[[containerWindow contentView] addSubview:mySearchView positioned:1  
relativeTo:nil];

[mySearchView setNeedsDisplay:YES];

That works fine. I want the customs subview position to be fixed  
now, so when resizing occurs it does not change its position and  
stays fixed to the upper left corner of the window.

Therefore I used
[[containerWindow contentView] setAutoresizesSubviews:YES];
[mySearchView setAutoresizingMask:NSViewMinYMargin];

According to the documentation this should be the right way to do  
it (hopefully). Then I change the height of containerWindow in  
source using:

NSRect frame = [containerWindow frame];
frame.size.height += 200;
frame.origin.y -= 200;
[containerWindow setFrame: frame display: YES animate: NO];
What happens now is that mySearchView moves to the buttom of the  
window. What I would like to achieve is that its fixed to the top  
of the window (left corner). Obviously the autoresizing mask does  
not work here?

Did I miss something? any help would be appreciated!

Best,

Hendrik
___

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/catshive%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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]


Re: Subviews of a borderless window - autoresizing mask does not work for me

2008-04-02 Thread Cathy Shive
The names of the margin-related masks are confusing for sure, I  
always have to look it up because when I think about the names of the  
masks and then think about the springs and struts UI in Interface  
Builder, I always reverse them, too.


On Apr 2, 2008, at 6:38 PM, Nate Weaver wrote:

Whoops, this jogged my memory. For some reason in my last response  
I thought -setAutoresizingMask specified the pinned margin and not  
the expanding margin. I'm not sure why...


On Apr 2, 2008, at 11:13 AM, Cathy Shive wrote:

Hi Hendrik,

It seems that you're using the correct mask.  The documentation  
states that NSViewMinYMargin would make the bottom margin  
flexible, which is what you want.


snipped stuff here
___

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/catshive%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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]


Re: Communications between multiple NIB's

2008-03-24 Thread Cathy Shive

Hi,

Have you tried using the FirstResponder for this?

Add an action to the preferences window's nib's FirstResponder   
called setWindowBackgroundColor.  Then connect the color well to  
the first responder and connect to that action.


If the window controller of the other window implements that action,  
it should hook up correctly through the responder chain.


Best,
Cathy


On Mar 24, 2008, at 5:02 PM, Lincoln Green wrote:

Alright, I have been searching archives, following tutorials, and  
looking at source code for several hours, and I cannot figure out  
the answer to my problem.


Is there a way to programmatically connect to a NIB file and read  
it's outlets without changing my File's Owner? I have a color well  
in one NIB (My Prefs NIB) and a window in another. I want the color  
well to change the window's background. I have an action called  
setColor:, but I cannot figure out how to access the window outlet  
from the NIB containing the window. Please help!


LG
___

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/catshive%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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]


Re: NSImage trapezium...

2008-03-23 Thread Cathy Shive

Seriously?

You aren't going to be able to distort your bitmap like this with  
NSImage and there is no ready-made CIFilter to do this distortion  
that I'm aware of.  If I'm wrong about that, then that's the way to  
go.  But,  I think you've gotta do your own pixel pushing for this one.


Explore the CoreImage API .  If there isn't a filter that you can use  
already, you'll want to learn how to create your own.
http://developer.apple.com/documentation/GraphicsImaging/Conceptual/ 
CoreImaging/ci_intro/chapter_1_section_1.html


I have the feeling, however that  you're going to need to provide the  
math.  You should figure that out first.


Might not be a bad idea to research your topic a little more.  If  
after you do that, you still have questions to ask, try the Quartz  
list.  There will be more graphics people there.


Best of luck!
Cathy

On Mar 23, 2008, at 2:14 PM, Luca wrote:

Hello. Do you know how can I transform a rectangular image in a  
trapezium?


Thanks,
Luca.
___

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/catshive%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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]


Re: NSImage trapezium...

2008-03-23 Thread Cathy Shive
Luca, I am sorry for being snippy.  I automatically assumed you were  
referring to an NSImage when all you said was image.  Many many  
apologies!!


Glenn has you on the right track :)

Again, good luck and sorry *blush*
Cathy


On Mar 23, 2008, at 3:10 PM, glenn andreas wrote:



On Mar 23, 2008, at 8:54 AM, Cathy Shive wrote:

On Mar 23, 2008, at 2:14 PM, Luca wrote:

Hello. Do you know how can I transform a rectangular image in a  
trapezium?


Seriously?

You aren't going to be able to distort your bitmap like this with  
NSImage and there is no ready-made CIFilter to do this distortion  
that I'm aware of.  If I'm wrong about that, then that's the way  
to go.  But,  I think you've gotta do your own pixel pushing for  
this one.




Actually, the CIPerspectiveTransform will do this perfectly (you  
even just give it the resulting four corner points)


You can't do that will an affine transform though (since  
perspective is, by definition, non-affine), so you'll need to use  
CoreImage.



Glenn Andreas  [EMAIL PROTECTED]
 http://www.gandreas.com/ wicked fun!
quadrium | flame : flame fractals  strange attractors : build,  
mutate, evolve, animate




___

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/catshive%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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]


Re: [iPhone] NSTableView and NSIndexPath

2008-03-22 Thread Cathy Shive
Noone's going to answer your question.  A general rule of thumb to  
follow (at least until CocoaTouch SDK is out of beta) - don't ask  
about any classes whose names don't start with the letters NS or  
CA on this list.  I'm sure that there are exceptions - maybe QT,  
but generally this list is for NS and CA questions.


Best,
Cathy

On Mar 22, 2008, at 2:31 PM, Ryan Homer wrote:


NSTableView has a delegate method as follows:

- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
withAvailableCell:(UITableViewCell *)availableCell


You can figure out which section and row of the table is in  
question using indexPath.section and indexPath.row respectively.  
However, I'm having a hard time creating my own NSIndexPath that  
has section and row as properties. Is this a special case of  
NSIndexPath?


What I'm really trying to do is that once I have my table built up  
(think of the contact list, where each section is labeled A, B, C,  
etc. and in each section there are multiple rows, one for each  
contact starting with that letter) I would like to programatically  
scroll to a particular section using UITableView's


scrollToRowAtIndexPath:atScrollPosition:animated:


However, I'm not sure how to create the NSIndexPath that's needed  
for the first parameter so that I can scroll to, say, section 3,  
row 0.


Any ideas?

Thanks!
___

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/catshive%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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]


Re: Correct use of NSViewController

2008-03-21 Thread Cathy Shive
Yeah, this is something I ran into dealing with the fact that I have  
several key value observations set up.  The way I deal with it is to  
give my view controller's abstract superclass a -(void) 
removeObservations method.  I set it up to work similarly to how you  
use the -(void)dealloc method.  A subclass removes all observations  
that it is registered for and bindings and call's super's  
implementation.  The super call makes sure all the subcontrollers get  
the message as well.


I call this method on the first level controller in from the window  
controller in NSWindow's delegate method, - (void)windowWillClose.   
It's the only place I can think to have this happen at the right  
time.  It has to be before the window controller gets released by the  
document and dealloced.


when the window controller's dealloc is called, it just releases its  
view controller.  the view controller superclass releases its mutable  
array of subcontrollers.


don't retain the window controller in the view controller class.   
This should just be a weak reference.  I think you're doing that right.



so for me:

1,  window is about to close (wish there was a more reliable place to  
do this, but it has to be before dealloc):


windowController:

- (void)windowWillClose
{
	[mViewController removeObservations]; // this causes the method to  
be called all the way down the view controller tree

}

2.  view controller removes it's observations

viewController:

- (void)removeObservations
{
[wArrayController removeObserver:self forKeyPath:@selectedObjects];
[super removeObservations];
}

3.  The document closes and the window controller is released and  
dealloced:


window controller:
- (void)dealloc
{
[mViewController release];
[super dealloc];
}

3.  The first view controller is released and dealloced:

viewController:
- (void)dealloc
{
[mSubcontrollers release];
[super dealloc];
}

Everything gets released and dealloced and all observations were  
removed before deallocs were called.


Now, I'm not sure about how to deal with bindings that you set up in  
Interface Builder in terms of controlling *when* the bindings are  
removed and the role of the representedObject in all of this.   
Would have to do a little bit of research on that.



On Mar 21, 2008, at 9:49 PM, Jonathan Dann wrote:


Hi Cathy and Paul,

Thanks to you both for your help, I'm really starting to get  
somewhere with this now.


I now have a view controller hierarchy that reflects the views in  
my app.  I've defined my own view controller subclass that I use  
and an abstract superclass for the view controllers I use in the  
app.  To this 'ESViewController' class I've added a, parent ivar, a  
mutable children array and a few indexed accessor methods for that.


To add a new view controller to the hierarchy I use -addChild: 
(ESViewController *)vC which has the side-effect of setting the  
parent and (originally) the window controller of the child.  The  
parent will be the view controller that calls -addChild: and the  
window controller of the 'root' view controller of the tree is set  
when I first make the root view controller.


Cathy, your suggestion of adding the window controller to the views  
and their children so I could get the document seemed to work at  
first, but I kept getting a warning when closing my document.  One  
of my children view controllers had an NSObjectController with the  
content binding set to @file's owner.windowController.document,  
which worked fine until I tried to close the document.  I was told  
that the window controller was being deallocated while key-value  
observers were still registered with it, which I assume was the  
NSObjectController further down in the view hierarchy.


I think this has something to do with retains, as the window  
controller was not retained by the view controllers, I couldn't get  
my head around who should retain who as my -dealloc methods look  
like this:


// ESViewController (inherits from NSViewController and used as  
abstract superclass for all my view controllers)


- (void)dealloc;
{
parent = nil; // non-retained ivar
self.children = nil;
windowController = nil;
[super dealloc];
}

// ESWindowController  (my window controller for my document)
- (void)dealloc
{
	self.rootViewController = nil; // rootViewController is an  
instance of ESSplitViewController which places a split view in the  
window's content view)

[super dealloc];
}

My windowController's -awakeFromNib method set the root view  
controller, which when instantiated created its children, setting  
their window controllers and parents as such


// ESWindowController
- (void)awakeFromNib;
{
	ESSplitViewController *root = [[ESSplitViewController alloc]  
initWithNibName:@SplitView bundle:nil];

[root setWindowController:self];
[self setRootViewController:root];
[root release];
root 

Re: View with sliding rearranging thumbnails

2008-03-21 Thread Cathy Shive
If you need to support 10.4, you've gotta do it yourself the way you  
described.  You don't have to use an OpenGLView, but the animation  
will suffer if you use Quartz for drawing.  It won't have that really  
snappy, responsive feel that I'm guessing you want.   OpenGl's going  
to give you really good drawing speed, but text and effects like drop  
shadows are hard to get as nice looking as they are in Quartz.   
That's the big trade-off.


Good luck!

Cathy

On Mar 22, 2008, at 2:38 AM, Dave Hersey wrote:


I need 10.4 support too.  : (

- d

On Mar 21, 2008, at 9:34 PM, Jamie Phelps wrote:

You might have a look at the documentation for IKImageBrowserView  
(IKImageBrowserView Class Reference). It's Leopard only, but it  
might just do the trick.


HTH,
Jamie

On Mar 21, 2008, at 8:15 PM, Dave Hersey wrote:

Hi,

I'm working on a view that has a bunch of image thumbnails, say  
something like iPhoto, and I want to be able to grab one and move  
it around, rearranging (with animation) all the other thumbnails  
as it's moved around.


This is NOT an iPhone question, but if you put your iPhone in  
psycho button wiggle mode and start moving the buttons around,  
you'll see what I want to do, sliding animation included, but  
with bigger images, no wiggling and on a Mac. I need this to work  
on 10.4 and 10.5.


There should never be more than 5-200 of these thumbnails in the  
view, with far fewer visible at any one time. Should I just do  
this in an OpenGL view and handle the grid, mousing, rendering  
and animation myself or can anyone think of a better approach?


Thanks,

- d


___

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/catshive%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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]


Re: Correct use of NSViewController

2008-03-21 Thread Cathy Shive
It's so interesting to me to see different people's way of dealing  
with this.  Seems like everyone's design is very similar - they just  
differ in the implementation details.


I hope Apple will fill in the blanks in the framework eventually.  We  
have all come to the same solution in a certain way, but it would be  
easier for us to help each other if we were using the same architecture.


Still, pretty interesting :)

Cathy

On Mar 22, 2008, at 4:31 AM, Steve Weller wrote:



On Mar 21, 2008, at 2:31 PM, Cathy Shive wrote:
1,  window is about to close (wish there was a more reliable place  
to do this, but it has to be before dealloc):


windowController:

- (void)windowWillClose
{
	[mViewController removeObservations]; // this causes the method  
to be called all the way down the view controller tree

}

2.  view controller removes it's observations

viewController:

- (void)removeObservations
{
	[wArrayController removeObserver:self  
forKeyPath:@selectedObjects];

[super removeObservations];
}

3.  The document closes and the window controller is released and  
dealloced:


window controller:
- (void)dealloc
{
[mViewController release];
[super dealloc];
}

3.  The first view controller is released and dealloced:

viewController:
- (void)dealloc
{
[mSubcontrollers release];
[super dealloc];
}


I do a very similar thing, but name things differently. Instead of  
telling the lower objects what to do (remove observations) I tell  
them what is happening at the high level so they can do their own  
thing based on that (window is closing.. so I'll remove my  
observers). This lets me keep everything out of dealloc except for  
memory management. In that way if I switch to GC it will still work.



--
Blog:  http://www.bagelturf.com/   Photos: http:// 
bagelturf.smugmug.com/







___

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]


Re: Correct use of NSViewController

2008-03-20 Thread Cathy Shive
I would do it exactly like you described.   Seems to me that your  
instincts are pretty much on the mark.  In your case, the window  
controller could take care of creating that first main split view,  
but I would do it in the first level of the view controller  
controller tree for logical consistency.  So in a set up like mine  
and maybe yours, the window controller is only responsible for the  
window's content view.  It creates the first view controller, asks it  
for its view (the split view) and adds it as a subview to its own  
view (the window's content view).  And actually, when the window  
controller asks that first view controller for its view, if things  
are set up right in the controller tree, that view should contain the  
entire view hierarchy, which was built in nice little steps by each  
sub-controller in the tree.


I recently had to refactor my view controller set up because I  
started to notice similar bloat and spaghetti code creeping into the  
app.  I had all of the same questions you do about where things  
should happen.  :)   It was a bit tricky at first, but things fell  
into place and it feels very solid and clean to me now.  I also deal  
with a lot of dynamic adding/removing views.


Actually, I sent a bug report (Bug ID# 5794739)  to Apple last week  
because the documentation on Document-Based Application Architecture


http://developer.apple.com/documentation/Cocoa/Conceptual/Documents/ 
Concepts/OverviewDocArchitecture.html#//apple_ref/doc/uid/2023- 
BAJBBBAH


hasn't been updated to explain the role of the new NSViewController  
class in this design.  Also, the issue you are dealing with now and  
that I dealt with a couple of weeks ago seems like it should already  
be dealt with in the design NSViewController.  As it is, it's very  
unclear what you're supposed to do with this class.


Anyway, best of luck, you seem to already know what you have to do :)

Cathy


On Mar 20, 2008, at 2:19 AM, Jonathan Dann wrote:


Hi Cathy,

Thanks for the comprehensive answer to my question, I wanted to  
make sure that I wasn't committing heresy by going down the 'tree  
of view controllers' road before jumping in and refactoring all my  
code.  I was hoping to set it up so I could forget about most of  
the memory management as I'm replacing views all over the place at  
runtime.


Out of interest, when I add my main split view, I then have to set  
its size to fit my document window's content view.  As this task is  
view-related it seems like it the split view's NSViewController  
should handle the size calculation and placing of the view in the  
correct place in the window.  I allocate and instantiate my view  
controller in my NSWindowController subclass, then set the split  
view as a subview of the content view and then  in the - 
awakeFromNib of the view controller I get the split view's  
superview's (the content view's) frame, doing my resiing from there.


Would you do the same, as this seems to encapsulate the logic  
properly, or would you just set it all in the window controller?


Thanks again, you've been really helpful.

Jonathan


___

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]


Re: Correct use of NSViewController

2008-03-20 Thread Cathy Shive

Jonathan,

I just wanted to say one more thing.  I was re-reading what you had  
written and I see the problem you're having with setting up the frame  
for that first split view.


The problem isn't just the set up of your view controllers and the  
order of creating/adding views, you're also dealing with the issue of  
setting an auto-resizing mask for your view.  Wouldn't it be great if  
your view controller for the split view could just configure the view  
to fill it's size to match the size of it's superview instead of  
having to explicitly size and position it when it's created?  This is  
a flaw in this system.  The sub view controller has to be able to  
access the view of its super controller so that it can inspect its  
frame.   With the way autoresizing currently works in NSView, you're  
never going to get around this.


So the part of my system that I haven't described, because I just  
realized that it is important to this issue, is that I have coded my  
own resizing behavior into my NSView subclass to add these kinds of  
features.  I have a FillWidthAndHeight option, for instance (I use  
this one most often). This way I don't have to know the super view's  
frame when I add a subview.  At the end of the original window  
controller's init method, I just reset the frame of the window, and  
NSView goes through the view hierarchy and they all size themselves  
correctly within their superviews.  In fact, when I create my views,  
many of them are initialized with an NSZeroRect and the first thing  
my window controller does is set the content view of the window to be  
one of my NSView subclasses.  This topic is much more difficult to  
tackle, but if you want a truly dynamic view system, your view code  
needs to be able to work without any prior knowledge about the super  
view's and sibling view's frames.


IMHO, this is the the Pandora's Box when it comes to working with the  
view hierarchy.  The standard autoresizing mechanism isn't really  
built to handle dynamic layout changes.  You always have to know the  
exact size of your view and its position within its superview (and  
sometimes the size and position of sibling views) before you set it.


If you need to program a complex, dynamic view system where sizing  
and positioning managed in the code, first subclass NSView and figure  
out a way to deal with autoresizing.  Maybe this is a bigger project  
than you have time take on right now and maybe its unnecessary for  
the scope of your project, but you're going to bang your head against  
this issue over and over again as you develop more dynamic layouts.


It's important to keep in mind the fact that NSView's autoresizing  
and NSWindowController were created to support interfaces that get  
laid out in IB and don't change much after their awake from nib state.


I really hope that I haven't made the issue more complicated for you!

Cathy


On Mar 20, 2008, at 2:19 AM, Jonathan Dann wrote:


Hi Cathy,

Thanks for the comprehensive answer to my question, I wanted to  
make sure that I wasn't committing heresy by going down the 'tree  
of view controllers' road before jumping in and refactoring all my  
code.  I was hoping to set it up so I could forget about most of  
the memory management as I'm replacing views all over the place at  
runtime.


Out of interest, when I add my main split view, I then have to set  
its size to fit my document window's content view.  As this task is  
view-related it seems like it the split view's NSViewController  
should handle the size calculation and placing of the view in the  
correct place in the window.  I allocate and instantiate my view  
controller in my NSWindowController subclass, then set the split  
view as a subview of the content view and then  in the - 
awakeFromNib of the view controller I get the split view's  
superview's (the content view's) frame, doing my resiing from there.


Would you do the same, as this seems to encapsulate the logic  
properly, or would you just set it all in the window controller?


Thanks again, you've been really helpful.

Jonathan


___

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]


Re: Correct use of NSViewController

2008-03-20 Thread Cathy Shive
Yeah, the document.   The window controller and document have a  
relationship, but this isn't true for the view controllers and the  
document.  Again, this is part of NSViewController's ambiguous role  
in this whole architecture.  I don't really know how this *should* be  
dealt with.


It seems like those two key paths would lead to the same thing, but  
obviously some connection isn't being made the way you are  
expecting.  I suspect it has something to do with the fact that the  
binding is being set before the view controller's view is actually  
added to the view hierarchy, so that view's window isn't the window  
controller's window yet which means you have no direct path to the  
window controller's document at that moment.


What if you give your view controllers a reference to the window's  
window controller when you create them?


Your window controller is obviously the first thing to exist.  It  
allocates and initializes the first view controller.  If you  
initialize it with a method like:


- (id)initWithWindowController:(NSWindowController*)theWindowController;

Then they could set their window controller right before they load  
their nibs.


The nibs could use this keypath instead:

@filesowner.windowController.document

That should hook up correctly if you have a windowController ivar in  
your NSViewController subclass.



On Mar 20, 2008, at 12:35 PM, Jonathan Dann wrote:




Hi Cathy,

Thanks again for your advice. I've got it working now and I'm  
almost back I where I was before refactoring, I'm now running into  
a bindings problem.


Before using the view controllers I had put 2 tree controllers in  
my window controller's nib, 2 outline views were then bound to  
these and the tree controllers themselves got their content from an  
object controller that was bound to the the keypath [(Window  
Controller)File's Owner].document. So the object controller was a  
proxy for my document and the tree controllers had shorter keypath  
to traverse to get to the array they needed in my document subclass.


Now when I do this I have the tree controllers and the document  
proxy object controller in my view controller's nib. The only way I  
can see to getting to the document is using the keypath


[File's Owner].view.window.windowController.document

However this does not work, seems convoluted, and I get the following:

KVO autonotifying only supports -setKey: methods that return  
void. Autonotifying will not be done for invocations of - 
[NSSplitView _setWindow:]


So my view controller needs to know about its 'owning' document  
somehow and I can't see how to get it.


Have you run into this. I'm not sure getting the current document  
from the document controller will work as that will change ad the  
user opens more documents.


Thanks again,

Jon

P.S. Out of interest, what do you develop?


___

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]