Re: Shared NSTextView

2008-08-19 Thread Шкраблюк Павел
Hello, Oleg.

> I am developing a custom view, sort of a simple graphic editor, where
> the user can draw graphic boxes of different size. Each box should
> display its own attributed string bounded by its own size, and when
> the user double-clicks any box, he becomes able to edit the box's text
> in-place.

I think, You can see Sketch example
(/Developer/Examples/AppKit/Sketch): they have SKTText and (I don't
remember exactly, I don't have Mac at hand now) maybe view for it.
They do exactly what you need.

-- 
С уважением,
 Шкраблюк  mailto:[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: document based app, custom ibaction

2008-08-19 Thread Bart

I've created a new xcode project, document based cocoa app.
Added this code to the mydocument class:

m:
-(IBAction)getTotals
{
NSLog(@"Hello");
}

h:
-(IBAction)getTotals;

I've created a button in the MyDocument.xib, connected through the  
firstresponder to the getTotals method. Everything compiles ok, but  
when I push the button nothing happens. Am I missing something  
somewhere?


Some help would very much be appreciated!

Op 18 aug 2008, om 19:32 heeft Bart Beulen het volgende geschreven:

I've connected a simple button to the First Responder. I was able to  
select the action that I've created in my MyDocument class. When I  
run the program and press the button nothing happens.  The function  
was only containing an NSLog statement to check if it worked. Am I  
missing anything?


Op 18 aug 2008, om 19:12 heeft Sherm Pendley het volgende geschreven:


On Mon, Aug 18, 2008 at 9:52 AM, Bart Beulen <[EMAIL PROTECTED]> wrote:


However I would like to add a button in my document which is  
connected to
some code, to process the data in the array (etc count up data in  
columns).
I was trying to do this by adding an IBAction function to the  
MyDocument.h
en MyDocument.m files. The problem is that I do not know how to  
connect the
button from my GUI to this action (normally I can ctrl-drag from  
the button
to the object, but I guess this works different for document based  
apps?


Connect it to the First Responder icon in IB. That will route the
action message through the responder chain, one element of which is
the currently-active document.

Details:

  


sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.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/b2xtreme%40me.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Window controllers, code obfuscation

2008-08-19 Thread Sumner Trammell
Hi, I'm trying to decipher someone else's code who is no longer
available.  He did something that I think I can simplify, but I first
want to make sure I'm not being completely wrong-headed about what I'm
looking at.



He does the following in his MyDocument.m file:

- (void)windowControllerDidLoadNib:(NSWindowController *)aController
{   

NSWindow* window = [[[self windowControllers] objectAtIndex:0] window];
[[window windowController] setShouldCascadeWindows:NO];

.
.
.
}


In English:

He grabs a reference to the array of window controllers from the
document object.
He grabs the first window controller from that array.
He grabs the window from that window controller.
He sends a message, setShouldCascadeWindows:NO, to that window's
window controller.



Unless I'm being completely stupid about this, he could have done this, right?

[[[self windowControllers] objectAtIndex:0] setShouldCascadeWindows:NO];


Or better yet, this?

[aController setShouldCascadeWindows:NO];



Thanks,
-s
___

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: document based app, custom ibaction

2008-08-19 Thread Graham Cox


On 19 Aug 2008, at 5:08 pm, Bart wrote:


I've created a new xcode project, document based cocoa app.
Added this code to the mydocument class:

m:
-(IBAction)getTotals
{
NSLog(@"Hello");
}

h:
-(IBAction)getTotals;

I've created a button in the MyDocument.xib, connected through the  
firstresponder to the getTotals method. Everything compiles ok, but  
when I push the button nothing happens. Am I missing something  
somewhere?


Some help would very much be appreciated!



IBAction methods must be declared like this:

- (IBAction) someActionMethod:(id) sender;

since your method doesn't have the right signature, it's not being  
called. Even if you don't need the sender, your method must be  
declared as having one.



hth,


Graham
___

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: Window controllers, code obfuscation

2008-08-19 Thread Graham Cox


On 19 Aug 2008, at 5:20 pm, Sumner Trammell wrote:


Hi, I'm trying to decipher someone else's code who is no longer
available.  He did something that I think I can simplify, but I first
want to make sure I'm not being completely wrong-headed about what I'm
looking at.


First off, does this person's code not work? If it does, my advice is  
to leave it alone. Debugged code, no matter how bizarre-looking, is  
better than any amount of theoretically excellent code that might not  
work.


So, with that out of the way:


Or better yet, this?

[aController setShouldCascadeWindows:NO];



This seems the most straightforward thing to do. The question you need  
to answer to your own satisfaction is: Is this what the original coder  
intended? Is it functionally equivalent to the original code?


hth,

Graham
___

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: document based app, custom ibaction

2008-08-19 Thread Bart Beulen

Thanks,

Again sloppy programming didn't know this could cause problems  
although the compiler was not worried. I guess I will not make such an  
error anymore in the future. :o)


Op 19 aug 2008, om 09:31 heeft Graham Cox het volgende geschreven:



On 19 Aug 2008, at 5:08 pm, Bart wrote:


I've created a new xcode project, document based cocoa app.
Added this code to the mydocument class:

m:
-(IBAction)getTotals
{
NSLog(@"Hello");
}

h:
-(IBAction)getTotals;

I've created a button in the MyDocument.xib, connected through the  
firstresponder to the getTotals method. Everything compiles ok, but  
when I push the button nothing happens. Am I missing something  
somewhere?


Some help would very much be appreciated!



IBAction methods must be declared like this:

- (IBAction) someActionMethod:(id) sender;

since your method doesn't have the right signature, it's not being  
called. Even if you don't need the sender, your method must be  
declared as having one.



hth,


Graham


___

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: NSCalendarDate to be deprecated

2008-08-19 Thread Tom Bernard
As written, 70 microseconds. When I set the calendar's time zone to GMT, the
time drops to 43 microseconds. Since my app will only work with dates in
GMT, this is a plus. Even so, 40 microseconds is far slower than the 7 - 8
microseconds offered by -[NSCalendarDate dayOfYear]. Unless someone has
another offering, I plan to file a bug report on this issue. This
calculation is part of an animation loop, so the performance hit is
important.

Btw, my two offerings return an incorrect 367 for the date 2008-12-31
23:59:59 +; 2008 being a leap year, the correct return is 366. Your
offering and NSCalendarDate get it right.

int dayOfYearForDate4(NSDate *_date)
{
NSTimeZone *gmtTimeZone = [NSTimeZone timeZoneForSecondsFromGMT:0];
  NSCalendar *calendar = [[NSCalendar alloc]
initWithCalendarIdentifier:NSGregorianCalendar];
 [calendar setTimeZone:gmtTimeZone];

 int day = [calendar ordinalityOfUnit:NSDayCalendarUnit
inUnit:NSYearCalendarUnit forDate:_date];
 return day;
}


on 8/18/08 7:34 AM, Eliza Block at [EMAIL PROTECTED] wrote:

> You could do this:
> 
> int dayOfYearForDate(NSDate *_date)
> {
>  NSCalendar *calendar = [[NSCalendar alloc]
> initWithCalendarIndentifier:NSGregorianCalendar]];
>  int day = [calendar ordinalityOfUnit:NSDayCalendarUnit
> inUnit:NSYearCalendarUnit forDate:_date];
>  return day;
> }
> 
> I've never benchmarked this, but it's certainly a lot less code.


___

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: Hex representation of NSString

2008-08-19 Thread Negm-Awad Amin


Am Mo,18.08.2008 um 19:15 schrieb Charles Srstka:


On Aug 18, 2008, at 6:18 AM, Robert Černý wrote:

Actually,I'm trying to debug some weird problems with clipboard. My  
problem
is that data copied into clipboard from legacy java application  
doesn't

match data pasted into Cocoa application. I've got data with accented
characters which gets converted through MacOS Roman encoding even  
the visual

representation in java is correct.


It sounds like you don't really want to use NSString at all. Have  
you tried just using -[NSPasteboard dataForType:] instead of - 
[NSPasteboard stringForType:] to get the raw pasteboard data as it's  
coming from the Java application?
Yes, I think, that the other answer tries to solve the problem "too  
late". He should look insinde the pasteboard before a string instance  
is even in mind.





Charles

Cheers,
Amin

Amin Negm-Awad
[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: document based app, custom ibaction

2008-08-19 Thread Bart

Another similar problem.

I would like to add a sheet to the button I've created. Normally I  
would create an IBOutlet and connect the window for the sheet to it,  
combined with a code to open: 	


[NSApp beginSheet:totalsSheet
   modalForWindow:[NSApp mainWindow]
modalDelegate:self
   didEndSelector:NULL
  contextInfo:NULL];

and close it:

[NSApp endSheet:totalsSheet];
[totalsSheet orderOut:sender];

However, is this possible when using a mydocument class, because I  
cannot find any outlets in the interface builder
I would also like to create some seperate outlets for displaying some  
float values from some variables of the mydocument class, this is a  
similar problems since I don't know where to find the outlets to  
connect the GUI elements to.


At the moment all data is presented in a table using an array  
controller. This is fine, but I would like to perform some  
calculations on the same data and present the results in a pop-up  
window. I guess the method described above should be a nice way to do  
this.




Op 19 aug 2008, om 09:50 heeft Bart Beulen het volgende geschreven:


Thanks,

Again sloppy programming didn't know this could cause problems  
although the compiler was not worried. I guess I will not make such  
an error anymore in the future. :o)


Op 19 aug 2008, om 09:31 heeft Graham Cox het volgende geschreven:



On 19 Aug 2008, at 5:08 pm, Bart wrote:


I've created a new xcode project, document based cocoa app.
Added this code to the mydocument class:

m:
-(IBAction)getTotals
{
NSLog(@"Hello");
}

h:
-(IBAction)getTotals;

I've created a button in the MyDocument.xib, connected through the  
firstresponder to the getTotals method. Everything compiles ok,  
but when I push the button nothing happens. Am I missing something  
somewhere?


Some help would very much be appreciated!



IBAction methods must be declared like this:

- (IBAction) someActionMethod:(id) sender;

since your method doesn't have the right signature, it's not being  
called. Even if you don't need the sender, your method must be  
declared as having one.



hth,


Graham


___

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/b2xtreme%40me.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: IKImageBrowser drag reordering question/problem

2008-08-19 Thread thomas goossens

___

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: Using Flex/Lex in a Cocoa project

2008-08-19 Thread John Joyce


On Aug 18, 2008, at 9:23 PM, Graham Cox wrote:



On 19 Aug 2008, at 11:53 am, John Joyce wrote:

I wonder if it wouldn't make sense to just start trying to build  
some new form of flex in Objective-C... so that it uses NSString  
and NSMutable string ?
I'm looking at the Flex source code now... in true GNU fashion, it  
is well documented, but somewhat terse C...



And you know about NSScanner, right?

Graham

Yes. I'm looking at it.
I'm also looking at how Smultron uses RegexKit.
___

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: document based app, custom ibaction

2008-08-19 Thread Graham Cox


On 19 Aug 2008, at 7:03 pm, Bart wrote:


Another similar problem.

I would like to add a sheet to the button I've created. Normally I  
would create an IBOutlet and connect the window for the sheet to it,  
combined with a code to open: 	


[NSApp beginSheet:totalsSheet
   modalForWindow:[NSApp mainWindow]
modalDelegate:self
   didEndSelector:NULL
  contextInfo:NULL];

and close it:

[NSApp endSheet:totalsSheet];
[totalsSheet orderOut:sender];

However, is this possible when using a mydocument class, because I  
cannot find any outlets in the interface builder


So, add the outlets you need to the class. It is called *MY*document  
after all - it's yours ;-)


e.g. in MyDocument.h, add the instance variable:

IBOutlet id mySheetWindow;

and this will show up in IB for you to connect to.

(This probably isn't the time to get into handling this in a separate  
controller class, but you may want to revisit this question when you  
get the hang of it a bit more).


I would also like to create some seperate outlets for displaying  
some float values from some variables of the mydocument class, this  
is a similar problems since I don't know where to find the outlets  
to connect the GUI elements to.


Do you really mean outlet? Or just an instance variable? While an  
outlet is an instance variable, not all instance variables are  
outlets...


Still, in either case, just add them to your class definition as above.

At the moment all data is presented in a table using an array  
controller. This is fine, but I would like to perform some  
calculations on the same data and present the results in a pop-up  
window. I guess the method described above should be a nice way to  
do this.


Well, see how you go. Not sure why a separate pop-up window seems such  
a good idea, but I guess you're just learning the ropes, so go right  
ahead.


hth,

Graham
___

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: document based app, custom ibaction

2008-08-19 Thread Bart Beulen
Sorry, didn't know I had to connect the outlets of the mydocument  
class through file owner This basically solved my problems.


Op 19 aug 2008, om 14:03 heeft Graham Cox het volgende geschreven:



On 19 Aug 2008, at 7:03 pm, Bart wrote:


Another similar problem.

I would like to add a sheet to the button I've created. Normally I  
would create an IBOutlet and connect the window for the sheet to  
it, combined with a code to open: 	


[NSApp beginSheet:totalsSheet
   modalForWindow:[NSApp mainWindow]
modalDelegate:self
   didEndSelector:NULL
  contextInfo:NULL];

and close it:

[NSApp endSheet:totalsSheet];
[totalsSheet orderOut:sender];

However, is this possible when using a mydocument class, because I  
cannot find any outlets in the interface builder


So, add the outlets you need to the class. It is called *MY*document  
after all - it's yours ;-)


e.g. in MyDocument.h, add the instance variable:

IBOutlet id mySheetWindow;

and this will show up in IB for you to connect to.

(This probably isn't the time to get into handling this in a  
separate controller class, but you may want to revisit this question  
when you get the hang of it a bit more).


I would also like to create some seperate outlets for displaying  
some float values from some variables of the mydocument class, this  
is a similar problems since I don't know where to find the outlets  
to connect the GUI elements to.


Do you really mean outlet? Or just an instance variable? While an  
outlet is an instance variable, not all instance variables are  
outlets...


Still, in either case, just add them to your class definition as  
above.


At the moment all data is presented in a table using an array  
controller. This is fine, but I would like to perform some  
calculations on the same data and present the results in a pop-up  
window. I guess the method described above should be a nice way to  
do this.


Well, see how you go. Not sure why a separate pop-up window seems  
such a good idea, but I guess you're just learning the ropes, so go  
right ahead.


hth,

Graham
___

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/b.beulen%40me.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Window controllers, code obfuscation

2008-08-19 Thread Charles Steinman
--- On Tue, 8/19/08, Sumner Trammell <[EMAIL PROTECTED]> wrote:

> Unless I'm being completely stupid about this, he could
> have done this, right?
> 
> [[[self windowControllers] objectAtIndex:0]
> setShouldCascadeWindows:NO];
>   
> 
> Or better yet, this?
> 
> [aController setShouldCascadeWindows:NO];

Unless there's some really odd, ill-advised NSWindow subclass/category at work 
here, yes. It looks like maybe this method was originally meant to do something 
different, and the second line just got changed rather than rewriting the first 
to be more idiomatic.

Cheers,
Chuck


  
___

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: Question about respondsToSelector

2008-08-19 Thread Carmen Cerino Jr.
Sorry about the sketchy details. Basically I have a wrapper class for  
the Sequence Grabber, and I want to setup a delegate for the  
decompression callback.


This is where I use the respondsToSelector method:
static void SGVideoDecompTrackingCallback(
void *decompressionTrackingRefCon,
OSStatus result,
ICMDecompressionTrackingFlags decompressionTrackingFlags,
CVPixelBufferRef pixelBuffer,
TimeValue64 displayTime,
TimeValue64 displayDuration,
ICMValidTimeFlags validTimeFlags,
void *reserved,
void *sourceFrameRefCon )
{
#pragma unused(reserved)
#pragma unused(sourceFrameRefCon)

SGVideo* sgVideoChan = (SGVideo*)decompressionTrackingRefCon;
id _delegate = sgVideoChan.delegate;

if (result == noErr){

if ([_delegate respondsToSelector:  
@selector(SGDecompDataProc:)]){


[_delegate SGDecompDataProc:pixelBuffer
  trackingFlags:decompressionTrackingFlags
  displayTime:displayTime
  displayDuration:displayDuration
  validTimeFlags:validTimeFlags];
}
}
}


Header file where the function I am checking is prototyped:

@interface VideoController : NSObject {
SeqGrab* mSeqGrab;
SGVideo* mVideoChan;
IBOutlet SampleCIView* mPreview;
}

-(void)SGDecompDataProc: (CVPixelBufferRef)pixelBuffer trackingFlags: 
(ICMDecompressionTrackingFlags)decompressionTrackingFlags displayTime: 
(TimeValue64)displayTime displayDuration:(TimeValue64)displayDuration  
validTimeFlags:(ICMValidTimeFlags)validTimeFlags;



@end

Please let me know if you need to see anything else. Once again I  
apologize for the sketchy details.


Thank you all for your help!

Carmen


On Aug 18, 2008, at 4:39 PM, Andy Lee wrote:

Also: note that method names are case-sensitive, so  
@selector(doSomething) is not the same as @selector(doSomeThing).


Also, if the method you are referring to takes an argument, make  
sure you aren't forgetting the colon at the end.  The name of the  
method contains all its colons; @selector(doSomething) is different  
from @selector(doSomething:).


--Andy



___

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: Question about respondsToSelector

2008-08-19 Thread Jonathan del Strother
On Tue, Aug 19, 2008 at 2:33 PM, Carmen Cerino Jr. <[EMAIL PROTECTED]> wrote:
> Sorry about the sketchy details. Basically I have a wrapper class for the
> Sequence Grabber, and I want to setup a delegate for the decompression
> callback.
>
> This is where I use the respondsToSelector method:
> static void SGVideoDecompTrackingCallback(
>void *decompressionTrackingRefCon,
>OSStatus result,
>ICMDecompressionTrackingFlags decompressionTrackingFlags,
>CVPixelBufferRef pixelBuffer,
>TimeValue64 displayTime,
>TimeValue64 displayDuration,
>ICMValidTimeFlags validTimeFlags,
>void *reserved,
>void *sourceFrameRefCon )
> {
> #pragma unused(reserved)
> #pragma unused(sourceFrameRefCon)
>
>SGVideo* sgVideoChan = (SGVideo*)decompressionTrackingRefCon;
>id _delegate = sgVideoChan.delegate;
>
>if (result == noErr){
>
>if ([_delegate respondsToSelector: @selector(SGDecompDataProc:)]){
>
>[_delegate SGDecompDataProc:pixelBuffer
>  trackingFlags:decompressionTrackingFlags
>  displayTime:displayTime
>  displayDuration:displayDuration
>  validTimeFlags:validTimeFlags];
>}
>}
> }
>
>
> Header file where the function I am checking is prototyped:
>
> @interface VideoController : NSObject {
>SeqGrab* mSeqGrab;
>SGVideo* mVideoChan;
>IBOutlet SampleCIView* mPreview;
> }
>
> -(void)SGDecompDataProc: (CVPixelBufferRef)pixelBuffer
> trackingFlags:(ICMDecompressionTrackingFlags)decompressionTrackingFlags
> displayTime:(TimeValue64)displayTime
> displayDuration:(TimeValue64)displayDuration
> validTimeFlags:(ICMValidTimeFlags)validTimeFlags;
>
>
> @end
>
> Please let me know if you need to see anything else. Once again I apologize
> for the sketchy details.
>
> Thank you all for your help!

Heya - that's not the entire selector.  You want to use :

if ([_delegate respondsToSelector: @selector(SGDecompDataProc:
trackingFlags: displayTime: displayDuration: validTimeFlags:)]) {
...
}
___

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: Question about respondsToSelector

2008-08-19 Thread Carmen Cerino Jr.

*Smacks forehead*

Believe it or not I had that originally and it didn't work. I must of  
had a type-o in the function header that I was passing to  
respondsToSelector.


Thank you all. I am going to go back to making an ass out of myself in  
the privacy of my own home.


Cheers,
Carmen

On Aug 19, 2008, at 9:55 AM, Jonathan del Strother wrote:


GDecompDataProc:
trackingFlags: displayTime: displayDuration: validTimeFlags:


___

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]


