Re: Learning SQLite by watching Core Data?

2008-06-23 Thread David Carlisle
I'm just studying the issues so far.  The sqlite version doesn't have  
to work just like the Core Data version, except on the surface.  I'm  
only beginning to get a grasp of how deep the implementation  
differences would need to be.


As far as the filename extension, if I don't use the .sqlite  
extension, then sqlite3 creates an empty textfile with the same name  
as the database:


Last login: Mon Jun 23 14:19:24 on ttys000
10:~ idev$ sqlite3 SQLiteStudy1
SQLite version 3.4.0
Enter ".help" for instructions
sqlite> .dump
BEGIN TRANSACTION;
COMMIT;
sqlite> .exit
10:~ idev$ sqlite3 SQLiteStudy1.sqlite
SQLite version 3.4.0
Enter ".help" for instructions
sqlite> .dump
BEGIN TRANSACTION;
CREATE TABLE ...  the data structures are dumped as expected here

On Jun 23, 2008, at 3:44 PM, Jens Alfke wrote:



On 23 Jun '08, at 2:35 PM, David Carlisle wrote:

I am studying an application design by implementing it with Core  
Data, then studying how I would move it to a platform where only  
sqlite is available.


Whew. If you want to implement an app the same way on a no-CoreData  
platform, you're talking about basically re-implementing CoreData.  
That would be a terrifyingly large and difficult task. Keep in mind  
that CoreData has been in development in one form or another for  
about 15 years (it does back to NeXT's Enterprise Object Framework.)  
A lot of the magic inside NSManagedObject relies on very  
sophisticated manipulation of the Objective-C runtime.


If you want to write an app that's portable between CoreData and non- 
CoreData platforms, I would suggest using one of the existing  
wrappers (QuickLite or FMDB) instead of CoreData.  They're not as  
powerful, but you'll be able to use them on both platforms without  
having to change your code.


I'm happy with my approach.  I modified ISavant's suggested Unix  
statement, realizing I needed a .sqlite suffix after my document  
name to make it work, so that answered that question.


SQLite doesn't care what the filename extension is, so that couldn't  
have been the issue.


Ilan noted that Core Data does "undocumented voodoo" with sqlite,  
which is good to be aware of.


And that statement was immediately denied by a CoreData engineer. I  
have never heard of CoreData using any undocumented sqlite features.


—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 [EMAIL PROTECTED]


Re: Learning SQLite by watching Core Data?

2008-06-23 Thread David Carlisle

Your comments noted below are not encouraging.

I'll likely get the Definitive Guide, and perhaps study one of the  
Cocoa sqlite wrappers.


On Jun 23, 2008, at 3:27 PM, Jens Alfke wrote:

integrating raw database APIs into object-oriented apps can be very  
difficult because they're two very different approaches to managing  
data. (Trust me, I did exactly this in my last project, and it was a  
ton of work.)


___

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: Learning SQLite by watching Core Data?

2008-06-23 Thread David Carlisle
I am studying an application design by implementing it with Core Data,  
then studying how I would move it to a platform where only sqlite is  
available.


I appreciate the book recommendations.  I found where the Definitive  
Guide to SQLite is available as an ebook, so I might go that route.   
Otherwise it is listed for 2-5 weeks.


I'm happy with my approach.  I modified ISavant's suggested Unix  
statement, realizing I needed a .sqlite suffix after my document name  
to make it work, so that answered that question.


Ilan noted that Core Data does "undocumented voodoo" with sqlite,  
which is good to be aware of.


I think poking around with sqlite3 and browsing the sqlite header file  
suggests questions for when I buy the book.


DC

On Jun 23, 2008, at 2:14 PM, Ben Trumbull wrote:


David,

I highly recommend these two books:







Now I want to recreate the same thing using just SQLite.  I don't  
know SQLite, and I know very little Unix.


Why do you want to use SQLite directly ?  I don't think it's  
currently a good fit for your self described skill level.  If you're  
simply interested in learning, pick up those books, and maybe one or  
two on UNIX, and hack at it.

--

-Ben


___

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: Learning SQLite by watching Core Data?

2008-06-23 Thread David Carlisle
In a 2005 entry on the Big Nerd Ranch Weblog titled "Life with  
SQLite", it says:


"If you are curious about how Core Data structures the file, sqlite3  
is a great way to explore it."


So I'm starting with just being curious about what Core Data did with  
my sqlite file, and I'm trying to work out the right Terminal command  
to do it.


On Jun 23, 2008, at 1:05 PM, I. Savant wrote:


 I hope this is helpful. I had to guess at what you do and don't
know, so take that into consideration if I'm off-base.


___

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]


