Problems with Thai Fonts in 10.6.1

2009-11-04 Thread Gerriet M. Denkmann


When I write ก๊ัม in TextEdit with the Thonburi font, the vowel  
and the tone mark get superimposed and form one ugly and unreadable  
blob (the tone mark should be on drawn above the vowel).


And when I write ฟำฝำปำฬำ with Ayuthaya and Silom fonts  
the ำ are all invisible.


None of these problems occured in 10.5 and earlier.

The question: what can I do to work around these problems?

Probably nothing if I use TextEdit; but with my own editor there might  
be a way to make the LayoutManager (or whoever is responsible for this  
mess) behave in a sensible way.


But I just don't know where to start looking.


Kind regards,

Gerriet.

 ___

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: NSDate / NSXMLParser

2009-11-04 Thread Ingvar Nedrebo

The easiest way is to set the timezone on the formatter:

[dateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];


On Nov 3, 2009, at 21:54, David Rowland wrote:

Thanks to all for this useful discussion. I think I have solved my  
problem by taking the data from the parser as is and then applying a  
correction for my offset from GMT when I do my arithmetic. Like this,


 int offset = [[NSTimeZone localTimeZone] secondsFromGMT];
 NSDate *today = [NSDate date];
 NSTimeInterval interval = [today timeIntervalSinceDate:quakeTime] -  
offset;

 if (interval  3600)  //within the hour


That should be valid everywhere and at any time.

I think it's an error that the parser does not pick up the indicated  
time zone 'Z'. Perhaps there is a way, but I tried a number of  
formatting strings and none worked.


2009-10-30T18:37:14Z
is a very definite point in time. If the parser picks up  
2009-10-30T18:37:14 and interprets it as in the local time zone,  
that is not definite. It varies according to where you stand, and  
that is strange for a parser, no?


David

___

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/in.cocoadev 
%40iriz.net


This email sent to in.cocoa...@iriz.net




___

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: Should I learn CoreData for this project?

2009-11-04 Thread Ruotger Skupin

more disadvantages to mention:

1. schema updates with every model change if you use an sql store (you  
have to make a mapping for every single from version/ to version  
combination you need to support)
2. multithreaded core data is very hard to get right (multiple  
contexts, data merges)
3. performance tuning of core data often means making your schema more  
complex (see also point 1)
4. debugging core data can be hard (most bugs only get to the surface  
when you try to save your data).
5. core data throws exceptions all over the place so you may end up  
with a try-catch block with every data access in your code


If your data set fits in memory and you don't mind loading it all at  
once, stay away from core data.


my two cents
Ruotger

On 04.11.2009, at 08:54, Kai Brüning wrote:


Hi David,

this question is most definitely on topic :-)

So, lets see, what would Core Data give you:

- Scalability, fast incremental loads and saves for big data sets.
I don’t think you’ll need this. Loading and saving 500 items each  
time will be fast enough.


- A data model modeler.
That’s actually more valuable then it may seem on first glance. I  
often look at my Core Data models when thinking about algorithms and  
want to recap how the object graph looks.


- Automatic and semi-automatic version migration.
Depends on the lifecycle of your application. When needed, it’ll  
save you tons of time.


- Object graph consistency management.
A big one. Core Data automatically updates inverse relationships as  
needed. A lot of work to do manually, and always a source of subtle  
bugs.


- Automatic undo support.
Big

- Disadvantage: Core Data does not support ordered relationships.  
That is, it uses sets instead of arrays. If you need an order, you  
have to manage this yourself. Not hard, but sometimes an annoyance  
(the reason for this shortcoming are hard technical problems).


That’s it out of my head. I’m sure I forgot something.

The learning effort? Hard to say. Core Data is well documented and  
works (almost always) as advertised. So it depends on how well you  
learn new abstractions.


One unrelated advice: by all means use garbage collection. It makes  
object graph management (and a lot of other things) so much easier,  
no matter whether you use Core Data or not.


Good luck!
Kai

On 4.11.2009, at 05:22, David Hirsch wrote:

So, I'm hearing folks sing the praises of CoreData, which I have  
not yet learned.  It seems like a long uphill climb, but if life  
will be spectacular afterwards, I'll do it.  I am a semi-casual  
programmer; I've just finished a couple of small programs that do  
not use CoreData, and I can see the advantage in gaining open/save  
and undo/redo for free, but I'm concerned about the work I'll have  
to put in to learn it.  I've read a bunch of the CoreData intro  
documentation, but it doesn't give a feel for how difficult it will  
be to learn, nor how big the advantages are if I do.


Here's the next project I'm going to work on, for which I'm  
considering CoreData:


A simulated annealing code for class scheduling.  The CoreData part  
would lie in managing all the lists involved: classes, rooms,  
instructors, preferences, conflict cost weights, etc.  I estimate  
that I will have about 500 items spread over about 10 arrays.  I  
would not expect to have a complex object graph (if that's the  
right term) - just a lot of items in lists, items that need to be  
managed, displayed, saved, loaded, etc.  I could use NSArrays for  
all these, which I currently understand.


Does this sound like it's worth learning CoreData for?

Thanks,
Dave

S.A.: I hope this is on topic; I think it is.

Those recent projects I mentioned:
http://almandine.geol.wwu.edu/~dave/research/code/ModeMaker/
http://almandine.geol.wwu.edu/~dave/research/code/ModeQuiz/



Dave Hirsch
Associate Professor
Department of Geology
Western Washington University
persistent email: dhir...@mac.com
http://www.davehirsch.com
voice: (360) 389-3583
aim: dhir...@mac.com
vCard: http://almandine.geol.wwu.edu/~dave/personal/DaveHirsch.vcf




___

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/lists%40kai-bruening.de

This email sent to li...@kai-bruening.de


___

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/lists%40chipmunk-app.com

This email sent to li...@chipmunk-app.com



Re: NSDate / NSXMLParser

2009-11-04 Thread Alexander Spohr

The parser CAN parse the timezone and adjust the date accordingly.

To parse this date:
20091021T121942+0200
I use this format:
MMdd'T'HHmmssZZZ
and it works fine.

The only thing you need is to find the right timezone format string.
Yours might be
'-'MM'-'dd'T'HH':'mm':'ssZ
Not sure if you need to '' the : and -
And I really don’t know if the Z at the end of your date is tr35-6  
compatible.


Have a look at
http://unicode.org/reports/tr35/tr35-6.html#Date_Format_Patterns
for your format.


atze

___

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: Should I learn CoreData for this project?

2009-11-04 Thread Kai Brüning


On 4.11.2009, at 11:33, Ruotger Skupin wrote:


more disadvantages to mention:

1. schema updates with every model change if you use an sql store  
(you have to make a mapping for every single from version/ to  
version combination you need to support)


In Snow Leopard Core Data does this automatically for simple cases.  
For non-simple cases you would have to write code for migration of non- 
Core Data documents, too.


2. multithreaded core data is very hard to get right (multiple  
contexts, data merges)


Isn’t this true for multi threaded code in general?
Seriously, the documentation explains how to structure multi threaded  
use of Core Data. This might even save you some pitfalls compared with  
a naive approach to multi-threading a model.


3. performance tuning of core data often means making your schema  
more complex (see also point 1)


Probably irrelevant for the task at hand.

4. debugging core data can be hard (most bugs only get to the  
surface when you try to save your data).