Subclassing NSArrayController?

2008-08-19 Thread Chris Poliquin

Hi,

I have an ArrayController in IB to manage an array of NSObjects (a  
custom class) for a TableView.  When a new item is inserted via a  
button connected to insert: a new instance of my class is created and  
appears in the table.  However, I want to be able to control the  
property values of the new object at the time it is created.


So, my class has a property called timeString.  The timeString is  
different for each object and is based on the time showing on a  
stopwatch (NSTextField) when the object is created.  Do I need to  
subclass NSArrayController and override the insert method in order to  
deal with getting this value and assigning it to the object at  
creation or would Key Value Observing in my Controller class be more  
effective?  What is the standard way of doing this?  Perhaps there is  
a way to bind the new object's property to the NSTextField value via  
IB and still make it so it never changes?



Best Regards,
Chris Poliquin
-
[EMAIL PROTECTED]
www.chrispoliquin.com




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Subclassing NSArrayController?

2008-08-19 Thread Ron Lue-Sang
Subclass and override newObject which is declared in  
NSObjectController.h


You can set any properties you like from there.

-
RONZILLA

On Aug 19, 2008, at 7:27 AM, Chris Poliquin <[EMAIL PROTECTED]>  
wrote:



Hi,

I have an ArrayController in IB to manage an array of NSObjects (a  
custom class) for a TableView.  When a new item is inserted via a  
button connected to insert: a new instance of my class is created  
and appears in the table.  However, I want to be able to control the  
property values of the new object at the time it is created.


So, my class has a property called timeString.  The timeString is  
different for each object and is based on the time showing on a  
stopwatch (NSTextField) when the object is created.  Do I need to  
subclass NSArrayController and override the insert method in order  
to deal with getting this value and assigning it to the object at  
creation or would Key Value Observing in my Controller class be more  
effective?  What is the standard way of doing this?  Perhaps there  
is a way to bind the new object's property to the NSTextField value  
via IB and still make it so it never changes?



Best Regards,
Chris Poliquin
-
[EMAIL PROTECTED]
www.chrispoliquin.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/luesang%40apple.com

This email sent to [EMAIL PROTECTED]

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Subclassing NSArrayController?

2008-08-19 Thread Justin Giboney

This is maybe an answer as well as a question.

Doesn't the bindings call the init method when creating a class  
object? Couldn't you just overwrite the init method on your custom  
class to set any necessary values?


Justin Giboney

On Aug 19, 2008, at 8:27 AM, Chris Poliquin wrote:


Hi,

I have an ArrayController in IB to manage an array of NSObjects (a  
custom class) for a TableView.  When a new item is inserted via a  
button connected to insert: a new instance of my class is created  
and appears in the table.  However, I want to be able to control the  
property values of the new object at the time it is created.