Learning SQLite by watching Core Data?

2008-06-23 Thread David Carlisle
I just finished my first simple Core Data Document Based Application.   
Four entities with multiple relationships.  Now I want to recreate the  
same thing using just SQLite.  I don't know SQLite, and I know very  
little Unix.  I had read it was possible to study SQLite using Core  
Data, but I am making no progress.  The closest I could get to opening  
my core data sqlite document with sqlite3 was to try mycoredatadoc >  
sqlite3 in the Terminal, but permission was denied.


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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Race condition with awakeFromNib?

2008-06-18 Thread David Carlisle
I have a navigator object which maintains a stack of  
NSViewControllers.  When I create a new NSViewController and push it  
to the navigator, I want the view's back button to show the name of  
the previous view.  If the navigator tries to set the title of the  
button, the button is still null because it has not yet awoke from the  
nib.  The navigator can pass the previous view to the new view so that  
when the new view does an awakeFromNib, it can get the title of the  
previous view and set its back button accordingly.  This works, but  
I'm concerned that if awakeFromNib is being done in a separate thread  
then I have a race condition between awakeFromNib and the navigator  
setting the previous view.  Though it works now, might it break with a  
multicore computer?

___

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: Versioning MainMenu.nib

2008-06-04 Thread David Carlisle
Can't you just use NSApplication setMainMenu?  Or are you committed to  
doing it with build settings?


On Jun 3, 2008, at 9:12 PM, Chris Outwin wrote:

I have MainMenu.nib and MainMenu(Debug).nib in a Cocoa document app  
using Xcode 3.0.  The (Debug)version has controls only used during  
development.  I am trying to use build settings to dynamically load  
the MainMenu(Debug).nib when PreprocessorMacros has a value  
associated with the debug configuration.


The only example I've found is AppeanceSample:  a Carbon app which  
does not have NSMainNibFile MainMenu in  
the Info.plist.  This key/value pair may be my problem.


How do you dynamically select between two version of MainMenu.nib in  
a Cocoa document app?


Thank you,
Chris Outwin
___

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/davidcar1%40mstarmetro.net

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: NSObjectController needless in "Intro to Bindings"?

2008-06-03 Thread David Carlisle
I'm looking forward to reading the chapter "Application Kit Support  
for Controller Subsystems" in Erik Buck's forthcoming book "Cocoa  
Design Patterns" to get a clearer understanding of the use of  
NSObjectController, etc.


On Jun 3, 2008, at 7:59 PM, Ken Thomases wrote:


On Jun 3, 2008, at 6:25 PM, Jochen Moeller wrote:


Both versions run identical, so my question:
Are both approaches equivalent and the NSObjectController is not  
really needed or is there a reason/advantage to hook the  
NSObjectController between MyController and the NSArrayController ?


See this: http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/Concepts/WhatAreBindings.html#/ 
/apple_ref/doc/uid/20002372-177085


In short, yes, it's possible to get away with binding directly to  
model objects without an intervening NSController.  It's often  
better to use such a controller, though, and the link explains why.


Cheers,
Ken
___

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/davidcar1%40mstarmetro.net

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: Ending Editing when Doc Saves?

2008-05-30 Thread David Carlisle
After your suggestion, I recalled and reviewed figure 6 about "Saving  
a Document" in the Document Based Applications Overview.  That made it  
clear to me that saveDocument does call the saveDocumentWithDelegate  
method.


Then I tried your scenario of closing an unsaved doc.  Under the old  
implementation it failed as you expected.  When I transferred my  
modifications to the saveDocumentWithDelegate method, it worked.


Thanks,
DC

On May 30, 2008, at 5:33 PM, Mike Abdullah wrote:



I couldn't find a more general save operation to modify in  
MyDocument, so I modified both saveDocument, and saveDocumentAs.  I  
can modify others later if needed.  I was thinking there might be  
something like (BOOL) shouldSaveDocument, but I didn't see it.


Well I would suggest either

- 
saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo 
:


or

-saveDocumentWithDelegate:didSaveSelector:contextInfo:


In particular, consider the scenario of the user closing an unsaved  
doc. If they choose "Save" from the prompt, I'm pretty certain that  
the actual document saving does not go through either of the  
IBAction methods.


___

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: Ending Editing when Doc Saves?

2008-05-30 Thread David Carlisle
I'm binding my NSCollectionView to my NSArrayController, so I expected  
sending a commitEditing to the NSArrayController would work.



On May 30, 2008, at 2:09 PM, Kyle Sluder wrote:


On Fri, May 30, 2008 at 3:33 PM, David Carlisle
<[EMAIL PROTECTED]> wrote:
The myPrepareToSave method in MyWindow allowed me to experiment  
with the
commitEditing method.  I tried sending it to either my  
NSWindowController or

to the NSArrayController which is bound to the NSCollectionView which
contains the NSTextField that needed to end editing.  Neither  
approach

worked, so I stuck with using makeFirstResponder.


I probably should have first confirmed that you were using bindings.

--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 [EMAIL PROTECTED]


Re: Ending Editing when Doc Saves?

2008-05-30 Thread David Carlisle
I'm not using Core Data.  Perhaps that is part of why commitEditing  
doesn't work.


I also mistakenly thought that NSWindowController was an NSController,  
and would respond to a commitEditing.


DC

On May 30, 2008, at 2:17 PM, Sean McBride wrote:


Are you using Core Data?  Have you seen:


___

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: Ending Editing when Doc Saves?

2008-05-30 Thread David Carlisle

This is the approach I ended up taking:

// in MyDocument.m
- (void) saveDocument:(id)sender {
	[[self windowControllers]  
makeObjectsPerformSelector:@selector(myPrepareToSave:)];

[super saveDocument:sender];
}

// in MyWindow.m
- (void) myPrepareToSave:(id)sender {
[[self window] makeFirstResponder:[self window]];
}

I couldn't find a more general save operation to modify in MyDocument,  
so I modified both saveDocument, and saveDocumentAs.  I can modify  
others later if needed.  I was thinking there might be something like  
(BOOL) shouldSaveDocument, but I didn't see it.


The myPrepareToSave method in MyWindow allowed me to experiment with  
the commitEditing method.  I tried sending it to either my  
NSWindowController or to the NSArrayController which is bound to the  
NSCollectionView which contains the NSTextField that needed to end  
editing.  Neither approach worked, so I stuck with using  
makeFirstResponder.


DC

On May 29, 2008, at 6:41 AM, Dave Fernandes wrote:

Make the window the first responder in your document's saveDocument  
method...


- (IBAction)saveDocument:(id)sender
{
NSWindow* window = [self windowForSheet];
[window makeFirstResponder:window];
[super saveDocument:sender];
}

On May 28, 2008, at 11:15 PM, David Carlisle wrote:

If I'm adding text to an NSTextField, then I select Save, somehow  
the message needs to get to the NSTextField wherever it is that it  
needs to terminate editing and send its contents to the model  
before the model is saved.  I don't see how I should go about  
implementing that?  Any suggestions are welcome.



___

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/dave.fernandes%40utoronto.ca

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/davidcar1%40mstarmetro.net

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]


Ending Editing when Doc Saves?

2008-05-28 Thread David Carlisle
If I'm adding text to an NSTextField, then I select Save, somehow the  
message needs to get to the NSTextField wherever it is that it needs  
to terminate editing and send its contents to the model before the  
model is saved.  I don't see how I should go about implementing that?   
Any suggestions are welcome.



___

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]


Need NSNumber setBoolValue for KVC Compliance workaround

2008-05-27 Thread David Carlisle
I want to put an NSMutableDictionary into my standardUserDefaults with  
keys and boolean values [NSNumber numberWithBool:YES/NO], then bind  
that to a table with keys and checkboxes in my preferences window.   
That all seems to work nicely, except that when I check one of the  
checkboxes I find that NSNumber needs a setBoolValue method to be KVC  
compliant.