Sure, you have more black box behavior compared to a hand crafted  
model. Helps to go by the recommendations in the documentation and  
avoid anything which smells like a hack.


5. core data throws exceptions all over the place so you may end up  
with a try-catch block with every data access in your code


Not my experience. As with the whole of Cocoa, exceptions in Core Data  
indicate programmer errors, which should be fixed before releasing.




If your data set fits in memory and you don't mind loading it all at  
once, stay away from core data.


my two cents
Ruotger

On 04.11.2009, at 08:54, Kai Brüning wrote:


Hi David,

this question is most definitely on topic :-)

So, lets see, what would Core Data give you:

- Scalability, fast incremental loads and saves for big data sets.
I don’t think you’ll need this. Loading and saving 500 items each  
time will be fast enough.


- A data model modeler.
That’s actually more valuable then it may seem on first glance. I  
often look at my Core Data models when thinking about algorithms  
and want to recap how the object graph looks.


- Automatic and semi-automatic version migration.
Depends on the lifecycle of your application. When needed, it’ll  
save you tons of time.


- Object graph consistency management.
A big one. Core Data automatically updates inverse relationships as  
needed. A lot of work to do manually, and always a source of subtle  
bugs.


- Automatic undo support.
Big

- Disadvantage: Core Data does not support ordered relationships.  
That is, it uses sets instead of arrays. If you need an order, you  
have to manage this yourself. Not hard, but sometimes an annoyance  
(the reason for this shortcoming are hard technical problems).


That’s it out of my head. I’m sure I forgot something.

The learning effort? Hard to say. Core Data is well documented and  
works (almost always) as advertised. So it depends on how well you  
learn new abstractions.


One unrelated advice: by all means use garbage collection. It makes  
object graph management (and a lot of other things) so much easier,  
no matter whether you use Core Data or not.


Good luck!
Kai

On 4.11.2009, at 05:22, David Hirsch wrote:

So, I'm hearing folks sing the praises of CoreData, which I have  
not yet learned.  It seems like a long uphill climb, but if life  
will be spectacular afterwards, I'll do it.  I am a semi-casual  
programmer; I've just finished a couple of small programs that do  
not use CoreData, and I can see the advantage in gaining open/save  
and undo/redo for free, but I'm concerned about the work I'll have  
to put in to learn it.  I've read a bunch of the CoreData intro  
documentation, but it doesn't give a feel for how difficult it  
will be to learn, nor how big the advantages are if I do.


Here's the next project I'm going to work on, for which I'm  
considering CoreData:


A simulated annealing code for class scheduling.  The CoreData  
part would lie in managing all the lists involved: classes, rooms,  
instructors, preferences, conflict cost weights, etc.  I estimate  
that I will have about 500 items spread over about 10 arrays.  I  
would not expect to have a complex object graph (if that's the  
right term) - just a lot of items in lists, items that need to be  
managed, displayed, saved, loaded, etc.  I could use NSArrays for  
all these, which I currently understand.


Does this sound like it's worth learning CoreData for?

Thanks,
Dave

S.A.: I hope this is on topic; I think it is.

Those recent projects I mentioned:
http://almandine.geol.wwu.edu/~dave/research/code/ModeMaker/
http://almandine.geol.wwu.edu/~dave/research/code/ModeQuiz/



Dave Hirsch
Associate Professor
Department of Geology
Western Washington University
persistent email: dhir...@mac.com
http://www.davehirsch.com
voice: (360) 389-3583
aim: dhir...@mac.com
vCard: http://almandine.geol.wwu.edu/~dave/personal/DaveHirsch.vcf

Re: Should I learn CoreData for this project?

2009-11-04 Thread jonat...@mugginsoft.com
Core Data is powerful stuff but it can be tough going - very tough  
going.
If you are determined to make your code work you will get through it.  
If not, it might get the better of you.


The fact is that CoreData offers a great deal of functionality. If you  
want that functionality you either code it yourself or use CoreData.


My four main points would be:

1. Keep going back to the documentation. It takes time to grasp all  
the concepts. And as with most things Cocoa you need to go with the  
flow. But if you don't keep querying and checking your own  
comprehension of what's going on it's hard not to end up on the rocks.


2. Keep everything in the model if humanly possibly and use transient  
properties for stuff you don't model directly. Mucking around with  
ivar backed NSManagedObject subclass properties and references to  
external files etc will drive you crazy when it comes to figuring out  
why your undo support is scrambled.


3. Performance should be very good. If it's hopeless then you are  
doing it wrong. It's easy to fire up IB, set up some bindings, bash in  
some data and have the whole thing turn to treacle in a storm of  
faults and KVO notifications. You need to think carefully about how  
you retrieve data from the store (as objects or faults). You really  
need to get your head around the concept of faulting and your data  
access methodology.


4. It isn't really anything like using a conventional SQL driven  
database. So don't even bother trying to wing it on that score.


The big plus for CoreData is that you can implement a simple app that  
simply grabs all your data in one chunk, loads up some arrays and you  
are away.
If later on your app develops and you need a much more sophisticated  
approach then CoreData can deliver.


Ordered relationships are not that big a problem. The order is just a  
property of the model.


Of course there is the whole business of having to deal with schema  
updates.

But this is an issue for whatever persistence method you choose.

Regards

Jonathan Mitchell

Developer
http://www.mugginsoft.com






On 4 Nov 2009, at 04:22, David Hirsch wrote:

So, I'm hearing folks sing the praises of CoreData, which I have not  
yet learned.  It seems like a long uphill climb, but if life will be  
spectacular afterwards, I'll do it.  I am a semi-casual programmer;  
I've just finished a couple of small programs that do not use  
CoreData, and I can see the advantage in gaining open/save and undo/ 
redo for free, but I'm concerned about the work I'll have to put in  
to learn it.  I've read a bunch of the CoreData intro documentation,  
but it doesn't give a feel for how difficult it will be to learn,  
nor how big the advantages are if I do.


Here's the next project I'm going to work on, for which I'm  
considering CoreData:


A simulated annealing code for class scheduling.  The CoreData part  
would lie in managing all the lists involved: classes, rooms,  
instructors, preferences, conflict cost weights, etc.  I estimate  
that I will have about 500 items spread over about 10 arrays.  I  
would not expect to have a complex object graph (if that's the right  
term) - just a lot of items in lists, items that need to be managed,  
displayed, saved, loaded, etc.  I could use NSArrays for all these,  
which I currently understand.


Does this sound like it's worth learning CoreData for?

Thanks,
Dave

S.A.: I hope this is on topic; I think it is.

Those recent projects I mentioned:
http://almandine.geol.wwu.edu/~dave/research/code/ModeMaker/
http://almandine.geol.wwu.edu/~dave/research/code/ModeQuiz/



Dave Hirsch
Associate Professor
Department of Geology
Western Washington University
persistent email: dhir...@mac.com
http://www.davehirsch.com
voice: (360) 389-3583
aim: dhir...@mac.com
vCard: http://almandine.geol.wwu.edu/~dave/personal/DaveHirsch.vcf




___

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/jonathan%40mugginsoft.com

This email sent to jonat...@mugginsoft.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


Re: Should I learn CoreData for this project?

2009-11-04 Thread Roland King
I have not used core data myself, my only comment is that the best  
time to learn a technology is when you have a real project which could  
use it, I find that's a lot better way to get beyond the 10 line  
examples or whatever simple examples you think up as a 'good way to  
learn this' and really gets you to understand the depths of it. It  
makes the project you're writing slow but you learn.