So, my class has a property called timeString.  The timeString is  
different for each object and is based on the time showing on a  
stopwatch (NSTextField) when the object is created.  Do I need to  
subclass NSArrayController and override the insert method in order  
to deal with getting this value and assigning it to the object at  
creation or would Key Value Observing in my Controller class be more  
effective?  What is the standard way of doing this?  Perhaps there  
is a way to bind the new object's property to the NSTextField value  
via IB and still make it so it never changes?



Best Regards,
Chris Poliquin
-
[EMAIL PROTECTED]
www.chrispoliquin.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/graphics%40westernbotanicals.com

This email sent to [EMAIL PROTECTED]



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


How to reference a NSDocument from a NSView?

2008-08-19 Thread Jeff Mesnil
Hi,

I'm currently learning Cocoa by reading the 3rd edition of "Cocoa
Programming for Mac OS X".
One of the excercise is to create an application to draw ovals.

I ended up with a project like this:
DrawView is a subclass of NSView which is responsible to draw the ovals
MyDocument is a subclass of NSDocuments which holds a NSMutableArray
of ovals + code to load/save the files

I then created an IBoutlet theDoc in DrawView.h to reference the
instance of MyDocument by connecting the File's Owner.
In DrawView, when the user creates an oval (by creating a NSRect with
the mouse), it calls [theDoc addOval:oval].
And in its -drawRect:, it asks the doc for an array of ovals to draw them.

The application is behaving as expected, the model (the ovals) are
kept in MyDocument and the DrawView just draws them.
But I was wondering if that was the "right" Cocoa way to do so, to use
an IBOutlet to connect a NSView to a NSDocument.
Is there another way to have a reference to the document from one view
of the application?

regards,
jeff

-- 
Jeff Mesnil
[EMAIL PROTECTED]
http://jmesnil.net/weblog/
___

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: best way to determine if portion of window is visible?

2008-08-19 Thread Jason Bobier

Hi Amin,

Unless I am misunderstanding, this would tell me if it was onscreen,  
but not if the window was exposed (not hidden by other windows).


Jason

On Aug 15, 2008, at 5:03 PM, [EMAIL PROTECTED] wrote:


Hey folks,

I'd like to fade my window out if any portion of it is visible to the
user, otherwise I simply want to close it for speed. Is there an easy
way to determine if some portion of the window is visible?
I do not know, whether this is a "dirty" hack (are there clean  
hacks?), but you can read the frames of the screens
http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSScreen_Class/Reference/Reference.html#/ 
/apple_ref/occ/clm/NSScreen/screens


http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSScreen_Class/Reference/Reference.html#/ 
/apple_ref/occ/instm/NSScreen/frame


and clip it with you window frame.

http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSWindow_Class/Reference/Reference.html#/ 
/apple_ref/occ/instm/NSWindow/frame


That probably works.

Cheers,

Amin



Thanks!

Jason
___

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/negm-awad%40cocoading.de

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: best way to determine if portion of window is visible?

2008-08-19 Thread Jason Bobier

Hey Andy,

It's not really the cpu cycles that I'm worried about. It's how  
quickly a large number of windows closes. I'm fading each window for  
1/2 second, in order of appearance. It looks really nice, but there  
isn't really a need to fade the windows that aren't visible and in  
fact, causes it to appear as if nothing is happening if a large number  
of non-exposed windows are faded before the exposed ones are.


Jason

On Aug 15, 2008, at 5:09 PM, Andy Lee wrote:


On Aug 15, 2008, at 2:18 PM, Jason Bobier wrote:
I'd like to fade my window out if any portion of it is visible to  
the user, otherwise I simply want to close it for speed. Is there  
an easy way to determine if some portion of the window is visible?


Offhand I'd say if they can't see it, they can't tell how long it's  
taking to fade away, and I suspect the few extra CPU cycles used for  
the fade would be negligible.


--Andy




___

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: best way to determine if portion of window is visible?

2008-08-19 Thread Jason Bobier

Hi Mike,

I'm using an NSViewAnimation to fade the windows, which I suspect uses  
the alpha channel. A window close is nearly instantaneous, so I'm not  
worried about the tiny window between when I check to see if the  
window is exposed and when it closes.


Of course, because of the transparency of the covering windows, it is  
even more difficult to know whether the window is exposed or not. :-)


Jason

On Aug 15, 2008, at 6:07 PM, Michael Ash wrote:


On Fri, Aug 15, 2008 at 2:18 PM, Jason Bobier <[EMAIL PROTECTED]> wrote:

Hey folks,

I'd like to fade my window out if any portion of it is visible to  
the user,
otherwise I simply want to close it for speed. Is there an easy way  
to

determine if some portion of the window is visible?


If you're fading out the window using setAlphaValue: then it's likely
the window server will realize when your window can't be seen anywhere
and will be smart enough not to redraw anything, saving you from
having to do any work. I don't know if any way to find out for
yourself, and indeed it's kind of tough because the user could easily
expose your window in between your check and the action you take based
on it.

Mike
___

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/jbobier%40mac.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Shared NSTextView

2008-08-19 Thread Douglas Davidson


On Aug 18, 2008, at 9:46 PM, Oleg Krupnov wrote:


I could go the simple and dull way and create a separate instance of
NSTextView for each box, but I am afraid this could be a waste of
resources, because layout manager is costy. Also, most of time I only
need to display text in boxes, not to edit it.


Costly is a relative term.  Do you have thousands of these boxes, or  
only dozens?  There are optimizations that the Cocoa frameworks  
themselves will make, because they have to consider the possibility  
that some application will need them to scale much more than most.   
That doesn't necessarily mean that your application needs to make the  
same sorts of optimizations.


The controls in the framework share text views via the field editor  
mechanism, for example, which helps because we have no idea how many  
controls an app may want to use--furthermore, that mechanism was  
designed at a time when machines had orders of magnitude less in the  
way of resources than they do today.  If there's an easy and simple  
way to do things, but you're worried it might be too costly, I'd  
suggest trying it and using it until measurement shows that it  
actually is too costly.  If you need to optimize, I think that the  
examples people have mentioned should show how to do it.


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: Question about respondsToSelector

2008-08-19 Thread Mike Fischer
Am 19.08.2008 um 15:36 schrieb "Carmen Cerino Jr."  
<[EMAIL PROTECTED]>:



 if ([_delegate respondsToSelector:
@selector(SGDecompDataProc:)]){


The signature of your method seems to be:

SGDecompDataProc:trackingFlags:displayTime:displayDuration:validTimeFlag 
s:


not:

SGDecompDataProc:

So you are testing for the wrong method here.





 [_delegate SGDecompDataProc:pixelBuffer
   trackingFlags:decompressionTrackingFlags
   displayTime:displayTime
   displayDuration:displayDuration
   validTimeFlags:validTimeFlags];



HTH
Mike
--
Mike Fischer Softwareentwicklung, EDV-Beratung
Schulung, Vertrieb
Note: I read this list in digest mode!
  Send me a private copy for faster responses.

___

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: Including frameworks in your app bundle

2008-08-19 Thread Mark Allan
I've been searching, but I can't find the documentation explaining 
how to include frameworks in your app bundle (third-party 
frameworks, for example), so that your user does not have to 
install these frameworks. Could someone point me at the correct 
documentation/build settings? Thanks.


This is probably better for the XCode group, but check out this document:

http://developer.apple.com/documentation/MacOSX/Conceptual/BPFrameworks/Tasks/CreatingFrameworks.html

It explains what you need to do to embed frameworks in your application.

HTH, J


As a shortcut to what you need, this website makes it very clear how 
to embed someone else's framework in your application.


http://rentzsch.com/cocoa/embeddedFrameworks

Mark

___

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: How to reference a NSDocument from a NSView?

2008-08-19 Thread Jeff Mesnil
On Tue, Aug 19, 2008 at 1:37 PM, Jeff Mesnil <[EMAIL PROTECTED]> wrote:
> The application is behaving as expected, the model (the ovals) are
> kept in MyDocument and the DrawView just draws them.
> But I was wondering if that was the "right" Cocoa way to do so, to use
> an IBOutlet to connect a NSView to a NSDocument.
> Is there another way to have a reference to the document from one view
> of the application?

Answering my own question, my use case is similar to the Sketch
example bundled with XCode.

In Sketch, they use KVC to observe an NSArrayController.
I did the same by calling bind:toObject:withKeyPath:options:  in
MyDocument windowControllerDidLoadNib: method and it works.

To sum up, I've seen 3 different ways to write this code:
- use an IBOutlet to reference the NSDocument from a NSView
- use [[[self window] windowController] document] from a NSView
(thanks Chaitanya!)
- forget about the NSDocument and use KVC to directly observe the ovals

Using the KVC seems the most natural way to do that in Cocoa.

jeff

-- 
Jeff Mesnil
[EMAIL PROTECTED]
http://jmesnil.net/weblog/
___

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]


NSATSTypesetter Line computation problem

2008-08-19 Thread chaitanya pandit
In my application i use a custom text container to lay text around a  
hole, the problem occurs when i have two holes side by side.
In this case the line would be broken down in to three line fragments.  
The problem occurs when the rightmost fragment has bigger font than  
the ones on the left.


I lhave overridden NSATSTypesetter's
"getLineFragmentRect: usedRect: remainingRect:  
forStartingGlyphAtIndex: proposedRect: lineSpacing:  
paragraphSpacingBefore: paragraphSpacingAfter: " method

and i just log the rectangle values after i call super

This is the first case where the first line has no intersecting holes,  
it behaves fine

Here is the log for the same:

2008-08-19 13:01:04.952 testApp[6033:813] Logging Rect Info...
2008-08-19 13:01:04.953 testApp[6033:813] Proposed Rect: {{0, 0}, {1e 
+07, 11}}
2008-08-19 13:01:04.954 testApp[6033:813] LineFragment Rect: {{0, 0},  
{482, 11}}
2008-08-19 13:01:04.960 testApp[6033:813] Remaining Rect: {{0, 0}, {0,  
0}}

2008-08-19 13:01:04.963 testApp[6033:813] 
2008-08-19 13:01:04.964 testApp[6033:813] Logging Rect Info...
2008-08-19 13:01:04.969 testApp[6033:813] Proposed Rect: {{0, 11}, {1e 
+07, 11}}
2008-08-19 13:01:04.972 testApp[6033:813] LineFragment Rect: {{0, 11},  
{110.664, 11}}
2008-08-19 13:01:04.979 testApp[6033:813] Remaining Rect: {{190.664,  
11}, {291.336, 11}}

2008-08-19 13:01:04.979 testApp[6033:813] 
2008-08-19 13:01:04.980 testApp[6033:813] Logging Rect Info...
2008-08-19 13:01:04.982 testApp[6033:813] Proposed Rect: {{0, 11}, {1e 
+07, 106}}
2008-08-19 13:01:04.982 testApp[6033:813] LineFragment Rect: {{0, 11},  
{30.6669, 106}}
2008-08-19 13:01:04.983 testApp[6033:813] Remaining Rect: {{110.667,  
11}, {371.333, 106}}

2008-08-19 13:01:04.983 testApp[6033:813] 
2008-08-19 13:01:04.984 testApp[6033:813] Logging Rect Info...
2008-08-19 13:01:04.984 testApp[6033:813] Proposed Rect: {{0, 11}, {1e 
+07, 106}}
2008-08-19 13:01:04.985 testApp[6033:813] LineFragment Rect: {{0, 11},  
{30.6669, 106}}
2008-08-19 13:01:04.985 testApp[6033:813] Remaining Rect: {{110.667,  
11}, {371.333, 106}}