So I need an object that is both property list compliant and KVC  
compliant for a BOOL value.


Is there a standard workaround somewhere?

___

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]


NSTextField in NSCollectionView aborts editing without notice, solved

2008-05-24 Thread David Carlisle
I have an NSTextField in an NSCollectionView.  If I type in a change  
to the NSTextField, then without hitting tab or clicking elsewhere in  
the NSCollectionView I click on a popup menu in the window, the  
NSTextField aborts the edit and loses the information without any kind  
of notice being given to the NSTextField.


I solved the problem by subclassing NSTextFieldCell and overriding the  
method endEditing, passing it up to the superclass after first sending  
an emergency message to the window controller, along with a copy of  
the NSTextField, indicating it needs to grab the edited string out of  
the NSTextField because the information is about to be lost.


I tried monitoring resignsFirstResponder.  I can then click on the  
NSTextFields in the NSCollectionView and get resignsFirstResponder  
messages as expected.  If I click on an NSTextField and then hit a key  
to begin an edit, the sequence of messages is as follows:


NSTextField gets the message:
textShouldBeginEditing

The NSTextField delegate, which is an NSCollectionViewItem, gets the  
message:

control:textShouldBeginEditing

NSTextField gets the message:
textDidBeginEditing

The NSTextField delegate gets the message:
control:textDidBeginEditing

After I type in some text, if I were to click on the popup as  
described, neither NSTextField nor its delegate gets any of the text  
did/should end editing messages which correspond with the above  
messages.  FWIW, if rather than clicking on the popup menu I click on  
another text field, the NSTextField gets both of the  
textShouldEndEditing messages, but not any textDidEndEditing  
messages.  After those messages, it gets the expected  
resignsFirstResponder message.


If after I click on the popup menu I click on another NSTextField, I  
do get a resignsFirstResponder message from an NSTextField, but by  
that time the information in the field I had edited has already been  
lost.


So is this a bug?  Is it a feature?  Am I missing something?  Has  
someone already found an easier way of dealing with this?  If someone  
else is already wondering about this problem, then this is the way I  
solved it.


DC
___

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: NSTextView without word wrap?

2008-05-23 Thread David Carlisle
Based on your kindly giving me a precise reference I was able to  
remove a few unnecessary statements from my awake from nib.  It now  
reads as follows:


- (void) awakeFromNib {
const CGFloat LargeNumberForText = 1.0e7;
[[textView textContainer]  
setContainerSize:NSMakeSize(LargeNumberForText, LargeNumberForText)];

[[textView textContainer] setWidthTracksTextView:NO];
[textView setHorizontallyResizable:YES];
}

Thanks,
DC

On May 23, 2008, at 4:08 PM, Jonathan Dann wrote:


Its in SMLViewMenuController.m line -(IBAction)lineWrapTextAction:

Jon

On 23 May 2008, at 22:58, David Carlisle wrote:


Looks interesting.  Thanks.

DC

On May 23, 2008, at 3:37 PM, Jonathan Dann wrote:

You may also like to look at the source code to Smultron by Peter  
Borg.  It's in there but I forget exactly.


http://smultron.sourceforge.net/

Jon

On 23 May 2008, at 21:55, David Carlisle wrote:

I made some guesses at which statements to copy from  
BiScrollAspect.m and came up with the following awakeFromNib.   
I'm not sure which statements are the most relevant, and why, but  
it seems to do what I need.


- (void) awakeFromNib {
const CGFloat LargeNumberForText = 1.0e7;
[[textView textContainer]  
setContainerSize:NSMakeSize(LargeNumberForText,  
LargeNumberForText)];

[[textView textContainer] setWidthTracksTextView:NO];
[[textView textContainer] setHeightTracksTextView:NO];
[textView setAutoresizingMask:NSViewNotSizable];
[textView setMaxSize:NSMakeSize(LargeNumberForText,  
LargeNumberForText)];

[textView setHorizontallyResizable:YES];
[textView setVerticallyResizable:YES];
}

On May 23, 2008, at 12:03 PM, Douglas Davidson wrote:



On May 23, 2008, at 10:33 AM, David Carlisle wrote:

I've spent the last few hours trying to create an NSTextView  
without word wrap.  The BiScrollAspect.m file in the  
textSizingExample project file is no help at all.


No help in that it doesn't do what you want, or no help in that  
you can't get it working in your app, or no help in some other  
way?


Douglas Davidson



___

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/j.p.dann%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/davidcar1%40mstarmetro.net

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: NSTextView without word wrap?

2008-05-23 Thread David Carlisle
I made some guesses at which statements to copy from BiScrollAspect.m  
and came up with the following awakeFromNib.  I'm not sure which  
statements are the most relevant, and why, but it seems to do what I  
need.


- (void) awakeFromNib {
const CGFloat LargeNumberForText = 1.0e7;
[[textView textContainer]  
setContainerSize:NSMakeSize(LargeNumberForText, LargeNumberForText)];

[[textView textContainer] setWidthTracksTextView:NO];
[[textView textContainer] setHeightTracksTextView:NO];
[textView setAutoresizingMask:NSViewNotSizable];
[textView setMaxSize:NSMakeSize(LargeNumberForText,  
LargeNumberForText)];

[textView setHorizontallyResizable:YES];
[textView setVerticallyResizable:YES];
}

On May 23, 2008, at 12:03 PM, Douglas Davidson wrote:



On May 23, 2008, at 10:33 AM, David Carlisle wrote:

I've spent the last few hours trying to create an NSTextView  
without word wrap.  The BiScrollAspect.m file in the  
textSizingExample project file is no help at all.


No help in that it doesn't do what you want, or no help in that you  
can't get it working in your app, or no help in some other way?


Douglas Davidson



___

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: NSTextView without word wrap?

2008-05-23 Thread David Carlisle
I hope to find something of the form [theTextView dontDoWordWrap] for  
an IBOutlet NSTextView *theTextView.  BiScrollAspect.m has so many  
statements that I can't figure out which one is critical for turning  
off the word wrap.


On May 23, 2008, at 12:03 PM, Douglas Davidson wrote:



On May 23, 2008, at 10:33 AM, David Carlisle wrote:

I've spent the last few hours trying to create an NSTextView  
without word wrap.  The BiScrollAspect.m file in the  
textSizingExample project file is no help at all.


No help in that it doesn't do what you want, or no help in that you  
can't get it working in your app, or no help in some other way?


Douglas Davidson

___

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/davidcar1%40mstarmetro.net

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]


NSTextView without word wrap?

2008-05-23 Thread David Carlisle
I've spent the last few hours trying to create an NSTextView without  
word wrap.  The BiScrollAspect.m file in the textSizingExample project  
file is no help at all.  Searching on "wrap" is no help either.  I've  
checked and unchecked various settings in IB.  After much searching I  
settled on the following approach, which also doesn't work.


So where am I going wrong, and (optionally for documentation  
defenders) where in the documentation was I supposed to find the right  
answer?


- (void) awakeFromNib {
	NSMutableParagraphStyle *style = [[theTextView defaultParagraphStyle]  
mutableCopy];

[style setLineBreakMode:NSLineBreakByClipping];
[theTextView setDefaultParagraphStyle:style];
[style release];
}
___

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: IB outlets and NSCollectionViews

2008-05-23 Thread David Carlisle
I solved a similar problem when putting a pop up menu into a  
collectionView item.


There might be an easier way, but I assume that to put a button in a  
collectionViewItem, the button would have to send a message to a  
subclass of NSCollectionViewItem, which you would then cause to send a  
similar message along with a copy of the representedObject to a  
subclass of NSCollectionView.  (Note that an NSCollectionViewItem  
knows both its representedObject and its NSCollectionView.) You would  
write your NSCollectionView subclass to have an outlet for File's  
Owner, so you could forward the message from the button to File's  
Owner, which could then take some action on the representedObject.


On May 23, 2008, at 8:01 AM, Marcel Borsten wrote:

Could you give a bit more information on how you solved this. I'm  
trying to do something similar, but I can't get it to work.



Hm ...I had to bind it to a NSCollectionItemView subclass that  
routes to the AppController.


cheers
--
Torsten