So I'd say if you think this is a technology you're likely to use in  
the future and you have a project now you really want to write and can  
use core data, dive in, but take a deep breath first.


On 04-Nov-2009, at 8:11 PM, jonat...@mugginsoft.com wrote:

Core Data is powerful stuff but it can be tough going - very tough  
going.
If you are determined to make your code work you will get through  
it. If not, it might get the better of you.


The fact is that CoreData offers a great deal of functionality. If  
you want that functionality you either code it yourself or use  
CoreData.


My four main points would be:

1. Keep going back to the documentation. It takes time to grasp all  
the concepts. And as with most things Cocoa you need to go with the  
flow. But if you don't keep querying and checking your own  
comprehension of what's going on it's hard not to end up on the rocks.


2. Keep everything in the model if humanly possibly and use  
transient properties for stuff you don't model directly. Mucking  
around with ivar backed NSManagedObject subclass properties and  
references to external files etc will drive you crazy when it comes  
to figuring out why your undo support is scrambled.


3. Performance should be very good. If it's hopeless then you are  
doing it wrong. It's easy to fire up IB, set up some bindings, bash  
in some data and have the whole thing turn to treacle in a storm of  
faults and KVO notifications. You need to think carefully about how  
you retrieve data from the store (as objects or faults). You really  
need to get your head around the concept of faulting and your data  
access methodology.


4. It isn't really anything like using a conventional SQL driven  
database. So don't even bother trying to wing it on that score.


The big plus for CoreData is that you can implement a simple app  
that simply grabs all your data in one chunk, loads up some arrays  
and you are away.
If later on your app develops and you need a much more sophisticated  
approach then CoreData can deliver.


Ordered relationships are not that big a problem. The order is just  
a property of the model.


Of course there is the whole business of having to deal with schema  
updates.

But this is an issue for whatever persistence method you choose.

Regards

Jonathan Mitchell

Developer
http://www.mugginsoft.com






On 4 Nov 2009, at 04:22, David Hirsch wrote:

So, I'm hearing folks sing the praises of CoreData, which I have  
not yet learned.  It seems like a long uphill climb, but if life  
will be spectacular afterwards, I'll do it.  I am a semi-casual  
programmer; I've just finished a couple of small programs that do  
not use CoreData, and I can see the advantage in gaining open/save  
and undo/redo for free, but I'm concerned about the work I'll have  
to put in to learn it.  I've read a bunch of the CoreData intro  
documentation, but it doesn't give a feel for how difficult it will  
be to learn, nor how big the advantages are if I do.


Here's the next project I'm going to work on, for which I'm  
considering CoreData:


A simulated annealing code for class scheduling.  The CoreData part  
would lie in managing all the lists involved: classes, rooms,  
instructors, preferences, conflict cost weights, etc.  I estimate  
that I will have about 500 items spread over about 10 arrays.  I  
would not expect to have a complex object graph (if that's the  
right term) - just a lot of items in lists, items that need to be  
managed, displayed, saved, loaded, etc.  I could use NSArrays for  
all these, which I currently understand.


Does this sound like it's worth learning CoreData for?

Thanks,
Dave

S.A.: I hope this is on topic; I think it is.

Those recent projects I mentioned:
http://almandine.geol.wwu.edu/~dave/research/code/ModeMaker/
http://almandine.geol.wwu.edu/~dave/research/code/ModeQuiz/



Dave Hirsch
Associate Professor
Department of Geology
Western Washington University
persistent email: dhir...@mac.com
http://www.davehirsch.com
voice: (360) 389-3583
aim: dhir...@mac.com
vCard: http://almandine.geol.wwu.edu/~dave/personal/DaveHirsch.vcf




___

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/jonathan%40mugginsoft.com

This email sent to jonat...@mugginsoft.com


Programmatic Binding KVC KVO

2009-11-04 Thread Richard Somers
I have a managed object context with two attached NSObjectControllers  
in entity mode. Both controllers control the same entity.


 managed object model

 nib 1
 controller
 user interface
 bind in interface builder

 nib 2
 controller
 user interface (custom view)
 bind in code programmatically

Nib 1 works. Entity changes produce by the user interface show up in  
the managed object model and in the custom view found in nib 2.


Nib 2 only partly works. Changes made in the custom view do not show  
up in the managed object model or in the user interface found in nib 1.


When establishing a binding programmatically do you also need to setup  
key value observing? I thought a binding was bi-directional and  
included both key value coding and observing.


Richard

___

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: Should I learn CoreData for this project?

2009-11-04 Thread Sean McBride
On 11/3/09 8:22 PM, David Hirsch said:

So, I'm hearing folks sing the praises of CoreData, which I have not
yet learned.  It seems like a long uphill climb, but if life will be
spectacular afterwards, I'll do it.  I am a semi-casual programmer;
I've just finished a couple of small programs that do not use
CoreData, and I can see the advantage in gaining open/save and undo/
redo for free, but I'm concerned about the work I'll have to put in to
learn it.  I've read a bunch of the CoreData intro documentation, but
it doesn't give a feel for how difficult it will be to learn, nor how
big the advantages are if I do.

Here's the next project I'm going to work on, for which I'm
considering CoreData:

A simulated annealing code for class scheduling.  The CoreData part
would lie in managing all the lists involved: classes, rooms,
instructors, preferences, conflict cost weights, etc.  I estimate that
I will have about 500 items spread over about 10 arrays.  I would not
expect to have a complex object graph (if that's the right term) -
just a lot of items in lists, items that need to be managed,
displayed, saved, loaded, etc.  I could use NSArrays for all these,
which I currently understand.

I have found learning and using Core Data worthwhile.  It is quite big
and you will want/need to read the docs over and over.

In addition to what others have already said.  I'll just add that undo
support is not really 'free'.  Core Data does do a lot of the undo work
for you, but it's only 'free' in simple cases.  10.6 has improvements
here (which I have yet to try).

I'll also agree with others that scheme migration is a pain.  One small
model change and your file format is different and unreadable by older
versions of your software.  10.6 also has improvements here (supposedly).

Good luck!

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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: UIView animation docs question

2009-11-04 Thread Fritz Anderson


On 3 Nov 2009, at 4:23 PM, lorenzo7...@gmail.com wrote:

[UIView setAnimationDidStopSelector:@selector 
(animationDidStop:finshed:context:)];



-(void)animationDidStop:(NSString *)animationID finished:(NSNumber *) 
finished context:(void *)context{...}


May I point out the spelling of the second part of the selector? In  
the method, it's fin_i_shed; in the argument, it's fin__shed.


— F

___

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: Programming hot key

2009-11-04 Thread Matt Neuburg
On Tue, 03 Nov 2009 20:06:50 -0800, Eric Schlegel eri...@apple.com said:

On Nov 3, 2009, at 6:10 PM, Symadept wrote:

 Hi,
 
 Anybody tell me can I program a hot key which shall not block the other apps
 responding to it.
 
 Lets say I have registered hot key Command+P for some operation for my app,
 it shall not block the other apps responding to it.

You should probably use the CGEventTap API to implement this. In SnowLeopard,
you could also use +[NSEvent addGlobalMonitorForEventsMatchingMask]. In either
case, however, I believe you'll need the user to enable access for assistive
devices in the Universal Access preference pane.

But isn't the real problem that there is no API for discovering what global
hot keys are registered with the system? I've been asking for this since Mac
OS X 10.0; not only do apps need it, users need it. The system must *know*
this, since it responds to the global hot keys; so why won't it reveal this
info? m.

-- 
matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



___

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


NSArrayController inside NSTreeController?

2009-11-04 Thread David Catmull
How would I use an NSArrayController to provide the content of one of  
the child items in an NSTreeController?


This is for a NSOutlineView source view, and each group in the source  
view contains different kinds of items. In some cases, I want them to  
be Core Data items, so the easiest way to manage that is to use an  
array controller.


I tried returning the array controller's arrangedObjects as the  
children of a group object, but when items are added they don't appear  
in the source view. I'm not sure where to go from there.


--
David Catmull
uncom...@uncommonplace.com
http://www.uncommonplace.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


NSPopUpButton, Bindings separator items

2009-11-04 Thread Eric Gorr
I found this old message, but there was no answer posted and have the  
same question...


http://lists.apple.com/archives/cocoa-dev/2005/Jan/msg00886.html

Is there a way to add separator Items to an NSPopUpButton using  
bindings?


___

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: Programmatic Binding KVC KVO

2009-11-04 Thread Kyle Sluder
On Nov 4, 2009, at 6:04 AM, Richard Somers  
rsomers.li...@infowest.com wrote:


I have a managed object context with two attached  
NSObjectControllers in entity mode. Both controllers control the  
same entity.


Important: do you really mean entity, or do you mean managed object?


managed object model

nib 1
controller
user interface
bind in interface builder

nib 2
controller
user interface (custom view)
bind in code programmatically


You need to describe precisely what you've done in both cases, which  
includes posting your code. You also make no mention of what managed  
object context your controllers are hooked up to.


Nib 1 works. Entity changes produce by the user interface show up in  
the managed object model and in the custom view found in nib 2.


Here, you mean to say that managed object property changes show up in  
your managed object context.


Nib 2 only partly works. Changes made in the custom view do not show  
up in the managed object model or in the user interface found in nib  
1.


So now we also need to see your custom view code.

When establishing a binding programmatically do you also need to  
setup key value observing? I thought a binding was bi-directional  
and included both key value coding and observing.


No, bindings are not directional, and only do whatever you tell them  
to. NSObject's implementation of -bind:toObject:… starts observing  
the specified keypath, and its implementation of - 
observeValueForKeyPath:… attempts to use KVC to set a property with  
the same name as the binding. 99% of the time you're going to provide  
a custom implementation of both of these methods, and not calling  
super's implementation.


Neither of these scenarios handles the reverse case.

--Kyle Sluder___

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: NSPopUpButton, Bindings separator items

2009-11-04 Thread Mike Abdullah
No there is not. You can perhaps hack it to work by subclassing, but  
isn't really worth it.


On 4 Nov 2009, at 16:26, Eric Gorr wrote:

I found this old message, but there was no answer posted and have  
the same question...


http://lists.apple.com/archives/cocoa-dev/2005/Jan/msg00886.html

Is there a way to add separator Items to an NSPopUpButton using  
bindings?


___

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/cocoadev%40mikeabdullah.net

This email sent to cocoa...@mikeabdullah.net


___

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: NSPopUpButton, Bindings separator items

2009-11-04 Thread Eric Gorr

Dang. Thank you.

Almost certainly going to be marked as a duplicate, but I have filed a  
bug report - rdar://7364344



On Nov 4, 2009, at 11:41 AM, Mike Abdullah wrote:

I found this old message, but there was no answer posted and have  
the same question...


http://lists.apple.com/archives/cocoa-dev/2005/Jan/msg00886.html

Is there a way to add separator Items to an NSPopUpButton using  
bindings?


___

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


Cocoa HTML template engine?

2009-11-04 Thread Jens Alfke
I want to populate a WebView with some nicely-styled HTML depicting an  
Objective-C data model. The nicest way to do this is with some sort of  
template engine, so I can tweak the output by editing HTML-like  
templates rather than messing with code. I've already written this  
twice before, but it's nontrivial and I don't have access to any of  
that source code anymore...


So, does anyone know of an open-source Cocoa library for HTML  
templates, or at least general macro substitution?


—Jens___

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: NSDate / NSXMLParser

2009-11-04 Thread David Rowland


On Nov 4, 2009, at 1:49 AM, Ingvar Nedrebo wrote:


The easiest way is to set the timezone on the formatter:

[dateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];

Yes! That works. I'm sure I tried it, but I must have misinterpreted  
the results.



___

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: Programming hot key

2009-11-04 Thread Eric Schlegel

On Nov 4, 2009, at 8:05 AM, Matt Neuburg wrote:

 But isn't the real problem that there is no API for discovering what global
 hot keys are registered with the system? I've been asking for this since Mac
 OS X 10.0; not only do apps need it, users need it. The system must *know*
 this, since it responds to the global hot keys; so why won't it reveal this
 info? m.

Well, there's CopySymbolicHotKeys in HIToolbox. Is that good enough? Do you 
have Radar numbers for the bugs you've filed requesting this?

-eric___

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: NSDate / NSXMLParser

2009-11-04 Thread David Rowland


On Nov 4, 2009, at 2:48 AM, Alexander Spohr wrote:


The parser CAN parse the timezone and adjust the date accordingly.

To parse this date:
20091021T121942+0200
I use this format:
MMdd'T'HHmmssZZZ
and it works fine.

The only thing you need is to find the right timezone format string.
Yours might be
'-'MM'-'dd'T'HH':'mm':'ssZ
Not sure if you need to '' the : and -
And I really don’t know if the Z at the end of your date is tr35-6  
compatible.


Have a look at
http://unicode.org/reports/tr35/tr35-6.html#Date_Format_Patterns
for your format.


 I have looked at that unicode doc. I tried many strings that seemed  
to conform to it, but nothing worked. Ingvar Nedrebo's suggestion did  
work, so that's that for the present. Off to other problems. ___


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


NSNumberFormatter for K, M, G, etc.

2009-11-04 Thread Fritz Anderson
The UTS #35 reference doesn't seem to include it, but I'm interested  
in an NSNumberFormatter that will convert 1024 to 1 K, 3,145,728 to  
3 M, and so on. Bonus for rounding and precision specifiers. Does  
anyone know of existing art, or must I make my own?


— F

___

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: NSArrayController inside NSTreeController?

2009-11-04 Thread Matthew Lindfield Seager
On Thursday, November 5, 2009, David Catmull uncom...@uncommonplace.com wrote:
 This is for a NSOutlineView source view, and each group in the source view 
 contains different kinds of items. In some cases, I want them to be Core Data 
 items, so the easiest way to manage that is to use an array controller.



You may need to implement NSOutlineView's data source methods. There
have been at least two discussions of this on the list in the past
three months so those threads might be helpful to you!

If you come up with a better solution please post your approach though!

Matt
___

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: NSArrayController inside NSTreeController?

2009-11-04 Thread David Catmull
On Nov 4, 2009, at 10:21 AM, Matthew Lindfield Seager matt...@sagacity.com.au 
 wrote:

You may need to implement NSOutlineView's data source methods.



I considered that, but I'm hoping to avoid having to re-implement all  
the stuff that already works in the normal table view/array controller  
case.


--
David Catmull
uncom...@uncommonplace.com
http://uncommonplace.com

. There
have been at least two discussions of this on the list in the past
three months so those threads might be helpful to you!

If you come up with a better solution please post your approach  
though!


Matt

___

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


Best pattern for similar objects with differences

2009-11-04 Thread Paul Bruneau

Hi-

I'm in early development of an app (non-core data, NSDocument app)  
that will deal with a lot of doors. I have created a door object,  
SLDoor, which currently contains all of the properties that might be  
used by any of the several types of doors.


There is a doorType property which is what determines which of the  
types of doors a particular instance is.


This means that if you choose a door type, many properties that are  
only used by any of the other types will go unused. On the other hand,  
it's very good for if the user wants to change the door type--the  
properties are all there ready and waiting.


But I did have the idea that I should make SLDoor a superclass of new  
classes, one for each type of door. So I would have  an SLFlushDoor,  
an SLMonumentalDoor, and an SLPlankDoor for example, all subclasses of  
SLDoor.


In this way, I can really separate out all kinds of code and  
properties that are specific to a certain type of door, while keeping  
in the superclass all the properties that are shared among several or  
all of the types of door (I'm going to have categories to handle  
drawing, material takeoff, pricing, etc for each door type).


So this is very attractive, but I keep worrying about how I would  
change a door from one type to another if I utilize these subclasses.  
Any ideas the best pattern to use? I can't figure out how I would take  
an existing object of say SLFlushDoor and convert it to an  
SLMonumentalDoor (and possibly back again) with anything close to the  
ease that I currently do it with the doorType property (but I shudder  
to think of all the if() statements I would have strewn through all my  
code if I stick with this pattern.)


Thank you

___

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: Cocoa HTML template engine?

2009-11-04 Thread jonat...@mugginsoft.com

I haven't used it but I recall that MGTemplateEngine can generate html.
Might be worth a look.

http://mattgemmell.com/2008/05/20/mgtemplateengine-templates-with-cocoa

Regards

Jonathan Mitchell

Developer
http://www.mugginsoft.com






On 4 Nov 2009, at 17:15, Jens Alfke wrote:

I want to populate a WebView with some nicely-styled HTML depicting  
an Objective-C data model. The nicest way to do this is with some  
sort of template engine, so I can tweak the output by editing HTML- 
like templates rather than messing with code. I've already written  
this twice before, but it's nontrivial and I don't have access to  
any of that source code anymore...


So, does anyone know of an open-source Cocoa library for HTML  
templates, or at least general macro substitution?


—Jens___

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/jonathan%40mugginsoft.com

This email sent to jonat...@mugginsoft.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


Re: Best pattern for similar objects with differences

2009-11-04 Thread Kyle Sluder
It kind of depends on what your app is doing with the doors.  For
example, you might get away with having a single SLDoor class with a
dictionary of attributes, much like one might order a car based on
option codes.  This makes your app highly flexible in the
configurations of data it can deal with, which is what you typically
want from an ordering app.  Or you could make your app more
domain-specific, which might be useful if you were making a
computer-aided door design app.

All of these things are, strictly speaking, general software
engineering questions that fall outside the realm of Cocoa.  There
are, however, certain Cocoa-related implications: for example, a dumb
container for dumb objects is very hard to make a custom interface
for.  This bit me on a radio automation system project a while back.
I started out with an app that could hold music tracks with any
arbitrary tags, under the assumption that the user would create tags
to organize the library as they see fit .  A song might wind up tagged
Mellow, Country/Western, and Male/Female Duet.  All these tags
lived in the same namespace, and I couldn't offer an interface to
control that, much less do all the KVO niceties I wanted to do to get
smart groups, filtering, and other features.  So I decided to push
more domain knowledge into my app, making it aware that songs could
have mood, genre, tempo, vocalists, etc.  This made the developer
*and* user experience much better at the expense of some flexibility.

If you look hard enough you see this tradeoff appear time and time
again, often resulting in differentiation among competitors.  It all
depends on your use cases.

--Kyle Sluder
___

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


Working around SBObject limitations

2009-11-04 Thread Fritz Anderson
I've deduced that the SBObject subclasses derived from an  
application's sdef are completely dynamic, and you can't implement  
categories on them, and you can't send +class to them. Am I right?


Is there a way to work around these limitations? The application I'm  
targeting implements -parent in several classes, and the return value  
is polymorphic. For instance an AppFolder's parent can be another  
AppFolder, but at the top of the chain, it's the AppApplication. I  
want to exclude the AppApplication from my traversal of the chain.


for (id curr = [self parent]; [curr isKindOfClass: [AppFolder class]];  
curr = [curr parent]) {

[returnedMutableArray insertObject: curr atIndex: 0];
}

1. The test in this for statement doesn't link, because the  
AppFolder's class doesn't appear in my object code. Is there a  
workaround for this?


2. It would be nice to put the above code into a -folderPath method in  
my own category of the SBObject subclass AppFolder. Again, the absence  
of the dynamic class from my object code prevents my implementing a  
category (am I right?). Is there a workaround for this? (I imagine it  
could be done by monkeying with the runtime, but I'd rather not if  
there's an easier way.)


— F

___

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: Should I learn CoreData for this project?

2009-11-04 Thread Jeffrey Oleander
 1. Keep going back to the documentation.
 It takes time to grasp all the concepts.

If something is not clear and complete,
 submit a comment on the documentation.
 Every documentation web page has a link
 to a comment form.


  
___

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: Working around SBObject limitations

2009-11-04 Thread Kyle Sluder
On Wed, Nov 4, 2009 at 11:11 AM, Fritz Anderson fri...@manoverboard.org wrote:
 1. The test in this for statement doesn't link, because the AppFolder's
 class doesn't appear in my object code. Is there a workaround for this?

Use +[SBApplication classForScriptingClass:].  So something like:

for (id curr = [self parent]; [curr isKindOfClass: [AppApplication
classForScriptingClass:@folder]]; curr = [curr parent]) {
   [returnedMutableArray insertObject: curr atIndex: 0];
}

 2. It would be nice to put the above code into a -folderPath method in my
 own category of the SBObject subclass AppFolder. Again, the absence of the
 dynamic class from my object code prevents my implementing a category (am I
 right?). Is there a workaround for this? (I imagine it could be done by
 monkeying with the runtime, but I'd rather not if there's an easier way.)

You could use the runtime methods, or you could add a category to SBObject.

--Kyle Sluder
___

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: Best pattern for similar objects with differences

2009-11-04 Thread Ken Thomases

On Nov 4, 2009, at 12:47 PM, Paul Bruneau wrote:

I'm in early development of an app (non-core data, NSDocument app)  
that will deal with a lot of doors. I have created a door object,  
SLDoor, which currently contains all of the properties that might be  
used by any of the several types of doors.


To be clear, you have created a door _class_ called SLDoor (or so I  
assume).


There is a doorType property which is what determines which of the  
types of doors a particular instance is.


This means that if you choose a door type, many properties that are  
only used by any of the other types will go unused. On the other  
hand, it's very good for if the user wants to change the door type-- 
the properties are all there ready and waiting.


But I did have the idea that I should make SLDoor a superclass of  
new classes, one for each type of door. So I would have  an  
SLFlushDoor, an SLMonumentalDoor, and an SLPlankDoor for example,  
all subclasses of SLDoor.


In this way, I can really separate out all kinds of code and  
properties that are specific to a certain type of door, while  
keeping in the superclass all the properties that are shared among  
several or all of the types of door (I'm going to have categories to  
handle drawing, material takeoff, pricing, etc for each door type).


So this is very attractive, but I keep worrying about how I would  
change a door from one type to another if I utilize these  
subclasses. Any ideas the best pattern to use? I can't figure out  
how I would take an existing object of say SLFlushDoor and convert  
it to an SLMonumentalDoor (and possibly back again) with anything  
close to the ease that I currently do it with the doorType property  
(but I shudder to think of all the if() statements I would have  
strewn through all my code if I stick with this pattern.)


Well, the first thing is to be sure that you really want to enable the  
user to change the door type.  Does it make sense?  What does it mean  
to change the door type.  What happens to the properties that were  
appropriate for the old door type but aren't for the new door type?   
What values do you use for the properties of the new door type which  
weren't relevant for the old type?  Etc.


Can this be better modeled by creating a new door object of the new  
type, initializing it with some of the properties of the old door  
object, and then releasing the old door object?  You would also  
replace the old door object with the new one in any collections.


If none of that helps, then you can divide the representation of a  
door into two classes.  Basically, you end up modeling a door type not  
with a name or numeric code value, but with a full-fledged object.   
So, your doorType property becomes a pointer to an instance of some  
SLDoorType class, or rather a type-specific subclass of SLDoorType.   
Any type-specific properties and behaviors would be implemented in  
that class.  Some SLDoor methods might be implemented by invoking  
methods on the doorType object.  In many cases, clients of SLDoor  
would directly reference, for example,  
door.doorType.typeSpecificProperty.


When it comes time to change the type of a door, you replace the  
doorType object with a new object representing the new type.  If  
appropriate, you can initialize the new door-type object with that  
subset of properties which it shares with the old door-type object.


Accessing type-specific properties through the doorType property still  
presents a problem.  Since the doorType property is statically typed  
as SLDoorType, which is a generic abstract base class of a hierarchy  
of door type classes, the compiler will complain if you attempt to  
access type-specific properties using accessors (because the generic  
SLDoorType class doesn't implement the type-specific properties).  The  
Objective-C 2.0 dot syntax is just an alternative way to write  
accessor calls, so that runs into the same problem.  You can solve  
this by accessing type-specific properties using Key-Value Coding.  If  
you're using Bindings, then that already is based on KVC.  Since KVC  
relies on the actual dynamic type of the door-type object, you don't  
have problems with the compiler complaining that the static type of  
doorType doesn't support those properties.


So, assuming that door is an instance of SLDoor, you might have code  
which looks like [door.doorType  
valueForKey:@someTypeSpecificProperty] or [door.doorType  
setValue:someValue forKey:@someTypeSpecificProperty].



Now, what happens if there's an attempt to access a type-specific  
property when the door is not of that type?  Well, ideally, you'd  
avoid that situation.  You should carefully examine cases where you  
think you need to do that to see if they can't be better implemented  
by pushing responsibilities into the type-specific door-type class.   
So, if you have a method on SLDoor to compute the cost of a door, and  
the cost depends on the door type, 

Re: Programmatic Binding KVC KVO

2009-11-04 Thread Richard Somers

On Nov 4, 2009, at 9:40 AM, Kyle Sluder wrote:

Nib 2 only partly works. Changes made in the custom view do not  
show up in the managed object model or in the user interface found  
in nib 1.


So now we also need to see your custom view code.



Here is the code for nib 2 which only partly works. Changes to the  
model property num are reflected in the custom view but changes to the  
num property in the custom view do not show up in the model.


All code in the custom view that touch the num property use the  
accessor methods. The controller in the nib is in entity mode and  
bound to File's Owner (MyDocument) managed object context.


@interface MyView : NSView
{
 double num;
}
@end

@implementation MyView

- (double)num
{
 return num;
}

- (void)setnum:(double)newNum
{
 [self willChangeValueForKey:@num];
 num = newNum;
 [self didChangeValueForKey:@num];
}

@end

@interface MyDocument : NSPersistentDocument
{
 IBOutlet MyView *myView;
 IBOutlet NSObjectController *controller;
}
@end

@implementation MyDocument

- (void)windowControllerDidLoadNib:(NSWindowController  
*)windowController

{
 [super windowControllerDidLoadNib:windowController];

 [myView bind:@num toObject:controller  
withKeyPath:@selection.num options:nil];

}

@end

Thanks for looking at this.

Richard

___

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


Don't highlight button's text when clicked

2009-11-04 Thread Gustavo Pizano

Hello.

I have a custom NSButtonCell, also my CustomButton, I draw a glossy  
BackGround in the ButtonCell, and set the text to white-bold color.

now I overrode the method:

- (void)highlight:(BOOL)flag withFrame:(NSRect)cellFrame inView: 
(NSView *)controlView{
so set but a little darker glossy background color, but then I see  
that the text stays behind the  new color im applying.


I did some research, and found the method setHighlightsBy of  
NSButtonCell, so in the initialization of my custom button cell, I did:


[self setHighlightsBy:NSChangeBackgroundCellMask|NSChangeGrayCellMask];

but nothing happened, still the text its behind the new color.
then I tried applying the text-color with an attributedstring as I did  
in the - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *) 
controlView to change the text color, but then nothing happens, not  
even the new color its applied ...


Any ideas?

Thanks


Gustavo
___

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


sorting xml using tableview datasource method?

2009-11-04 Thread Chunk 1978
i'm failing to sort the xml data on my tableview.  am i suppose to
make a model class for the data and have the table view display/sort
that instead?  i'm quite with this one.  am i suppose to enter values
in Sort Key and Selector IB fields for each column? doing so returns:
-[NSXMLElement compare:]: unrecognized selector sent to instance
0x162b6430.  what am i missing here?


- (IBAction)parseData:(id)sender
{
[progressIndicator setHidden:NO];
[progressIndicator startAnimation:nil];

NSURL *url = [NSURL URLWithString:kXMLWebAddress];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url
cachePolicy:NSURLRequestReloadIgnoringLocalCacheData
timeoutInterval:30];  //cachePolicy: 10.5 or higher
NSData *urlData = [NSURLConnection sendSynchronousRequest:urlRequest
returningResponse:nil error:nil];
NSXMLDocument *doc = [[NSXMLDocument alloc] initWithData:urlData
options:0 error:nil];

[itemNodes release];
itemNodes = [[doc nodesForXPath:@stations/station error:nil] retain];
[tableView reloadData];

[progressIndicator setHidden:YES];
[progressIndicator stopAnimation:nil];
}

- (void)dealloc
{
[itemNodes release];
[super dealloc];
}

- (NSString *)stringForPath:(NSString *)xPath ofNode:(NSXMLNode *)node
{
NSError *error;
NSArray *nodes = [node nodesForXPath:xPath error:error];

if ([nodes count] == 0)
return nil;
else
return [[nodes objectAtIndex:0] stringValue];
}


#pragma mark -
#pragma mark Table View Datasourse Methods

- (int)numberOfRowsInTableView:(NSTableView *)theTableView
{
return [itemNodes count];
}

- (id)tableView:(NSTableView *)theTableView
objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
{
NSXMLNode *node = [itemNodes objectAtIndex:row];
NSString *xPath = [tableColumn identifier];
return [self stringForPath:xPath ofNode:node];
}

- (void)tableView:(NSTableView *)aTableView
sortDescriptorsDidChange:(NSArray *)oldDescriptors
{
[itemNodes sortUsingDescriptors:[aTableView sortDescriptors]];
[aTableView reloadData];
}
___

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: UIView animation docs question

2009-11-04 Thread Matt Neuburg
On Wed, 4 Nov 2009 09:17:30 -0600, Fritz Anderson fri...@manoverboard.org
said:

On 3 Nov 2009, at 4:23 PM, lorenzo7...@gmail.com wrote:

 [UIView setAnimationDidStopSelector:@selector
 (animationDidStop:finshed:context:)];


 -(void)animationDidStop:(NSString *)animationID finished:(NSNumber *)
 finished context:(void *)context{...}

May I point out the spelling of the second part of the selector? In
the method, it's fin_i_shed; in the argument, it's fin__shed.

Yeah, he knows.

This is the whole problem with passing things around as strings (selector
names, key-value coding, etc.); there are so many places to go wrong, and
when you do, it can be hard to debug. m.

-- 
matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



___

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: NSPopUpButton, Bindings separator items

2009-11-04 Thread Matt Neuburg
On Wed, 4 Nov 2009 11:26:16 -0500, Eric Gorr mail...@ericgorr.net said:
I found this old message, but there was no answer posted and have the
same question...

http://lists.apple.com/archives/cocoa-dev/2005/Jan/msg00886.html

Is there a way to add separator Items to an NSPopUpButton using
bindings?

Here's an easy way; this is how I do it in my NotLight app.

First, #define MYMENUSEPARATORSTRING somewhere where everyone who needs to
can see it.

Now, subclass NSMenu and override as follows:

- (id NSMenuItem)addItemWithTitle:(NSString *)aString
 action:(SEL)aSelector
  keyEquivalent:(NSString *)keyEquiv {
if ([aString isEqual: MYMENUSEPARATORSTRING]) {
id NSMenuItem sep = [NSMenuItem separatorItem];
[self addItem:sep];
return sep;
}
return [super addItemWithTitle:aString action:aSelector
keyEquivalent:keyEquiv];
}

Now use that NSMenu subclass where needed. The bound object uses
addItemWithTitle to construct the menu, so our overridden method will be
called and a separator item will appear wherever MYMENUSEPARATORSTRING
occurs as the title in the bound content. m.


-- 
matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



___

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: Working around SBObject limitations

2009-11-04 Thread Fritz Anderson


On 4 Nov 2009, at 1:15 PM, Kyle Sluder wrote:

On Wed, Nov 4, 2009 at 11:11 AM, Fritz Anderson fri...@manoverboard.org 
 wrote:
1. The test in this for statement doesn't link, because the  
AppFolder's
class doesn't appear in my object code. Is there a workaround for  
this?


Use +[SBApplication classForScriptingClass:].  So something like:

for (id curr = [self parent]; [curr isKindOfClass: [AppApplication
classForScriptingClass:@folder]]; curr = [curr parent]) {
  [returnedMutableArray insertObject: curr atIndex: 0];
}

2. It would be nice to put the above code into a -folderPath method  
in my
own category of the SBObject subclass AppFolder. Again, the absence  
of the
dynamic class from my object code prevents my implementing a  
category (am I
right?). Is there a workaround for this? (I imagine it could be  
done by
monkeying with the runtime, but I'd rather not if there's an easier  
way.)


You could use the runtime methods, or you could add a category to  
SBObject.


All very useful, and very straightforward. Thank you very much.

— F

___

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: NSPopUpButton, Bindings separator items

2009-11-04 Thread Eric Gorr


On Nov 4, 2009, at 3:38 PM, Matt Neuburg wrote:

On Wed, 4 Nov 2009 11:26:16 -0500, Eric Gorr mail...@ericgorr.net  
said:

I found this old message, but there was no answer posted and have the
same question...

http://lists.apple.com/archives/cocoa-dev/2005/Jan/msg00886.html

Is there a way to add separator Items to an NSPopUpButton using
bindings?


Here's an easy way; this is how I do it in my NotLight app.

First, #define MYMENUSEPARATORSTRING somewhere where everyone who  
needs to

can see it.

Now, subclass NSMenu and override as follows:

- (id NSMenuItem)addItemWithTitle:(NSString *)aString
action:(SEL)aSelector
 keyEquivalent:(NSString *)keyEquiv {
   if ([aString isEqual: MYMENUSEPARATORSTRING]) {
   id NSMenuItem sep = [NSMenuItem separatorItem];
   [self addItem:sep];
   return sep;
   }
   return [super addItemWithTitle:aString action:aSelector
keyEquivalent:keyEquiv];
}

Now use that NSMenu subclass where needed. The bound object uses
addItemWithTitle to construct the menu, so our overridden method  
will be

called and a separator item will appear wherever MYMENUSEPARATORSTRING
occurs as the title in the bound content. m.


Cool. That looks like a good solution.
___

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: Best pattern for similar objects with differences

2009-11-04 Thread Jens Alfke


On Nov 4, 2009, at 10:47 AM, Paul Bruneau wrote:

So this is very attractive, but I keep worrying about how I would  
change a door from one type to another if I utilize these  
subclasses. Any ideas the best pattern to use? I can't figure out  
how I would take an existing object of say SLFlushDoor and convert  
it to an SLMonumentalDoor


Do you need to change the type of an instance? Or can you replace it  
with a new instance of the new type? I don't know the details of your  
model, but the latter seems cleaner, and works well with subclassing.


For example, if you need to convert to SLMonumentalDoor, you can add a  
method to SLDoor:

- (SLMonumentalDoor*) asMonumentalDoor;
which creates a new instance. (SLMonumentalDoor can override this to  
return self, of course.)


—Jens___

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


[fixed]Re: Don't highlight button's text when clicked

2009-11-04 Thread Gustavo Pizano

Sorry my mistake, as always.. its being fixed,

I was setting the glossy on the cells frame and not the background  
color.


I need then to pass a backgroundcolor with an alpha and thats it.


thanks thou.

G
On Nov 4, 2009, at 9:21 PM, Gustavo Pizano wrote:


Hello.

I have a custom NSButtonCell, also my CustomButton, I draw a glossy  
BackGround in the ButtonCell, and set the text to white-bold color.

now I overrode the method:

- (void)highlight:(BOOL)flag withFrame:(NSRect)cellFrame inView: 
(NSView *)controlView{
so set but a little darker glossy background color, but then I see  
that the text stays behind the  new color im applying.


I did some research, and found the method setHighlightsBy of  
NSButtonCell, so in the initialization of my custom button cell, I  
did:


[self setHighlightsBy:NSChangeBackgroundCellMask| 
NSChangeGrayCellMask];


but nothing happened, still the text its behind the new color.
then I tried applying the text-color with an attributedstring as I  
did in the - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *) 
controlView to change the text color, but then nothing happens, not  
even the new color its applied ...


Any ideas?

Thanks


Gustavo


___

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: PolKit for Leopard and later

2009-11-04 Thread Jens Alfke


On Oct 31, 2009, at 5:43 PM, Pierre-Olivier Latour wrote:


I'm actually fairly flexible on giving custom
license (say BSD or LGPL) to project owners who contact me. However,
depending on the case, I would ask for no compensation (say for a  
freeware
or small shareware) or some reasonable compensation (for a *real*  
commercial

product).


That's a great option for closed-source software. But it still seems  
to prevent your library from being used in other open-source software  
that uses a license other than GPL, as I don't think you can give a  
custom license for the use of your library an open-source library  
(otherwise anyone using that other library would inherit the custom  
license, bypassing the GPL.)


—Jens___

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: Programmatic Binding KVC KVO

2009-11-04 Thread Kyle Sluder
On Wed, Nov 4, 2009 at 12:17 PM, Richard Somers
rsomers.li...@infowest.com wrote:
 All code in the custom view that touch the num property use the accessor
 methods. The controller in the nib is in entity mode and bound to File's
 Owner (MyDocument) managed object context.

Okay, but as I said before, the default NSObject bindings
implementation only set up KVO in one direction.  If you call -[myView
bind:@num toObject:myController withKeyPath:@someModelKeyPath
options:0], KVO will only occur from [myController].someModelKeyPath
-- [myView].num.  NSObject doesn't (and can't) also set up the
reverse direction.

 @interface MyView : NSView
 {
 double num;
 }
 @end

 @implementation MyView

 - (double)num
 {
 return num;
 }

 - (void)setnum:(double)newNum

This is not a KVC-compliant accessor for the num property.  It needs
to be named -setNum:.

 {
 [self willChangeValueForKey:@num];

Do not do this if you have not overridden
-automaticallyNotifiesObserversForKey: to return NO for the num key.

 [myView bind:@num toObject:controller withKeyPath:@selection.num
 options:nil];

This invokes the default implementation of
-bind:toObject:withKeyPath:options:, which takes care of the model -
view communication.  You now need to take care of the view - model
communication.  As described in the User Updates a Value in the User
Interface section of the Cocoa Bindings Programming Topics, you can
call -setValue:forKeyPath: on the toObject and withKeyPath arguments
of the original binding (you can get this information by calling
-infoForBinding).  Or you might have some custom logic that informs
the controller/model of the change in a different way.

--Kyle Sluder
___

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: Programmatic Binding KVC KVO

2009-11-04 Thread Jim Correia

On Nov 4, 2009, at 3:17 PM, Richard Somers wrote:


@interface MyView : NSView
{
double num;
}
@end

@implementation MyView

- (double)num
{
return num;
}

- (void)setnum:(double)newNum
{
[self willChangeValueForKey:@num];
num = newNum;
[self didChangeValueForKey:@num];
}

@end


When the view changes num, it need to push the change to the bound  
model objects.


See mmalc’s Graphics Bindings sample:

http://homepage.mac.com/mmalc/CocoaExamples/controllers.html

- Jim

___

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: NSPopUpButton, Bindings separator items

2009-11-04 Thread Sean McBride
On 11/4/09 11:26 AM, Eric Gorr said:

I found this old message, but there was no answer posted and have the
same question...

http://lists.apple.com/archives/cocoa-dev/2005/Jan/msg00886.html

Is there a way to add separator Items to an NSPopUpButton using
bindings?

If you need a popup with some items that never change (which could
include any number of separators) and some items that come from, say, an
NSArrayController.  You can use the 'content placement tag'.  See
NSContentPlacementTagBindingOption.

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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: NSPopUpButton, Bindings separator items

2009-11-04 Thread Eric Gorr
Interesting. Don't suppose you are aware of any sample code which  
demonstrates how to use this?


On Nov 4, 2009, at 4:45 PM, Sean McBride wrote:


On 11/4/09 11:26 AM, Eric Gorr said:


I found this old message, but there was no answer posted and have the
same question...

http://lists.apple.com/archives/cocoa-dev/2005/Jan/msg00886.html

Is there a way to add separator Items to an NSPopUpButton using
bindings?


If you need a popup with some items that never change (which could
include any number of separators) and some items that come from,  
say, an

NSArrayController.  You can use the 'content placement tag'.  See
NSContentPlacementTagBindingOption.

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada




___

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: Programmatic Binding KVC KVO

2009-11-04 Thread Richard Somers

On Nov 4, 2009, at 2:31 PM, Kyle Sluder wrote:

This invokes the default implementation of - 
bind:toObject:withKeyPath:options:, which takes care of the model -  
view communication.  You now need to take care of the view - model  
communication.  As described in the User Updates a Value in the User  
Interface section of the Cocoa Bindings Programming Topics, you can  
call -setValue:forKeyPath: on the toObject and withKeyPath arguments  
of the original binding (you can get this information by calling - 
infoForBinding).  Or you might have some custom logic that informs  
the controller/model of the change in a different way.




On Nov 4, 2009, at 2:34 PM, Jim Correia wrote:

When the view changes num, it need to push the change to the bound  
model objects.


See mmalc’s Graphics Bindings sample:

http://homepage.mac.com/mmalc/CocoaExamples/controllers.html



Sometimes Cocoa can be overwhelming. This will help. Thank you so  
much. :)


Richard

___

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: Programmatic Binding KVC KVO

2009-11-04 Thread Rob Keniger


On 05/11/2009, at 8:42 AM, Richard Somers wrote:

See mmalc’s Graphics Bindings sample:

http://homepage.mac.com/mmalc/CocoaExamples/controllers.html


Sometimes Cocoa can be overwhelming. This will help. Thank you so  
much. :)