2008-08-19 13:01:04.986 testApp[6033:813] 
2008-08-19 13:01:04.986 testApp[6033:813] Logging Rect Info...
2008-08-19 13:01:04.987 testApp[6033:813] Proposed Rect: {{0, 11}, {1e 
+07, 106}}
2008-08-19 13:01:04.987 testApp[6033:813] LineFragment Rect: {{0, 11},  
{30.6669, 106}}
2008-08-19 13:01:04.988 testApp[6033:813] Remaining Rect: {{110.667,  
11}, {371.333, 106}}

2008-08-19 13:01:04.988 testApp[6033:813] 
2008-08-19 13:01:04.989 testApp[6033:813] Logging Rect Info...
2008-08-19 13:01:04.990 testApp[6033:813] Proposed Rect: {{110.667,  
11}, {1e+07, 11}}
2008-08-19 13:01:04.990 testApp[6033:813] LineFragment Rect:  
{{190.664, 11}, {291.336, 106}}
2008-08-19 13:01:04.991 testApp[6033:813] Remaining Rect: {{0, 0}, {0,  
0}}

2008-08-19 13:01:04.991 testApp[6033:813] 
2008-08-19 13:01:04.993 testApp[6033:813] Logging Rect Info...
2008-08-19 13:01:04.993 testApp[6033:813] Proposed Rect: {{190.664,  
11}, {1e+07, 106}}
2008-08-19 13:01:04.994 testApp[6033:813] LineFragment Rect:  
{{190.665, 11}, {291.336, 106}}
2008-08-19 13:01:04.994 testApp[6033:813] Remaining Rect: {{0, 0}, {0,  
0}}

2008-08-19 13:01:04.995 testApp[6033:813] 

The problem occurs when the hole in the centre is moved op and  
intersects with the first line

Log for this is:

2008-08-19 13:04:13.884 testApp[6033:813] Logging Rect Info...
2008-08-19 13:04:13.885 testApp[6033:813] Proposed Rect: {{0, 0}, {1e 
+07, 11}}
2008-08-19 13:04:13.886 testApp[6033:813] LineFragment Rect: {{0, 0},  
{110.664, 11}}
2008-08-19 13:04:13.886 testApp[6033:813] Remaining Rect: {{190.664,  
0}, {291.336, 11}}

2008-08-19 13:04:13.887 testApp[6033:813] 
2008-08-19 13:04:13.891 testApp[6033:813] Logging Rect Info...
2008-08-19 13:04:13.891 testApp[6033:813] Proposed Rect: {{190.664,  
0}, {1e+07, 11}}
2008-08-19 13:04:13.892 testApp[6033:813] LineFragment Rect:  
{{190.664, 0}, {291.336, 11}}
2008-08-19 13:04:13.892 testApp[6033:813] Remaining Rect: {{0, 0}, {0,  
0}}

2008-08-19 13:04:13.892 testApp[6033:813] 
2008-08-19 13:04:13.893 testApp[6033:813] Logging Rect Info...
2008-08-19 13:04:13.894 testApp[6033:813] Proposed Rect: {{0, 11}, {1e 
+07, 11}}
2008-08-19 13:04:13.894 testApp[6033:813] LineFragment Rect: {{0, 11},  
{110.664, 11}}
2008-08-19 13:04:13.894 testApp[6033:813] Remaining Rect: {{190.664,  
11}, {291.336, 11}}

2008-08-19 13:04:13.895 testApp[6033:813] 
2008-08-19 13:04:13.895 testApp[6033:813] Logging Rect Info...
2008-08-19 13:04:13.896 testApp[6033:813] Proposed Rect: {{190.664,  
11}, {1e+07, 11}}
2008-08-19 13:04:13.896 testApp[6033:813] LineFragment Rect:  
{{190.664, 11}, {291.336, 11}}
2008-08-19 13:04:13.899 testApp[6033:813] Remaining Rect: {{0, 0}, {0,  
0}}

2008-08-19 13:04:13.909 te

Best Way to Handle Properties?

2008-08-19 Thread Dave

Hi,

I'm new to Cocoa and a little confused about the best way to handle  
the following:


I'm converting a C based application to Object-C/Cocoa. One of the  
objects is used to hold properties which are loaded from a data file.  
I have created an object to represent the C Structure as so:


@interface PersonDetails : NSObject
{
NSString*   FirstName;
NSString*   LastName;

UInt32  DateOfBirth;
UInt32  Height;
}

(This is a cut down version of the real object).

@property(assign,readwrite) NSString*   FirstName;
@property(assign,readwrite) NSString*   LastName;

@property(assign,readwrite) UInt32  DateOfBirth;
@property(assign,readwrite) UInt32  Height;

The implementation second declares these as "dynamic" (since I may  
need to "massage" the data after/before getting/setting the object  
member).


- (NSString*) FirstName ;
- (void) setmFirstName :theNewValue;

- (NSString*) LastName ;
- (void) setLastName :theNewValue;

- (UInt32) DateOfBirth ;
- (void) DateOfBirth :theNewValue;

- (UInt32) Height ;
- (void) Height :theNewValue;


Here are my questions:

1. The strings are read in from a file into a malloc() buffer and are  
in a non-standard format.


I have a routine that reads strings from the file, converts them to  
Unicode in the provided buffer. This function is already written (in  
C) and I'd rather not touch it unless I have to. So I end up with a  
straight char* buffer containing Unicode characters, I now what to  
store them in an NSString inside the object, and that's where I'm not  
sure of the best way of doing it.


The outer loop of the code looks like this (in pseudo code):

PersonDetails*  myPresonDetails;

myPresonDetails = [[PersonDetails alloc] init];

while (myCount > 0)
{
 //Reads a string from the file and places the size in  
"myStringSize" and the unicode data in "myBufferPtr"

ReadPersonString("First",&myStringSize,myBufferPtr);

//
//  This is the first bit I am not sure of.
//  
	[myPersonDetails setFirstName:[[NSString alloc] initWithCharacters:  
myBufferPtr length: myStringSize]];


//
//  Do Stuff with myPersonDetails
//

//
//  This is the second bit I am not sure of.
//  Reset (free) the NSString Buffers
//
[myPersonDetails Reset];

   myCount--;
}

My specific questions are:

Is the NSString allocation and initWithCharacters code the best way  
to do this? If so, what would the setter look like in this case? If  
not what is a better way of doing it?


in the: [myPersonDetails Reset]; method I was going to release all  
the strings and zero out the integers. But I was wondering if it  
would be better to allocate and release the object each time in the  
while() loop. If I did this, would I need to define a release method  
in myPersonDetails or would the standard method release the strings  
for me?


Thanks in advance
All the Best
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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Deploying project as backward compatible

2008-08-19 Thread Nick Zitzmann


On Aug 19, 2008, at 12:39 AM, [EMAIL PROTECTED] wrote:


How can I build application as backward compatible.



Usually if an app wouldn't launch, the reason why it wasn't launchable  
is printed to the system console. Can you open Console.app and tell us  
the error that gets printed when you try to launch your app on Tiger?


Nick Zitzmann


___

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: Best Way to Handle Properties?

2008-08-19 Thread Jason Coco


On Aug 19, 2008, at 13:02 , Dave wrote:


My specific questions are:

Is the NSString allocation and initWithCharacters code the best way  
to do this? If so, what would the setter look like in this case? If  
not what is a better way of doing it?


Hey Dave,

I don't think that initWithCharacters is what you want... that expects  
an array of unichar characters, which isn't what you said you had.  
Since you're doing the encoding in your other function, and you know  
what it is, just use the initWithBytes function and the specific  
encoding. For example (assuming your byte array was in UTF-16BE:


char *buf = /* initialized and filled somewhere else */
size_t buf_len = /* set somewhere else */

NSString *myString = [[NSString alloc] initWithBytes:buf  
length:buf_len encoding:NSUTF16BigEndianStringEncoding];


Just remember, the length is the actual number of bytes (including the  
0x00 bytes in the array), not the number of code points or the number  
of characters.


/Jason

smime.p7s
Description: S/MIME cryptographic signature
___

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: How to reference a NSDocument from a NSView?

2008-08-19 Thread Scott Anguish


On 19-Aug-08, at 12:52 PM, Jeff Mesnil wrote:

On Tue, Aug 19, 2008 at 1:37 PM, Jeff Mesnil <[EMAIL PROTECTED]>  
wrote:

The application is behaving as expected, the model (the ovals) are
kept in MyDocument and the DrawView just draws them.
But I was wondering if that was the "right" Cocoa way to do so, to  
use

an IBOutlet to connect a NSView to a NSDocument.
Is there another way to have a reference to the document from one  
view

of the application?


Answering my own question, my use case is similar to the Sketch
example bundled with XCode.

In Sketch, they use KVC to observe an NSArrayController.
I did the same by calling bind:toObject:withKeyPath:options:  in
MyDocument windowControllerDidLoadNib: method and it works.

To sum up, I've seen 3 different ways to write this code:
- use an IBOutlet to reference the NSDocument from a NSView
- use [[[self window] windowController] document] from a NSView
(thanks Chaitanya!)
- forget about the NSDocument and use KVC to directly observe the  
ovals


Using the KVC seems the most natural way to do that in Cocoa.



I think all three are actually very valid.

although everywhere you've said KVC above needs to e replaced with  
KVO. :-)




___

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]


Receiving mouseEnter and mouseExit events.

2008-08-19 Thread David Alter
I'm a little confused on the mouse tracking. I have a view and I want  
to track when the mouse enters and exits it. If I set  
setAcceptsMouseMovedEvents to true for my window, (void)mouseMoved: 
(NSEvent *)theEvent will get called. But, - (void)mouseEntered: 
(NSEvent *)theEvent and - (void)mouseExited:(NSEvent *)theEvent will  
not. Am I correct in my understanding that I need to create a  
NSTrackingArea for these events to get called?


thanks for the help
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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Receiving mouseEnter and mouseExit events.

2008-08-19 Thread Quincey Morris

On Aug 19, 2008, at 12:04, David Alter wrote:

I'm a little confused on the mouse tracking. I have a view and I  
want to track when the mouse enters and exits it. If I set  
setAcceptsMouseMovedEvents to true for my window, (void)mouseMoved: 
(NSEvent *)theEvent will get called. But, - (void)mouseEntered: 
(NSEvent *)theEvent and - (void)mouseExited:(NSEvent *)theEvent will  
not. Am I correct in my understanding that I need to create a  
NSTrackingArea for these events to get called?


Yes, create a tracking area, but *don't* setAcceptsMouseMovedEvents:YES.

Both mechanisms result in mouseMoved events, but you only want the  
events produced by the tracking area. (Well, you may not want  
mouseMoved events at all, just mouseEntered and mouseExited, but you  
tell the tracking area which of its possible events you want.)



___

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: document based app, custom ibaction

2008-08-19 Thread Jonathan Hess

Hey Bart -

Understanding the "File's Owner" is really an essential part of  
understanding how to use Interface Builder effectively. At the most  
basic level, all NIBs are loaded at runtime with a call to -[NSBundle  
loadNibNamed:owner:]. The method takes two arguments, a NIB name which  
is the NIB file to load, and an owner, which is the object doing the  
loading. The "File's Owner", represented by the blue cube in Interface  
Builder, is a placeholder object that represents the 'owner' that will  
be passed in at runtime. The File's Owner is a way for you to refer to  
objects inside of your NIB file from objects outside of your NIB file.  
When you load the nib at runtime, the blue cube placeholder in  
Interface Builder is resolved to the owner object you pass into the  
NIB loading method, and all of the connects you made to the  
placeholder are made to the owner you passed in instead.