On Apr 7, 2008, at 18:04, Torsten Curdt wrote:
Hm ...I was trying to bind a button inside a NSCollectionItemView  
view to an action in my AppController. This obviously does not work.


Of course the view is only a prototype that gets cloned per item  
in the collection but I was expecting to just get the instance  
passed on the call.


So how would I need to do something like this?

cheers
--
Torsten

___

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/marcel%40mass-it.nl

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/davidcar1%40mstarmetro.net

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: Problem binding to recreated NSCollectionView

2008-05-16 Thread David Carlisle


On May 16, 2008, at 11:03 AM, I. Savant wrote:

On Fri, May 16, 2008 at 12:55 PM, David Carlisle
<[EMAIL PROTECTED]> wrote:

FWIW, I got my very own collection view (MyVOCV) working nicely with
NSArrayController, all except for animations, and I just pre  
ordered the

animation book from Amazon.
So thanks for the suggestions,


 Hey! Good work. Maybe it's worth posting on CocoaDev.com or a blog
somewhere. I'm sure a LOT of people would benefit from something like
that. Sort of a "pay it forward" kind of thing. Congrats.

--
I.S.


There are only a few "secrets" involved (in my limited and as yet  
unanimated version), and the one about using NSKeyedArchiver is  
already on CocoaDev.  The other one is that if you bind  
MyCollectionView content to NSArrayController arrangedObjects, you  
need to have the MyCollectionView content method return a nil to  
NSArrayController to force it to call setContent with the updated array.


My MyCollectionViewItem in the nib is connected to MyCollectionView  
IBOutlet itemPrototype, and the prototype NSView in the nib is  
connected to MyCollectionViewItem IBOutlet prototypeView.  When I call  
setView in a copy of MyCollectionViewItem, I put that view into a  
different NSView variable so as not to confuse it with prototypeView.


These are some important methods in MyCollectionView:


- (NSView *) copyOfPrototypeView {
   NSData *d = [NSKeyedArchiver archivedDataWithRootObject: 
[itemPrototype prototypeView]];

   return [NSKeyedUnarchiver unarchiveObjectWithData:d];
}

- (void) newItemForRepresentedObject:(id)ro {
MyCollectionViewItem *newProto = [itemPrototype copy];
[newProto setCollectionView:self];
[newProto setRepresentedObject:ro];
NSView *newView = [self copyOfPrototypeView];
[newProto setView:newView];

// etc, for example:
[newView setFrameOrigin:p];
[self addSubview:newView];
}

- (void) setContent:(NSArray *)content {
  // compare with old content array to do layout and animation
}

- (NSArray *) content {
return nil;  // This forces NSArrayController to call setContent
}

- (BOOL) isFlipped {
return YES;
}

// This is probably not needed
- (Class) valueClassForBinding:(NSString *)binding {
return [NSObject class];
}
___

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]


Problem binding to recreated NSCollectionView

2008-05-14 Thread David Carlisle
I'm trying to recreate NSCollectionView from scratch so I can  
customize the animations.  I have a problem in binding the array  
controller arrangedObjects to the content of MyCollectionView.


In a test situation where I have an instance of both MyCollectionView  
and NSCollectionView bound to the same array controller, when the  
content of the array controller is updated, it will call  
NSCollectionView setContent, content, content, content.  Then it will  
call MyCollectionView content.  It should be calling MyCollectionView  
setContent, but it doesn't.


NSCollectionView is bound to the array controller through IB.   
MyCollectionView is bound manually to the array controller in  
windowDidLoad of the window controller.  At the time of binding,  
MyCollectionView setContent is called, allowing me to create the  
initial content of the view from the array passed to setContent.   
Updates to the content of the array controller are not forwarded to  
MyCollectionView.


F-Script says the content of both views are bound to the same array  
controller at path arrangedObjects.  In the case of NSCollectionView  
it adds that the value class is NSObject, a detail which does not  
appear in the case of MyCollectionView.  The dictionary shows the same  
options in both cases.


Any thoughts?
___

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: F-Script Anywhere can't add to procmod group

2008-05-08 Thread David Carlisle

I got 1.3.1, and that solved the installation problem.

There is some confusion in the version numbers that made me think I  
didn't need 1.3.1:


FSA Version 1.3 (1.3.2) dated May 30, 2006

FSA Version 1.3.1 (1.3.1) dated Oct 12, 2007.

Thanks,
DC

On May 8, 2008, at 6:57 PM, Dave Dribin wrote:


On May 8, 2008, at 7:53 PM, David Carlisle wrote:
My file directory name says "FScriptBin-20070421"  My startup  
warning message says I got it Jan 8, 2008, from www.fscript.org.


I think you may have to downgrade to Robert's FSA 1.3.1 as it looks  
like the code signing stuff hasn't made it into the official version.


-Dave

___

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/davidcar1%40mstarmetro.net

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: F-Script Anywhere can't add to procmod group

2008-05-08 Thread David Carlisle
My file directory name says "FScriptBin-20070421"  My startup warning  
message says I got it Jan 8, 2008, from www.fscript.org.


But if ignore the procmod installation message, it still fails to  
install in, for example, Stickies.  In that case I get:



F-Script Anywhere was unable to install itself in the selected  
application (process ID 392), because F-Script Anywhere must be  
installed in a Cocoa application running as the current user.


You may be attempting to install in a setuid application, which is not  
supported.


The application may have crashed; restart it if needed.


On May 8, 2008, at 6:40 PM, Dave Dribin wrote:


On May 8, 2008, at 7:31 PM, David Carlisle wrote:
I'm trying to install F-Script Anywhere, but it can't install my  
developer account into the procmod group.  It says "not a known  
DirStatus."  I don't speak Unix, but I tried finding some terminal  
commands on the internet for installing a user into the procmod  
group via terminal, but I can't find the right command.  For  
example, in one case Terminal responded that niutil was not  
recognized, so that command must be outdated.


Any suggestions?  I have an Intel iMac with OS 10.5.2.  F-Script  
Anywhere version 1.3.2.


I note F-Script is often recommended here for analyzing Cocoa  
programs.


procmod and niutil are only needed for 10.4 on Intel.  Use Robert  
Chin's FSA, Leopard Edition:


 <http://osiris.laya.com/blog/?p=24>

It uses code signing for the deprecated procmod group.  It's only  
version 1.3.1, though.  Where did you find version 1.3.2?


-Dave

___

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/davidcar1%40mstarmetro.net

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]


F-Script Anywhere can't add to procmod group

2008-05-08 Thread David Carlisle
I'm trying to install F-Script Anywhere, but it can't install my  
developer account into the procmod group.  It says "not a known  
DirStatus."  I don't speak Unix, but I tried finding some terminal  
commands on the internet for installing a user into the procmod group  
via terminal, but I can't find the right command.  For example, in one  
case Terminal responded that niutil was not recognized, so that  
command must be outdated.


Any suggestions?  I have an Intel iMac with OS 10.5.2.  F-Script  
Anywhere version 1.3.2.


I note F-Script is often recommended here for analyzing Cocoa programs.

DC


___

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]


NSCollectionView animation complaint

2008-05-06 Thread David Carlisle
If I have two items in my NSCollectionView and I remove the first  
item, the animation causes the second item to slide underneath the  
first item which then pops out of existence revealing the second item  
underneath.  It would look better if the animation caused the second  
item to slide over the first item, concealing it, which would make it  
visually symmetric with adding a new first item, which causes the old  
first item to slide into the second position unconcealing the new item  
in the first position.

___

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: What is the status on the New Cocoa 2.0 Books?

2008-03-13 Thread David Carlisle
Does anyone know the status of the "Cocoa Design Patterns" book by  
Erik Buck, "rough-cuts" version or otherwise?


Amazon says 12 January 2009.

On Mar 12, 2008, at 5:54 PM, colo wrote:


And might there be others ?


___

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: Observing with GC

2008-02-25 Thread David Carlisle
So in the non_GC world, where is the best place to - 
removeObserver:forKeyPath: if not in -dealloc?


On Feb 25, 2008, at 8:02 AM, glenn andreas wrote:

Note that in the non-GC world, you can't do that in -dealloc (since  
the KVO "warning" about deallocating something that is still be  
observed happens before the call to dealloc), so it's unclear if  
there isn't some similar helpful warning before -finalize is called...


___

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]