You might also find this blog post very helpful:

http://www.tomdalling.com/cocoa/implementing-your-own-cocoa-bindings

--
Rob Keniger



___

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: Programmatic Binding KVC KVO

2009-11-04 Thread mmalc Crawford

On Nov 4, 2009, at 5:20 pm, Rob Keniger wrote:

 See mmalc’s Graphics Bindings sample:
 
 http://homepage.mac.com/mmalc/CocoaExamples/controllers.html
 
 Sometimes Cocoa can be overwhelming. This will help. Thank you so much. :)
 
 You might also find this blog post very helpful:
 http://www.tomdalling.com/cocoa/implementing-your-own-cocoa-bindings
 
Rather more relevant, the documentation pretty-nuch explains the simpler of the 
two bound views in the Graphics Bindings example:

http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CocoaBindings/Concepts/HowDoBindingsWork.html#//apple_ref/doc/uid/20002373

Sample code just for the joystick view is also available:
http://developer.apple.com/mac/library/samplecode/BindingsJoystick/

mmalc

___

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


NSTreeController, Core Data and root objects

2009-11-04 Thread Rob Keniger

Hi everyone,

I have a Core Data model which consists of a simple tree of a  
particular entity, which has two relationships, parent and children. I  
have an NSTreeController managing the model, with an NSOutlineView  
bound to the NSTreeController.


This works fine if I set the fetch predicate of the NSTreeController  
in Interface Builder to parent == nil.


My problem is that I need a single root object, but this should not  
display in the outline view, only its children should be displayed at  
the top level of the outline view. My entity has an attribute,  
isRootItem, that is true for the root item only.


For instance, my model looks like this:

Node 1
|
+-  Node 2
|
Node 3
|   |
|   +-  Node 5
|
Node 4

I need to display Nodes 2, 3 and 4 at the top level of the outline  
view, but still have their parent be Node 1. Node 1 has a value of  
YES for isRootItem and all the others have NO.


If I set the fetch predicate of the tree controller to  
parent.isRootItem == 1, this displays the tree correctly, but as  
soon as I add a new item to the top level it fails because the tree  
controller does not assign the invisible root item as the parent of  
the new item.


Is there an easy way to have the NSTreeController/NSOutlineView  
combination work in this situation? I'm considering moving to a  
datasource for the NSOutlineView if this isn't easily possible.


--
Rob Keniger



___

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