Most NIB files on Mac OS X are loaded for you by various Cocoa  
classes. NSApplication, NSDocument, NSWindowController, and  
NSViewController all load nib files for you, and they each pass 'self'  
in as the parameter to -[NSBundle loadNibNamed:owner:]. This is why  
your document is represented as the File's Owner for your document NIB.


As an exercise, you might try design your sheet in its own NIB file,  
and then from your MyDocument class, when it's time to show the sheet,  
invoke "-[NSBundle loadNibNamed:owner:]", and pass 'self' as the  
owner. This might help clear up the concept.


After you've mastered the File's Owner, the First Responder is the  
last difficult concept -

Jon Hess

On Aug 19, 2008, at 6:07 AM, Bart Beulen wrote:

Sorry, didn't know I had to connect the outlets of the mydocument  
class through file owner This basically solved my problems.


Op 19 aug 2008, om 14:03 heeft Graham Cox het volgende geschreven:



On 19 Aug 2008, at 7:03 pm, Bart wrote:


Another similar problem.

I would like to add a sheet to the button I've created. Normally I  
would create an IBOutlet and connect the window for the sheet to  
it, combined with a code to open: 	


[NSApp beginSheet:totalsSheet
   modalForWindow:[NSApp mainWindow]
modalDelegate:self
   didEndSelector:NULL
  contextInfo:NULL];

and close it:

[NSApp endSheet:totalsSheet];
[totalsSheet orderOut:sender];

However, is this possible when using a mydocument class, because I  
cannot find any outlets in the interface builder


So, add the outlets you need to the class. It is called  
*MY*document after all - it's yours ;-)


e.g. in MyDocument.h, add the instance variable:

IBOutlet id mySheetWindow;

and this will show up in IB for you to connect to.

(This probably isn't the time to get into handling this in a  
separate controller class, but you may want to revisit this  
question when you get the hang of it a bit more).


I would also like to create some seperate outlets for displaying  
some float values from some variables of the mydocument class,  
this is a similar problems since I don't know where to find the  
outlets to connect the GUI elements to.


Do you really mean outlet? Or just an instance variable? While an  
outlet is an instance variable, not all instance variables are  
outlets...


Still, in either case, just add them to your class definition as  
above.


At the moment all data is presented in a table using an array  
controller. This is fine, but I would like to perform some  
calculations on the same data and present the results in a pop-up  
window. I guess the method described above should be a nice way to  
do this.


Well, see how you go. Not sure why a separate pop-up window seems  
such a good idea, but I guess you're just learning the ropes, so go  
right ahead.


hth,

Graham
___

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/b.beulen%40me.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/jhess%40apple.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


NSTableColumn not usable with binder of class NSTextValueBinder?

2008-08-19 Thread Dave Dribin

Hello,

When I hit the "Delete" key in one of my table views, I get the  
following error logged to the console:


Object  is not usable with binder of class  
NSTextValueBinder


I also don't get the typical "Beep" that happens when a key press goes  
off the end of the responder chain.  What does this error mean? Have I  
messed up my bindings somehow?  The bindings seem to be working just  
fine, though.


I'm using Xcode 3.1 and the 10.5 SDK.

Thanks,

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

This email sent to [EMAIL PROTECTED]


Re: Using Flex/Lex in a Cocoa project

2008-08-19 Thread Ricky Sharp


On Aug 18, 2008, at 10:57 PM, Michael Ash wrote:


Note that depending on what kind of results you want, even if all of
your data is within the BMP, this *still* won't save you.

As a really basic example, consider a simple, obvious character like
é. (That's an e with an acute accent on it if you're having unicode
trouble in your e-mail client.) That can be represented as two
separate unicode code points, a plain old ASCII e followed by a
combining accent mark. If you should happen to split the string on the
accent mark, such that the e goes into the first half and the
combining accent mark goes into the second half, you get a really
unintuitive result. What appears to the user to be a single character
gets suddenly blown in two. Worse, if you happen to insert a string in
the middle, you could end up applying that acute accent to some
*other* letter instead.


Sorry, failed to mention that our UTF-16BE data was also normalized to  
pre-composed Unicode.  So this case was handled.


You mentioned Korean (which I have yet to play around with), but for  
another grand 'ol time, try Arabic.  You get into something called  
"positional variants".  But alas, that's outside the scope of this list.


I think the moral of the story here is that when working with Unicode  
data, it's best to normalize such data and then ensure APIs operating  
on the data are Unicode savvy.


Thankfully, as you've pointed out, the NSString etc. APIs shield folks  
from much of the gory details.


___
Ricky A. Sharp mailto:[EMAIL PROTECTED]
Instant Interactive(tm)   http://www.instantinteractive.com



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: NSTableColumn not usable with binder of class NSTextValueBinder?

2008-08-19 Thread Dave Dribin

On Aug 19, 2008, at 3:27 PM, Dave Dribin wrote:

Hello,

When I hit the "Delete" key in one of my table views, I get the  
following error logged to the console:


Object  is not usable with binder of class  
NSTextValueBinder


Further information: I have one column with a custom NSCell subclass.   
However, in IB, this column's cell is an NSTextFieldCell, and I  
replace the cell in awakeFromNib.  I don't see a way to set the  
column's cell to a direct NSCell subclass in IB.


As a test, I changed my custom cell to subclass NSTextFieldCell  
instead of NSCell and the console error goes away and the "Delete" key  
actually deletes the row.  But this seems wrong as it's not displaying  
any text, though.


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

This email sent to [EMAIL PROTECTED]


Re: Receiving mouseEnter and mouseExit events.

2008-08-19 Thread David Alter
I just realized that NSTrackingArea is 10.5 and up. I need to support  
10.4. mouseEntered and mouseExited have been part of NSResponder from  
10.0. To receive these events in 10.4 what should I do?


thanks
-dave

On Aug 19, 2008, at 12:55 PM, Quincey Morris wrote:


On Aug 19, 2008, at 12:04, David Alter wrote:

I'm a little confused on the mouse tracking. I have a view and I  
want to track when the mouse enters and exits it. If I set  
setAcceptsMouseMovedEvents to true for my window, (void)mouseMoved: 
(NSEvent *)theEvent will get called. But, - (void)mouseEntered: 
(NSEvent *)theEvent and - (void)mouseExited:(NSEvent *)theEvent  
will not. Am I correct in my understanding that I need to create a  
NSTrackingArea for these events to get called?


Yes, create a tracking area, but *don't*  
setAcceptsMouseMovedEvents:YES.


Both mechanisms result in mouseMoved events, but you only want the  
events produced by the tracking area. (Well, you may not want  
mouseMoved events at all, just mouseEntered and mouseExited, but you  
tell the tracking area which of its possible events you want.)



___

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/david%40alterconsulting.net

This email sent to [EMAIL PROTECTED]



www.AlterConsulting.net
510-868-0916 Office
510-435-4391 Mobile

___

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: Receiving mouseEnter and mouseExit events.

2008-08-19 Thread David Alter

Figured it out. I just need to use

addTrackingRect:owner:userData:assumeInside

enjoy
-dave

On Aug 19, 2008, at 2:50 PM, David Alter wrote:

I just realized that NSTrackingArea is 10.5 and up. I need to  
support 10.4. mouseEntered and mouseExited have been part of  
NSResponder from 10.0. To receive these events in 10.4 what should I  
do?


thanks
-dave

On Aug 19, 2008, at 12:55 PM, Quincey Morris wrote:


On Aug 19, 2008, at 12:04, David Alter wrote:

I'm a little confused on the mouse tracking. I have a view and I  
want to track when the mouse enters and exits it. If I set  
setAcceptsMouseMovedEvents to true for my window, (void)mouseMoved: 
(NSEvent *)theEvent will get called. But, - (void)mouseEntered: 
(NSEvent *)theEvent and - (void)mouseExited:(NSEvent *)theEvent  
will not. Am I correct in my understanding that I need to create a  
NSTrackingArea for these events to get called?


Yes, create a tracking area, but *don't*  
setAcceptsMouseMovedEvents:YES.


Both mechanisms result in mouseMoved events, but you only want the  
events produced by the tracking area. (Well, you may not want  
mouseMoved events at all, just mouseEntered and mouseExited, but  
you tell the tracking area which of its possible events you want.)



___

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/david%40alterconsulting.net

This email sent to [EMAIL PROTECTED]



www.AlterConsulting.net
510-868-0916 Office
510-435-4391 Mobile

___

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/david%40alterconsulting.net

This email sent to [EMAIL PROTECTED]



www.AlterConsulting.net
510-868-0916 Office
510-435-4391 Mobile

___

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: NSTableColumn not usable with binder of class NSTextValueBinder?

2008-08-19 Thread Corbin Dunn


On Aug 19, 2008, at 2:20 PM, Dave Dribin wrote:


On Aug 19, 2008, at 3:27 PM, Dave Dribin wrote:

Hello,

When I hit the "Delete" key in one of my table views, I get the  
following error logged to the console:


Object  is not usable with binder of class  
NSTextValueBinder


Further information: I have one column with a custom NSCell  
subclass.  However, in IB, this column's cell is an NSTextFieldCell,  
and I replace the cell in awakeFromNib.  I don't see a way to set  
the column's cell to a direct NSCell subclass in IB.


You can in IB3; just double click on the cell...then set the class.

Otherwise, you have to manually set up your binding in code after you  
set the [tableColumn dataCell]. The binding is specific to the cell  
type. If you need a code example, I can dig one up.


corbin

___

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]


From JavaMail to Cocoa?

2008-08-19 Thread Christophe Bismuth
Dear community,
I've developed a Java application using JavaMail library to get my Gmail
messages using IMAP.
I'd like to switch my code from Java to Cocoa, is there any official Apple
Cocoa API for IMAP? Are Mail API published?

Thank you,
Christophe
___

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]


Calling an object from a C function

2008-08-19 Thread Gilbert Mackall



I have a C function from which I would like to call a method. I can't  
find any documents the cover how to do this.

___

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: NSTableColumn not usable with binder of class NSTextValueBinder?

2008-08-19 Thread Dave Dribin

On Aug 19, 2008, at 5:19 PM, Corbin Dunn wrote:

You can in IB3; just double click on the cell...then set the class.


It's not letting me set it to my custom cell.  It just beeps (IB  
version 3.1, build 670).  I think this is because the column is setup  
a text field cell, and it will only let me set the class to an  
NSTextFieldCell subclass.  There's no plain NSCell in the Library from  
what I can find.


Otherwise, you have to manually set up your binding in code after  
you set the [tableColumn dataCell]. The binding is specific to the  
cell type. If you need a code example, I can dig one up.


Just tried that, too, and now I get the following error in the console  
(with -NSBindingDebugLogLevel 1):


Cocoa Bindings: Error accessing bound property value of object  
: [  
valueForUndefinedKey:]: this class is not key value coding-compliant  
for the key value.


Here's my code, which looks very similar to the ManualBindings sample  
code:


[column bind:@"value"
toObject:controller
 withKeyPath:@"arrangedObjects.whatever"
 options:nil];

Again, what's strange is if I change my cell's superclass to be  
NSTextFieldCell, this bind: call does not give an error and it all  
works.  I also tried subclassing NSActionCell, and that works, too.   
Is my cell not implementing some method that bindings expects to be  
there?  Something that is implemented in NSActionCell?


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

This email sent to [EMAIL PROTECTED]


Re: From JavaMail to Cocoa?

2008-08-19 Thread Scott Anguish


On 19-Aug-08, at 4:29 PM, Christophe Bismuth wrote:


Dear community,
I've developed a Java application using JavaMail library to get my  
Gmail

messages using IMAP.
I'd like to switch my code from Java to Cocoa, is there any official  
Apple

Cocoa API for IMAP? Are Mail API published?


Unfortunately there is no Apple provided Objective-C API for IMAP.  I  
think most developers look at using Pantomime 


The message sending API we had was not very useful and has been  
deprecated.



___

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: Calling an object from a C function

2008-08-19 Thread Kenny Leung

Hi Gilbert.

You just have to make sure that your C function is in a .m file (not  
a .c file) and have the proper header included. Then you just call the  
method.


-Kenny


On Aug 19, 2008, at 2:53 PM, Gilbert Mackall wrote:




I have a C function from which I would like to call a method. I  
can't find any documents the cover how to do this.

___

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/kenny_leung%40pobox.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Calling an object from a C function

2008-08-19 Thread David Duncan

On Aug 19, 2008, at 2:53 PM, Gilbert Mackall wrote:

I have a C function from which I would like to call a method. I  
can't find any documents the cover how to do this.


You call it just like you call any other method. Your C function will  
need to be compiled with the Obj-C compiler however. Easiest way to do  
this is to name the source file with a .m extension.

--
David Duncan
Apple DTS Animation and Printing

___

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: IKImageBrowser drag reordering question/problem

2008-08-19 Thread thomas goossens

Sorry, mail trashed the content of my email. re-sending it.


Hi c.

When using IKImageBrowserPathRepresentationType or  
IKImageBrowserNSURLRepresentationType, ImageKit automatically fill the  
pasteboard for you for convenience when you start a drag.
If you use another representation you will have to fill the pasteboard  
yourself when the delegate method
- (NSUInteger) imageBrowser:(IKImageBrowserView *) aBrowser  
writeItemsAtIndexes:(NSIndexSet *) itemIndexes toPasteboard: 
(NSPasteboard *)pasteboard;   is invoked.


-- Thomas.


On Aug 2, 2008, at 7:20 AM, c. mendoza wrote:


Hey All,

I've successfully managed to use an IKImageBrowser in an app I am  
developing. My IKImageBrowserItem imageRepresentationType is 
IKImageBrowserPathRepresentationType, and everything works as  
advertised: I can drag-reorder and delete the images. However, when  
I try to use IKImageBrowserNSImageRepresentationType, the images are  
displayed and I can delete them, but I can no longer drag-reorder  
them. This is a real pain, because it means that I have to have all  
of the images I am using in the filesystem, instead of just in  
memory as NSImages. Now the question, is this a "feature" or a bug?  
I should add that I am newbie at Cocoa, and I am very impressed with  
it so far.


thanks,

c.


___

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/tgoossens%40mac.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Calling an object from a C function

2008-08-19 Thread Charlie Dickman

What is the syntax? For example, how do I invoke the method

- (int) myMethod: (int) int;

In object myObject

from within a C (not Objective C) function and make use of the result?

In Objective C I would invoke

[myObject myMethod: myInt];

Even better, how do I invoke

- (myObject) myMethod: (myObject *) myObjectArg;

an make use of the result in a C function?

On Aug 19, 2008, at 6:52 PM, David Duncan wrote:


On Aug 19, 2008, at 2:53 PM, Gilbert Mackall wrote:

I have a C function from which I would like to call a method. I  
can't find any documents the cover how to do this.


You call it just like you call any other method. Your C function  
will need to be compiled with the Obj-C compiler however. Easiest  
way to do this is to name the source file with a .m extension.

--
David Duncan
Apple DTS Animation and Printing

___

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/3tothe4th%40comcast.net

This email sent to [EMAIL PROTECTED]


Charlie Dickman
[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: Calling an object from a C function

2008-08-19 Thread David Duncan

On Aug 19, 2008, at 4:28 PM, Charlie Dickman wrote:


from within a C (not Objective C) function and make use of the result?

In Objective C I would invoke

[myObject myMethod: myInt];



You invoke it exactly the same way. There is no difference. But you  
need to compile as Obj-C.


int foo(id bar) { [bar foobaz]; }
--
David Duncan
Apple DTS Animation and Printing

___

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: Calling an object from a C function

2008-08-19 Thread Kenny Leung

Example:

void cFunction(MyObject *myObject) {
int myInt;
int result;

myInt = initializeMyInt();
result = [myObject myMethod:myInt];
printf("result:%i", result);
}

On Aug 19, 2008, at 4:28 PM, Charlie Dickman wrote:


What is the syntax? For example, how do I invoke the method

- (int) myMethod: (int) int;

In object myObject

from within a C (not Objective C) function and make use of the result?

In Objective C I would invoke

[myObject myMethod: myInt];

Even better, how do I invoke

- (myObject) myMethod: (myObject *) myObjectArg;

an make use of the result in a C function?

On Aug 19, 2008, at 6:52 PM, David Duncan wrote:


On Aug 19, 2008, at 2:53 PM, Gilbert Mackall wrote:

I have a C function from which I would like to call a method. I  
can't find any documents the cover how to do this.


You call it just like you call any other method. Your C function  
will need to be compiled with the Obj-C compiler however. Easiest  
way to do this is to name the source file with a .m extension.

--
David Duncan
Apple DTS Animation and Printing

___

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/3tothe4th%40comcast.net

This email sent to [EMAIL PROTECTED]


Charlie Dickman
[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/kenny_leung%40pobox.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Calling an object from a C function

2008-08-19 Thread mm w
did you mean: (im not sure to understand your problem) ???!!!

#import 

int foo(int a, int b) {
return (a + b);
}

@interface myObject: NSObject

-(SInt32)aIntegertFunction:(SInt32)a plus:(SInt32)b;

@end

@implementation myObject

-(SInt32)aIntegertFunction:(SInt32)a plus:(SInt32)b
{
  return foo(a,b);
}

@end

int main (
  int argc, const char * argv[])
{
  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
  myObject *obj = [[myObject alloc] init];

  NSLog(@" %i", [obj aIntegertFunction:10 plus:10]);

  [obj release];

  [pool drain];

  return 0;
}

On Tue, Aug 19, 2008 at 4:38 PM, David Duncan <[EMAIL PROTECTED]> wrote:
> On Aug 19, 2008, at 4:28 PM, Charlie Dickman wrote:
>
>> from within a C (not Objective C) function and make use of the result?
>>
>> In Objective C I would invoke
>>
>> [myObject myMethod: myInt];
>
>
> You invoke it exactly the same way. There is no difference. But you need to
> compile as Obj-C.
>
> int foo(id bar) { [bar foobaz]; }
> --
> David Duncan
> Apple DTS Animation and Printing
>
> ___
>
> 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/openspecies%40gmail.com
>
> This email sent to [EMAIL PROTECTED]
>



-- 
-mmw
___

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: Calling an object from a C function

2008-08-19 Thread Kiel Gillard
Hi Charlie,
The format is like any normal C function.

int MyStaticCFunction(int someArg) {

//invoke myMethod and return the int the myMethod returns
return [objcObject myMethod:someArg];
}

You wrote:

What is the syntax? For example, how do I invoke the method

- (int) myMethod: (int) int;

In object myObject

from within a C (not Objective C) function and make use of the result?


There are no Objective-C functions. Only C functions. There are Objective-C
methods.

In Objective C I would invoke

[myObject myMethod: myInt];

Even better, how do I invoke

- (myObject) myMethod: (myObject *) myObjectArg;

an make use of the result in a C function?


MyObject * MyStaticCFunction(MyObject *myObjectArg) {

//assuming MyObject is an Objective C instance
[myObjectArg myMethod:myObjectArg];
return myObjectArg;
}

Hope this helps,

Kiel
___

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: NSTableColumn not usable with binder of class NSTextValueBinder?

2008-08-19 Thread Corbin Dunn


On Aug 19, 2008, at 3:47 PM, Dave Dribin wrote:


On Aug 19, 2008, at 5:19 PM, Corbin Dunn wrote:

You can in IB3; just double click on the cell...then set the class.


It's not letting me set it to my custom cell.  It just beeps (IB  
version 3.1, build 670).  I think this is because the column is  
setup a text field cell, and it will only let me set the class to an  
NSTextFieldCell subclass.  There's no plain NSCell in the Library  
from what I can find.


Yeah, your correct; please log a bug on this and we will try to fix  
it. A "hacky" workaround is to temporarily subclass NSTextFieldCell,  
then set it in iB, then undo the change. But, the binder will probably  
be wrong...so that doesn't help you too much.





Otherwise, you have to manually set up your binding in code after  
you set the [tableColumn dataCell]. The binding is specific to the  
cell type. If you need a code example, I can dig one up.


Just tried that, too, and now I get the following error in the  
console (with -NSBindingDebugLogLevel 1):


Cocoa Bindings: Error accessing bound property value of object  
: [  
valueForUndefinedKey:]: this class is not key value coding-compliant  
for the key value.


Here's my code, which looks very similar to the ManualBindings  
sample code:


   [column bind:@"value"
   toObject:controller
withKeyPath:@"arrangedObjects.whatever"
options:nil];

Again, what's strange is if I change my cell's superclass to be  
NSTextFieldCell, this bind: call does not give an error and it all  
works.  I also tried subclassing NSActionCell, and that works, too.   
Is my cell not implementing some method that bindings expects to be  
there?  Something that is implemented in NSActionCell?


I'm not aware of any specific code for it; NSActionCell is a very  
simple subclass. Maybe the bindings code looks for that class  
specifically, in order to know when values change.


thanks,
corbin
___

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: Calling an object from a C function

2008-08-19 Thread Charlie Dickman
Thanks to all who responded. I must have had a mental block against  
this.


Now, how do I define things like 'self' and 'super' to a C program?

On Aug 19, 2008, at 7:38 PM, David Duncan wrote:


On Aug 19, 2008, at 4:28 PM, Charlie Dickman wrote:

from within a C (not Objective C) function and make use of the  
result?


In Objective C I would invoke

[myObject myMethod: myInt];



You invoke it exactly the same way. There is no difference. But you  
need to compile as Obj-C.


int foo(id bar) { [bar foobaz]; }
--
David Duncan
Apple DTS Animation and Printing



Charlie Dickman
[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]


passing an object between views

2008-08-19 Thread John Greene
Hello,

Hopefully this is a generic enough question that it applies to general
Cocoa development:  How do I pass an object between views?  That is: I
have an array of objects that I've built using NSXMLParser, and that
populates a table, and clicking on a cell changes my view to another
table with a separate controller.  I had originally thought that I could
just write a method, setTableData in the secondary controller, that
takes an object as an argument, and then use that object to build the
secondary table.  This is apparently forbidden by the language, so
what's the proper approach?  I could make the array available somehow to
the new controller, since I can pass the integer index, but I'm not sure
how!

Thanks,

John

___

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: Calling an object from a C function

2008-08-19 Thread Charles Steinman
--- On Tue, 8/19/08, Charlie Dickman <[EMAIL PROTECTED]> wrote:

> Now, how do I define things like 'self' and
> 'super' to a C program?

You mean outside of an object? You don't. What would it even mean? There's no 
concept of "selfness" in a function. If you want there to be a self, you should 
create an Objective-C method.

Cheers,
Chuck


  
___

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: passing an object between views

2008-08-19 Thread j o a r


On Aug 19, 2008, at 5:31 PM, John Greene wrote:


Hopefully this is a generic enough question that it applies to general
Cocoa development:  How do I pass an object between views?  That is: I
have an array of objects that I've built using NSXMLParser, and that
populates a table, and clicking on a cell changes my view to another
table with a separate controller.  I had originally thought that I  
could

just write a method, setTableData in the secondary controller, that
takes an object as an argument, and then use that object to build the
secondary table.  This is apparently forbidden by the language, so
what's the proper approach?  I could make the array available  
somehow to
the new controller, since I can pass the integer index, but I'm not  
sure

how!



It sounds like you might be trying to implement a Master-Detail  
Interface. Possibly.


If so, you might have a look at this:

	


j o a r


___

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: Calling an object from a C function

2008-08-19 Thread mm w
hi charlie give your code or something clearer
what are you trying to do? a C object runtime? or a wrapper obj-c to
C? (kidding)

maybe you could have the right answers, when I read you, my feelings
is that you don't go in the right direction

On Tue, Aug 19, 2008 at 5:06 PM, Charlie Dickman <[EMAIL PROTECTED]> wrote:
> Thanks to all who responded. I must have had a mental block against this.
>
> Now, how do I define things like 'self' and 'super' to a C program?
>
> On Aug 19, 2008, at 7:38 PM, David Duncan wrote:
>
>> On Aug 19, 2008, at 4:28 PM, Charlie Dickman wrote:
>>
>>> from within a C (not Objective C) function and make use of the result?
>>>
>>> In Objective C I would invoke
>>>
>>> [myObject myMethod: myInt];
>>
>>
>> You invoke it exactly the same way. There is no difference. But you need
>> to compile as Obj-C.
>>
>> int foo(id bar) { [bar foobaz]; }
>> --
>> David Duncan
>> Apple DTS Animation and Printing
>>
>
> Charlie Dickman
> [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/openspecies%40gmail.com
>
> This email sent to [EMAIL PROTECTED]
>



-- 
-mmw
___

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: passing an object between views

2008-08-19 Thread Graham Cox


On 20 Aug 2008, at 10:31 am, John Greene wrote:


I had originally thought that I could
just write a method, setTableData in the secondary controller, that
takes an object as an argument, and then use that object to build the
secondary table.  This is apparently forbidden by the language, so
what's the proper approach?



Can you elaborate on why you think this is "forbidden by the  
language"? I can't think of any reason why this wouldn't work  
conceptually - let's see the code!


cheers, Graham
___

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]


This document's file has been changed by another application?

2008-08-19 Thread Chris Idou
I've got a document based app where the document is actually a directory. Every 
time I save except the first time I get the above error whether or not things 
have changed, and even if the directory timestamp is unchanged.

Under what circumstances does the above message occur and how do I avoid it?





  
___

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: Deploying project as backward compatible

2008-08-19 Thread Shawn Erickson
On Mon, Aug 18, 2008 at 11:39 PM,  <[EMAIL PROTECTED]> wrote:
> Hi all,
> I'm using xcode 3.1. I deployed my project by changing the build
> configuration  to Release. Now this application is working on Leopard.
> When I try to open the  application in Tiger by double clicking it, the
> application icon appeared in the dock for a moment and suddenly
> disappeared. The application is not opened and I didn't get any crash log.
> How can I build application as backward compatible.

http://developer.apple.com/documentation/DeveloperTools/Conceptual/cross_development/index.html
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: This document's file has been changed by another application?

2008-08-19 Thread I. Savant
I've got a document based app where the document is actually a  
directory. Every time I save except the first time I get the above  
error whether or not things have changed, and even if the directory  
timestamp is unchanged.


Under what circumstances does the above message occur and how do I  
avoid it?


  Not sure exactly, but here's a thought: Are you deleting and re- 
creating the directory each time you save?


--
I.S.


___

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: How to enumerate directory contents?

2008-08-19 Thread Shawn Erickson
On Sun, Aug 17, 2008 at 8:39 AM, Nicolas Goles <[EMAIL PROTECTED]> wrote:

> Could anyone help me a bit with this ?

Type the following in google...

"enumerate directory contents site:developer.apple.com"

-Shawn
___

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]


AUTO: Carlos Bermudez is out of the office. (returning 08/25/2008)

2008-08-19 Thread Carlos Bermudez

I am out of the office until 08/25/2008.

I will respond to your message when I return.  If you have L3 questions
please contact Omar Perez or my manager Clifford Meyers


Note: This is an automated response to your message  "Cocoa-dev Digest, Vol
5, Issue 1484" sent on 8/19/08 5:50:50 PM.

This is the only notification you will receive while this person is away.

___

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: This document's file has been changed by another application?

2008-08-19 Thread Rob Keniger


On 20/08/2008, at 11:36 AM, Chris Idou wrote:

I've got a document based app where the document is actually a  
directory. Every time I save except the first time I get the above  
error whether or not things have changed, and even if the directory  
timestamp is unchanged.


Under what circumstances does the above message occur and how do I  
avoid it?



How are you creating the folder? Are you using the NSDocument - 
fileWrapperOfType:error: method?


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


Re: This document's file has been changed by another application?

2008-08-19 Thread Chris Idou

>Not sure exactly, but here's a thought: Are you
> deleting and re- 
> creating the directory each time you save?

No.

> How are you creating the folder? Are you using the NSDocument - 
> fileWrapperOfType:error: method?

The directory is pre-existing in this case. I'm not calling that method.





  
___

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: Best Way to Handle Properties?

2008-08-19 Thread Chris Hanson

On Aug 19, 2008, at 10:02 AM, Dave wrote:

I'm new to Cocoa and a little confused about the best way to handle  
the following:


I'm converting a C based application to Object-C/Cocoa. One of the  
objects is used to hold properties which are loaded from a data  
file. I have created an object to represent the C Structure as so:


@interface PersonDetails : NSObject
{
NSString*   FirstName;
NSString*   LastName;

UInt32  DateOfBirth;
UInt32  Height;
}


In Cocoa development, it's best to follow the Cocoa coding  
conventions.  That includes things like naming:  Some of Cocoa's  
dynamic behavior actually leverages the naming conventions, as in Key- 
Value Coding.


Thus you should name these instance variables firstName, lastName,  
dateOfBirth, and height, respectively.



(This is a cut down version of the real object).

@property(assign,readwrite) NSString*   FirstName;
@property(assign,readwrite) NSString*   LastName;

@property(assign,readwrite) UInt32  DateOfBirth;
@property(assign,readwrite) UInt32  Height;


These properties should also be named using an initial lower-case  
letter to fit Cocoa conventions.


Furthermore, in general "assign" is the wrong thing for most object  
properties (unless they're a parent/peer, like an owner or delegate  
would be).  Even more importantly, for value classes like NSString  
that have mutable subclasses, you should always use "copy" instead of  
retain.


The implementation second declares these as "dynamic" (since I may  
need to "massage" the data after/before getting/setting the object  
member).


You don't need to declare the property as @dynamic if you are going to  
provide an implementation.  In fact, you probably WON'T want to  
declare a property @dynamic in the @implementation block - if you do,  
you won't get a warning from the compiler if you fail to implement it.



- (NSString*) FirstName ;
- (void) setmFirstName :theNewValue;

- (NSString*) LastName ;
- (void) setLastName :theNewValue;

- (UInt32) DateOfBirth ;
- (void) DateOfBirth :theNewValue;

- (UInt32) Height ;
- (void) Height :theNewValue;


You don't need method declarations in addition to the @property  
declarations -- those are actually redundant with the @property  
declarations.


Also, the colon is itself part of the method name, you shouldn't  
separate it like you are above.


Is the NSString allocation and initWithCharacters code the best way  
to do this? If so, what would the setter look like in this case? If  
not what is a better way of doing it?


How to write your custom accessors is addressed well in the Cocoa  
memory management documentation.  Your setters will, in general,  
always follow one of only a small number of patterns and those are  
covered in the documentation.


  -- Chris

___

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: NSTableColumn not usable with binder of class NSTextValueBinder?

2008-08-19 Thread Dave Dribin

On Aug 19, 2008, at 7:03 PM, Corbin Dunn wrote:
It's not letting me set it to my custom cell.  It just beeps (IB  
version 3.1, build 670).  I think this is because the column is  
setup a text field cell, and it will only let me set the class to  
an NSTextFieldCell subclass.  There's no plain NSCell in the  
Library from what I can find.


Yeah, your correct; please log a bug on this and we will try to fix  
it. A "hacky" workaround is to temporarily subclass NSTextFieldCell,  
then set it in iB, then undo the change. But, the binder will  
probably be wrong...so that doesn't help you too much.


FYI, I filed this as rdar://problem/6161481.

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

This email sent to [EMAIL PROTECTED]


Re: NSTableColumn not usable with binder of class NSTextValueBinder?

2008-08-19 Thread Dave Dribin

On Aug 19, 2008, at 5:47 PM, Dave Dribin wrote:
Again, what's strange is if I change my cell's superclass to be  
NSTextFieldCell, this bind: call does not give an error and it all  
works.  I also tried subclassing NSActionCell, and that works, too.   
Is my cell not implementing some method that bindings expects to be  
there?  Something that is implemented in NSActionCell?


Well, scratch that.  I just tried using NSActionCell again, and I  
still get the binder warning.  I must have messed up my testing the  
last time around.  Looks like it needs to be an NSTextFieldCell.


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

This email sent to [EMAIL PROTECTED]


Re: Best Way to Handle Properties?

2008-08-19 Thread Ken Thomases

In addition to what others have said...

On Aug 19, 2008, at 12:02 PM, Dave wrote:

	[myPersonDetails setFirstName:[[NSString alloc] initWithCharacters:  
myBufferPtr length: myStringSize]];


This makes memory management awkward.  This code is creating an object  
using alloc, so it's responsible for releasing it.  However, you're  
not keeping a pointer to the new string you've created.  You're just  
passing it to the PersonDetails object and then forgetting it.  So,  
you can't release it.


There are a few approaches to fixing this.  First, you can use a local  
variable to hold a pointer to the new object.  Then, after passing it  
to setFirstName: you can release it.  Second, you can use alloc/init/ 
autorelease where you currently use alloc/init.  Third, you can use a  
convenience method which creates a string for you but doesn't leave  
you responsible for releasing it, such as +stringWithCharacters:length:.


As noted by others, this requires that the firstName property of  
PersonDetails be declared (and implemented, if you're not letting the  
compiler synthesize it) to either "retain" or "copy" its value.  If  
the property doesn't do that, then it's failing to make sure the value  
sticks around as long as it's needed.




//
//  Do Stuff with myPersonDetails
//

//
//  This is the second bit I am not sure of.
//  Reset (free) the NSString Buffers
//
[myPersonDetails Reset];

  myCount--;
}

My specific questions are:

Is the NSString allocation and initWithCharacters code the best way  
to do this? If so, what would the setter look like in this case? If  
not what is a better way of doing it?


in the: [myPersonDetails Reset]; method I was going to release all  
the strings and zero out the integers. But I was wondering if it  
would be better to allocate and release the object each time in the  
while() loop. If I did this, would I need to define a release method  
in myPersonDetails or would the standard method release the strings  
for me?


The more normal way to do things is not to use objects as just dumb  
containers.  That is, it's not typical to reset an object and reuse it  
with completely unrelated content.


Your mindset is reflected in the fact that you've named your class  
PersonDetails rather than, say, Person.  You're not conceiving of an  
object with its own identity and responsibilities.  You're just  
thinking of it as a record or structure for holding some related data  
together for a brief time.  If that's what you need, then go for it,  
but you needn't bother replacing working C code with an Objective-C  
class.


If you do want to redesign in a more object-oriented fashion, then you  
should probably initialize a Person object with its most salient  
details at the time of its creation.  For example, does it make sense  
to ever have a person without a name?  If not, then it shouldn't be  
possible to create one that way.  Similarly, it doesn't make sense to  
reset a Person to have no name.  When you're done with a given Person  
object, you release it.  If you need a new one, you allocate and  
initialize a new one.


Lastly, if you need to do something with/to a Person, you should most  
likely tell the Person object to do it.  This is just a guess based on  
what you've shown above, but I suspect you haven't given your  
PersonDetails class much smarts about behavior.  You probably just  
have a bunch of code which queries PersonDetails objects for their  
properties and then does all the work externally to the PersonDetails  
class.  A good guideline to follow is "Tell, Don't Ask"  (although it's not a hard-and-fast rule, and shouldn't be taken to  
extremes).


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

This email sent to [EMAIL PROTECTED]


Core Data Question 1

2008-08-19 Thread R T
I have a Core Data Document-based Application.a document window with a 
tableview, a text view and a button. When the button is selected,  a number is 
read from the text field and that many objects are programatically added to the 
tableview. Then a sheet is opened. The tableview presents only part of the 
attributes of an entity. The sheet will present the remaining attributes in 
it's own tableview.
My problem is that I need the sheetController to have access to the 
myDocument.h instance variable,  NSArrayController *tableController, which is 
bound to the managedObjectContext. I'm having trouble with this. Is the 
instance variable of the document available to the sheet?

Any ideas?
Thanks
Rick Tschudin


  
___

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]


Application crashing ( Maybe I'm over releasing object? )

2008-08-19 Thread Nicolas Goles
Hey guys , I am writing an application to read/write tags to mp3 files...
the thing is working out pretty nice , ( my application is able to get a
directory input and scan the mp3 files and print the tags in the console ).
The problem is that after printing my tags the app crashes and I get an
error like :

objc[2765]: FREED(id): message release sent to freed object=0x15bf9720

>From what I have read, I may be over releasing an object, but I'm not pretty
sure at what could I've be doing wrong... here is the piece of code where my
app fails.

It looks quite long , but it's not really, most of the code is for creating
an open dialog window... the app crashes at the end of the last for showing
that message ( after writing the mp3 tags in the console )*.

*I have read about memory management in cocoa, and I don't really know
what's going on here :( , help would be really appreciated.

Thanks!
*
-(IBAction)scanAlbums:(id)sender*
{
int totalFiles; *// Loop counter.*
int j=0; *// Another loop counter*
*
// Create the File Open Dialog class.*
NSOpenPanel* openDlg = [NSOpenPanel openPanel];

*// Enable the selection of files in the dialog.*
[openDlg setCanChooseFiles:NO];

*// Enable the selection of directories in the dialog.*
[openDlg setCanChooseDirectories:YES];

*// Display the dialog.  If the OK button was pressed,**
// process the files.*
if ( [openDlg runModalForDirectory:nil file:nil] == NSOKButton )
{
* //Takes the "last object ( only one )" from the files array*
NSString *files = [[openDlg filenames] lastObject];


NSFileManager *manager = [NSFileManager defaultManager];
*//Creates a File Manager  *
NSDirectoryEnumerator *dirEnumerator = [manager
enumeratorAtPath:files]; *//Creates an enumerator*
id object; *// Creates a generic object*

while(object = [dirEnumerator nextObject])
{

*//First We craft the whole path for a single object*

NSString *fullPath = [files
stringByAppendingPathComponent:object];

if(!fullPath)
{
NSLog(@"Error when appending strings in appcontroller");
}

*//We check if the object is actually a dictionary or another
file.*
NSDictionary *fileAttributes = [manager
fileAttributesAtPath:fullPath traverseLink:NO];

*//if file is regular... for now it's like this, I'll improve
this later*
if( [[fileAttributes objectForKey:NSFileType] isEqualToString:@
"NSFileTypeRegular"])
{
Track *newTrack = [[Track alloc] init];

[albumsLibrary addTrackToLibrary:newTrack
withPath:fullPath];
}
}
}

totalFiles = [albumsLibrary count];

*//after this for loop is where the application crashes :)*
for(j = 0; j < totalFiles; j++)
{
[[albumsLibrary objectAtIndex:j] getTrackTags]; /*I get track tags*/
[[albumsLibrary objectAtIndex:j] printTagContents]; // I print tags
in the console
}

}
___

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: Application crashing ( Maybe I'm over releasing object? )

2008-08-19 Thread Graham Cox


On 20 Aug 2008, at 2:40 pm, Nicolas Goles wrote:


   Track *newTrack = [[Track alloc] init];

   [albumsLibrary addTrackToLibrary:newTrack
withPath:fullPath];



I didn't spot anything immediately obvious, but what's this doing?

You alloc/init an object and DON'T release it as the rules say you  
should. What happens inside -addTrackToLibrary:? On the face of it  
this looks like a leak, rather than the error you reported, but it's  
still a bug. If -addTrackToLibrary: is releasing it it shouldn't be,  
it's not the object's owner.


cheers, Graham
___

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: This document's file has been changed by another application?

2008-08-19 Thread chaitanya pandit
Are you actually saving the contents of the document to a file inside  
the package?
Try to get the document's fileURL and check if it is the same for the  
first and subsequent save operations, that might give a hint.

The problem might also occur if you arbitrarily tweak the fileUrl.

-Chaitanya

On 19-Aug-08, at 9:36 PM, Chris Idou wrote:

I've got a document based app where the document is actually a  
directory. Every time I save except the first time I get the above  
error whether or not things have changed, and even if the directory  
timestamp is unchanged.


Under what circumstances does the above message occur and how do I  
avoid it?







___

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/chaitanya%40expersis.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Application crashing ( Maybe I'm over releasing object? )

2008-08-19 Thread chaitanya pandit
Try using NSZombieEnabled to trap over released objects, Have a look  
at the following documents for using NSZombieEnabled


http://developer.apple.com/technotes/tn2004/tn2124.html
Also,
http://cocoadev.com/index.pl?NSZombieEnabled

-Chaitanya

On 20-Aug-08, at 12:40 AM, Nicolas Goles wrote:

Hey guys , I am writing an application to read/write tags to mp3  
files...
the thing is working out pretty nice , ( my application is able to  
get a
directory input and scan the mp3 files and print the tags in the  
console ).
The problem is that after printing my tags the app crashes and I get  
an

error like :

objc[2765]: FREED(id): message release sent to freed object=0x15bf9720

From what I have read, I may be over releasing an object, but I'm  
not pretty
sure at what could I've be doing wrong... here is the piece of code  
where my

app fails.

It looks quite long , but it's not really, most of the code is for  
creating
an open dialog window... the app crashes at the end of the last for  
showing

that message ( after writing the mp3 tags in the console )*.

*I have read about memory management in cocoa, and I don't really know
what's going on here :( , help would be really appreciated.

Thanks!
*
-(IBAction)scanAlbums:(id)sender*
{
   int totalFiles; *// Loop counter.*
   int j=0; *// Another loop counter*
   *
   // Create the File Open Dialog class.*
   NSOpenPanel* openDlg = [NSOpenPanel openPanel];

   *// Enable the selection of files in the dialog.*
   [openDlg setCanChooseFiles:NO];

   *// Enable the selection of directories in the dialog.*
   [openDlg setCanChooseDirectories:YES];

   *// Display the dialog.  If the OK button was pressed,**
   // process the files.*
   if ( [openDlg runModalForDirectory:nil file:nil] == NSOKButton )
   {
   * //Takes the "last object ( only one )" from the files array*
   NSString *files = [[openDlg filenames] lastObject];


   NSFileManager *manager = [NSFileManager defaultManager];
   *//Creates a File Manager  *
   NSDirectoryEnumerator *dirEnumerator = [manager
enumeratorAtPath:files]; *//Creates an enumerator*
   id object; *// Creates a generic object*

   while(object = [dirEnumerator nextObject])
   {

   *//First We craft the whole path for a single object*

   NSString *fullPath = [files
stringByAppendingPathComponent:object];

   if(!fullPath)
   {
   NSLog(@"Error when appending strings in  
appcontroller");

   }

   *//We check if the object is actually a dictionary or  
another

file.*
   NSDictionary *fileAttributes = [manager
fileAttributesAtPath:fullPath traverseLink:NO];

   *//if file is regular... for now it's like this, I'll  
improve

this later*
   if( [[fileAttributes objectForKey:NSFileType]  
isEqualToString:@

"NSFileTypeRegular"])
   {
   Track *newTrack = [[Track alloc] init];

   [albumsLibrary addTrackToLibrary:newTrack
withPath:fullPath];
   }
   }
   }

   totalFiles = [albumsLibrary count];

   *//after this for loop is where the application crashes :)*
   for(j = 0; j < totalFiles; j++)
   {
   [[albumsLibrary objectAtIndex:j] getTrackTags]; /*I get track  
tags*/
   [[albumsLibrary objectAtIndex:j] printTagContents]; // I  
print tags

in the console
   }

}
___

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/chaitanya%40expersis.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Core Data Question 1

2008-08-19 Thread Quincey Morris

On Aug 19, 2008, at 21:39, R T wrote:

I have a Core Data Document-based Application.a document window  
with a tableview, a text view and a button. When the button is  
selected,  a number is read from the text field and that many  
objects are programatically added to the tableview. Then a sheet is  
opened. The tableview presents only part of the attributes of an  
entity. The sheet will present the remaining attributes in it's own  
tableview.
My problem is that I need the sheetController to have access to the  
myDocument.h instance variable,  NSArrayController *tableController,  
which is bound to the managedObjectContext. I'm having trouble with  
this. Is the instance variable of the document available to the sheet?


The easiest way is probably to subclass NSWindowController, putting  
the sheet window in its own NIB file and setting the class of File's  
Owner to your window controller subclass. Your window controller can  
be initialized with any properties you need (such as the document),  
which means you can bind various interface items in the NIB file  
through File's Owner.document (or whatever).


I wouldn't recommend referring to objects in the underlying window's  
interface in your sheet. (So, don't refer to document.tableController  
from the sheet.) Instead, make properties of your document object that  
contain the data that the sheet needs.


HTH

___

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: From JavaMail to Cocoa?

2008-08-19 Thread Christophe Bismuth
Ok, thank you Scott.I'll try to reuse my Java code to get it works with a
Cocoa GUI.
Chris

2008/8/20 Scott Anguish <[EMAIL PROTECTED]>

>
> On 19-Aug-08, at 4:29 PM, Christophe Bismuth wrote:
>
>  Dear community,
>> I've developed a Java application using JavaMail library to get my Gmail
>> messages using IMAP.
>> I'd like to switch my code from Java to Cocoa, is there any official Apple
>> Cocoa API for IMAP? Are Mail API published?
>>
>
> Unfortunately there is no Apple provided Objective-C API for IMAP.  I think
> most developers look at using Pantomime <
> http://www.collaboration-world.com/pantomime>
>
> The message sending API we had was not very useful and has been deprecated.
>
>
>
___

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]