Re: Getting mouse moved events on overlay windows

2008-07-01 Thread Owen Yamauchi


You need to override -acceptsMouseMovedEvents to return YES in the
window that needs them.

Owen
___

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: Getting mouse moved events on overlay windows

2008-07-01 Thread Shripada Hebbar

Markus,

If your app is Leopard only, you better checkout:

   NSTrackingArea  at:
   
http://developer.apple.com/documentation/Cocoa/Conceptual/EventOverview/TrackingAreaObjec
   ts/chapter_7_section_4.html#//apple_ref/doc/uid/1060i-CH8- 
DontLinkElementID_30


NSTrackingArea has methods to track the mouse moved events.

HTH

 -Shripada


On 01/07/2008, at 4:52 PM, Markus Spoettl wrote:


Hello List,

I have a WebView with a transparent overlay window + custom view
"attached" it to allow for custom overlay drawing on top of what the
WebView displays. This works very well.

However, I can't figure out a way to get -mouseMoved: messages on
the overlay window's view. Tracking areas as well as -mouseMoved:
messages (with setting acceptsMouseMovedEvents:YES on the overlay
window) don't work because the overlay window is borderless
(NSBorderlessWindowMask) and transparent and the framework does not
send those messages to it.

So I thought, I go through a WebView subclass, establishing the
tracking area there and forward the mouse messages to the overlay
window and its view manually. Unfortunately this doesn't work either
because the tracking area events are only firing if there is no
overlay.

The overlay view does get -mouseDown:, -mouseUp: and -mouseDragged:
events, but not -mouseMoved:. I'm pretty out of ideas, how can I get
-mouseMoved: messages on the overlay window?

Thanks for any input!

Regards
Markus







---
Robosoft Technologies - Come home to Technology

Disclaimer: This email may contain confidential material. If you were not an 
intended recipient, please notify the sender and delete all copies. Emails to 
and from our network may be logged and monitored. This email and its 
attachments are scanned for virus by our scanners and are believed to be safe. 
However, no warranty is given that this email is free of malicious content or 
virus.
___

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:Getting mouse moved events on overlay windows

2008-07-01 Thread Shripada Hebbar
If your app is Leopard only,  you better take a look into
NSTrackingArea  at:

http://developer.apple.com/documentation/Cocoa/Conceptual/EventOverview/TrackingAreaObjec
ts/chapter_7_section_4.html#//apple_ref/doc/uid/1060i-CH8-DontLinkElementID_30


-Shripada

> Hi Markus,
> 
> I ran into exactly the same problem; my view was in a transparent,  
> borderless, and nonactivating panel.  It didn't get mouse moved  
> events, and tracking rectangles didn't work either.  (My problem was  
> that I wanted to change the cursor when it was inside my view, but it  
> never worked).
> 
> I eventually concluded that "Cocoa doesn't expect you to be interested  
> in mouse moved events or setting the cursor for a window that's not  
> active" and gave up.  I suspected at the time that it was the  
> "nonactivating" property of the panel that was causing the issue.
> 
> If you get any further, I'd be keen to hear what you find out.
> 
> Cheers,
> Brett
> 
> 
> 
> 
> 
> 
> On 01/07/2008, at 4:52 PM, Markus Spoettl wrote:
> 
> > Hello List,
> >
> >  I have a WebView with a transparent overlay window + custom view  
> > "attached" it to allow for custom overlay drawing on top of what the  
> > WebView displays. This works very well.
> >
> > However, I can't figure out a way to get -mouseMoved: messages on  
> > the overlay window's view. Tracking areas as well as -mouseMoved:  
> > messages (with setting acceptsMouseMovedEvents:YES on the overlay  
> > window) don't work because the overlay window is borderless  
> > (NSBorderlessWindowMask) and transparent and the framework does not  
> > send those messages to it.
> >
> > So I thought, I go through a WebView subclass, establishing the  
> > tracking area there and forward the mouse messages to the overlay  
> > window and its view manually. Unfortunately this doesn't work either  
> > because the tracking area events are only firing if there is no  
> > overlay.
> >
> > The overlay view does get -mouseDown:, -mouseUp: and -mouseDragged:  
> > events, but not -mouseMoved:. I'm pretty out of ideas, how can I get  
> > -mouseMoved: messages on the overlay window?
> >
> > Thanks for any input!
> >
> > Regards
> > Markus
> 
> 
> 
> 
> 



---
Robosoft Technologies - Come home to Technology

Disclaimer: This email may contain confidential material. If you were not an 
intended recipient, please notify the sender and delete all copies. Emails to 
and from our network may be logged and monitored. This email and its 
attachments are scanned for virus by our scanners and are believed to be safe. 
However, no warranty is given that this email is free of malicious content or 
virus.


___

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: Getting mouse moved events on overlay windows

2008-07-01 Thread Markus Spoettl

On Jul 1, 2008, at 3:54 PM, Brett Powley wrote:

If you get any further, I'd be keen to hear what you find out.



As a matter of fact, I seem to have found something that is much  
simpler than overlaying:


Add a subview to the WebView that doesn't clear its content before  
drawing. When I first tried this months ago I never tried not clearing  
the view's background and always ended up with a completely black  
content area where the WebView content should be drawing, so I though  
WebView just doesn't like subviews (IB doesn't allow you to put one  
there either).


Just minutes ago I retried this and to my complete surprise it works  
perfectly (see code example below). The only thing I fear is that  
redrawing works by pure coincidence. Does anyone think this is a  
doable solution?


I'm using Xcode 3.0 on Mac OS 10.5.4, I have no idea if it works on  
previous systems but I'd be most interested in hearing whether or not  
it does.


Regards
Markus

In the controller (responsible for the WebView) -awakeFromNib I added  
a subview:


- (void)awakeFromNib
{
NSViewTest *sub = [[NSViewTest alloc] initWithFrame:[webview  
bounds]];

[webview addSubview:sub];
[sub setHidden:NO];
[sub setAutoresizingMask:[webview autoresizingMask]];
}

And this is my super-simplistic NSView:

@interface NSViewTest : NSView {
NSTrackingArea *ta;
NSPoint mp;
}
@end

@implementation NSViewTest

- (id)initWithFrame:(NSRect)rect
{
self = [super initWithFrame:rect];
if (self) {
ta = [[NSTrackingArea alloc] initWithRect:[self bounds]  
options:(NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved |  
NSTrackingActiveInKeyWindow) owner:self userInfo:nil];

[self addTrackingArea:ta];
}
return self;
}

- (void)dealloc
{
[self removeTrackingArea:ta];
[ta release];
[super dealloc];
}

- (void)updateTrackingAreas
{
if (ta) {
[self removeTrackingArea:ta];
[ta release];
}
ta = [[NSTrackingArea alloc] initWithRect:[self bounds] options: 
(NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved |  
NSTrackingActiveInKeyWindow) owner:self userInfo:nil];

[self addTrackingArea:ta];
}

- (void)drawRect:(NSRect)rect
{
[[NSColor redColor] set];
NSFrameRect([self bounds]);

if (!NSEqualPoints(mp, NSZeroPoint)) {
NSBezierPath *pt = [NSBezierPath  
bezierPathWithOvalInRect:NSMakeRect(mp.x-5, mp.y-5, 10, 10)];

[[NSColor blueColor] set];
[pt setLineWidth:2.0];
[pt stroke];
}
}

- (void)mouseEntered:(NSEvent *)theEvent
{
}

- (void)mouseExited:(NSEvent *)theEvent
{
mp = NSZeroPoint;
[self setNeedsDisplay:YES];
}

- (void)mouseMoved:(NSEvent *)theEvent
{
mp = [self convertPoint:[theEvent locationInWindow] fromView:nil];
[self setNeedsDisplay:YES];
}

@end


--
__
Markus Spoettl

___

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: class keeps track of object

2008-07-01 Thread Shripada Hebbar
Daniel

You are trying to create a singleton object in cocoa and there is a good 
documentation on this at:
http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/chapter_3_section_10.html


-Shripada
> 
> Thanks! Exactly what I was looking for.
> 
> Daniel
> 
> 
> Jonathan Hess wrote:
> > Han Daniel -
> >
> > You can use a global variable just like you would in C:
> >
> > static Foo *bar = nil;
> >
> > @implementation Foo
> > + (id)bar {
> > if (!bar) {
> > bar = [[Foo alloc] init];
> > }
> > return bar;
> > }
> > @end
> >
> >
> > Thats the simple single threaded case. Things get much more 
> > interesting if you want to be able to call 'bar' from multiple threads.
> >
> > Compiled in Mail -
> > Jon Hess



---
Robosoft Technologies - Come home to Technology

Disclaimer: This email may contain confidential material. If you were not an 
intended recipient, please notify the sender and delete all copies. Emails to 
and from our network may be logged and monitored. This email and its 
attachments are scanned for virus by our scanners and are believed to be safe. 
However, no warranty is given that this email is free of malicious content or 
virus.


___

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: exec(uting) Safari - How (newbie)

2008-07-01 Thread Jason Coco
What env pollution? I agree that exec* isn't really the way to go, but  
that's what the OP was using... I just suggested that /usr/bin/open is  
a better option than hard-coding the path to some arbitrary  
application. It's also a lot easier to use than the LaunchServices  
API... although if I were gonna use it, I'd definitely do so from an  
NSTask object as others have already suggested.


On Jul 1, 2008, at 23:44 , Kyle Sluder wrote:

On Tue, Jul 1, 2008 at 8:17 PM, Kevin Elliott <[EMAIL PROTECTED]>  
wrote:
Of course, they're both bad choices.  As several people have  
pointed out,
NSWorkspace launchApplication or openURL depending on the  
requirements.  If
it's not possible to use NSWorkspace (i.e. because you can't link  
against
AppKit) consider NSTask or using LaunchServices.  But unless you  
have a

SPECIFIC, low level requirement exec is the wrong API.


I was even more concerned about the env pollution necessary for exec
to work as described ("not needing to know where Safari lives").  exec
is just a bad idea all around for anything outside of the BSD
environment.

--Kyle Sluder




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: Getting mouse moved events on overlay windows

2008-07-01 Thread Markus Spoettl

On Jul 1, 2008, at 3:54 PM, Brett Powley wrote:
I ran into exactly the same problem; my view was in a transparent,  
borderless, and nonactivating panel.  It didn't get mouse moved  
events, and tracking rectangles didn't work either.  (My problem was  
that I wanted to change the cursor when it was inside my view, but  
it never worked).


I eventually concluded that "Cocoa doesn't expect you to be  
interested in mouse moved events or setting the cursor for a window  
that's not active" and gave up.  I suspected at the time that it was  
the "nonactivating" property of the panel that was causing the issue.


If you get any further, I'd be keen to hear what you find out.



That doesn't sound very promising.

One thing I didn't try so far is - instead of trying to overlay the  
WebView - make it draw into an off-screen buffer which I then use to  
paint my own view's background. Of course that comes with its own set  
of problems (coordinating the view sizes). Some of the problems are  
the same as with overlays, just the other way round (view resizing).  
Some I'm not even aware of - I'm sure of that.


I have no idea how to do that, or if it's a futile attempt. I also  
don't like the whole idea particularly much because it just smells  
like a troublesome hack. Even more so as WebView -drawRect doesn't do  
the drawing so I don't know how to make it draw exactly when I want it  
and where I want it.


If someone has input on how to go about this, I'd be more than happy  
to hear your insight.


Regards
Markus
--
__
Markus Spoettl

___

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]


setFirstResponder to NSTextField fails 1st time, works next

2008-07-01 Thread Moses Hall

Hi folks,

Here's a problem I'm having under Tiger, developing an LSUIElement  
application (Input Method server -- it's the UI for IPA Palette  
[www.blugs.com/IPA]). I have an NSTabView, one of whose panes has a  
search field which is an NSTextField subclass (note that the same  
problem occurs if I use an NSTextField). I want to make this field  
the first responder when the "Search" tab is chosen. Oddly, it does  
not become first responder the first time the pane is selected. It  
does not become key, and does not accept text (unless clicked on). If  
I move to a different tab and come back, then I get the desired  
result: the focus ring is there and I can type into the field.


This is happening inside an NSPanel subclass...

@implementation IPAPanel
-(BOOL)canBecomeKeyWindow {return YES;}
-(BOOL)canBecomeMainWindow {return NO;}
-(void)awakeFromNib
{
  [self setHidesOnDeactivate:NO];
  [self setBecomesKeyOnlyIfNeeded:YES];
}
@end

Here is my tab switch delegate method:
-(void)tabView:(NSTabView*)tv didSelectTabViewItem:(NSTabViewItem*)item
{
  NSLog(@"first responder WAS %@", [_window firstResponder]);
  if ([[item identifier] isEqual:@"Search"])
  {
[_window makeKeyWindow];
[_window makeFirstResponder:_searchText];
  }
  NSLog(@"first responder: %@", [_window firstResponder]);
}

And here is the log of events:
### Here's a startup call, switching to the previous session's tab  
(from user defaults):
2008-07-01 23:41:28.331 IPAServer[1269] first responder WAS  

2008-07-01 23:41:28.358 IPAServer[1269] first responder: 0x392750>

### Here's the first time I manually go to the search tab:
2008-07-01 23:41:36.969 IPAServer[1269] first responder WAS  

2008-07-01 23:41:36.992 IPAServer[1269] first responder:  


### No luck, let's try another tab:
2008-07-01 23:41:42.276 IPAServer[1269] first responder WAS 0x351c80>
2008-07-01 23:41:42.276 IPAServer[1269] first responder: 0x351c80>

### I return to the search tab and...
2008-07-01 23:41:45.017 IPAServer[1269] first responder WAS  

2008-07-01 23:41:45.073 IPAServer[1269] first responder: 0x395200>
Frame = {{2.00, 3.00}, {448.00, 14.00}}, Bounds = {{0.00, 0.00},  
{448.00, 14.00}}

Horizontally resizable: YES, Vertically resizable: YES
MinSize = {448.00, 14.00}, MaxSize = {4.00, 4.00}

... now the field editor is the first responder, and it's sized to  
match my search field. My happiness is palpable but incomplete ;-)


I have a workaround -- in awakeFromNib I can switch to the Search tab  
and then to the correct one, then when the user manually switches  
it's the second time so it works... sorta. But it's voodoo. I'd  
rather understand what is happening. Does anyone have an idea about  
what's going on here?


Much appreciated,
-- Brian "Moses" Hall
   www.blugs.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: exec(uting) Safari - How (newbie)

2008-07-01 Thread Kyle Sluder
On Tue, Jul 1, 2008 at 8:17 PM, Kevin Elliott <[EMAIL PROTECTED]> wrote:
> Of course, they're both bad choices.  As several people have pointed out,
> NSWorkspace launchApplication or openURL depending on the requirements.  If
> it's not possible to use NSWorkspace (i.e. because you can't link against
> AppKit) consider NSTask or using LaunchServices.  But unless you have a
> SPECIFIC, low level requirement exec is the wrong API.

I was even more concerned about the env pollution necessary for exec
to work as described ("not needing to know where Safari lives").  exec
is just a bad idea all around for anything outside of the BSD
environment.

--Kyle Sluder
___

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

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

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

This email sent to [EMAIL PROTECTED]


CALayer contents and image aspect ratio

2008-07-01 Thread Wayne Shao
Hi,

I provide a CGImageRef as the layer content. When the bounds of layer
is changed, the image seems to be scaled to fit the bounds.
Is there an option to keep the image aspect ratio?  what possible
key-value can I set for the layer's style property?


Thanks,
-- 
Wayne Shao
___

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]


NSScrollView responding to changes in alpha

2008-07-01 Thread John Joyce
Interestingly, NSScrollView in an NSPanel HUD window can have its  
background color set with alpha and transparency is easy to achieve.
Inside a normal NSPanel or window, the backing of the contentView rect  
seems to be all that will mix with the background color alpha.


Ideally, I'd like this same behavior with a non-HUD panel or window.
Also, HUD panels seem to want to remain in front. Does anybody know a  
quick way to disable that?


___

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: NSDateComponents question

2008-07-01 Thread Jason Wiggins
For the sake of completeness, the second line was incorrect (bracket  
preceding NSCalendar). It has been corrected in the following snippet:


On 02/07/2008, at 10:41 AM, mmalc crawford wrote:


NSDate *today = [NSDate date];
NSCalendar *gregorian = [[NSCalendar alloc]  
initWithCalendarIdentifier:NSGregorianCalendar];


// Get the weekday component of the current date
NSDateComponents *weekdayComponents = [gregorian  
components:NSWeekdayCalendarUnit fromDate:today];

/*
Create a date components to represent the number of days to subtract  
from the current date.
The weekday value for Sunday in the Gregorian calendar is 1, so  
subtract 1 from the number
of days to subtract from the date in question.  (If today's Sunday,  
subtract 0 days.)

*/
NSDateComponents *componentsToSubtract = [[NSDateComponents alloc]  
init];

[componentsToSubtract setDay: - ([weekdayComponents weekday] - 1)];

NSDate *beginningOfWeek = [gregorian  
dateByAddingComponents:componentsToSubtract toDate:today options:0];


/*
Optional step:
beginningOfWeek now has the same hour, minute, and second as the  
original date (today).
To normalize to midnight, extract the year, month, and day  
components and create a new date from those components.

*/
NSDateComponents *components = [gregorian components: 
(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit)

 fromDate: beginningOfWeek];
beginningOfWeek = [gregorian dateFromComponents: components];



JJ
___

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: NSDateComponents question

2008-07-01 Thread Jason Wiggins

Thanks mmalc and Chris. Your help and wisdom is much appreciated.

JJ



On 02/07/2008, at 10:41 AM, mmalc crawford wrote:



On Jul 1, 2008, at 5:20 PM, Jason Wiggins wrote:

It look like what I thought was going to be something simple, has  
turned out to be less so and fraught with danger programatically.
I was just thinking though, would it be easier just to covert the  
weekday value into seconds (weekday * 60 * 60 * 24) and subtract  
that from the current date? This would save you from the issue of  
year and month boundaries. Following code is untested (written in  
Mail):



I'm sorry if I've obfuscated Chris's reply.  I'd thought it would be  
possible to save a few steps by reusing the date components object  
you get from decomposing the start date, but Chris indicates that  
the short-cut is not guaranteed to work in all situations.  His  
robust solution is to do the following:



NSDate *today = [NSDate date];
[NSCalendar *gregorian = [[NSCalendar alloc]  
initWithCalendarIdentifier:NSGregorianCalendar];


// Get the weekday component of the current date
NSDateComponents *weekdayComponents = [gregorian  
components:NSWeekdayCalendarUnit fromDate:today];

/*
Create a date components to represent the number of days to subtract  
from the current date.
The weekday value for Sunday in the Gregorian calendar is 1, so  
subtract 1 from the number
of days to subtract from the date in question.  (If today's Sunday,  
subtract 0 days.)

*/
NSDateComponents *componentsToSubtract = [[NSDateComponents alloc]  
init];

[componentsToSubtract setDay: - ([weekdayComponents weekday] - 1)];

NSDate *beginningOfWeek = [gregorian  
dateByAddingComponents:componentsToSubtract toDate:today options:0];


/*
Optional step:
beginningOfWeek now has the same hour, minute, and second as the  
original date (today).
To normalize to midnight, extract the year, month, and day  
components and create a new date from those components.

*/
NSDateComponents *components = [gregorian components: 
(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit)

 fromDate: beginningOfWeek];
beginningOfWeek = [gregorian dateFromComponents: components];


mmalc



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: KVO Bug With Keypaths

2008-07-01 Thread Keary Suska
7/1/08 5:13 PM, also sprach [EMAIL PROTECTED]:

> So to clarify: "related" is a dictionary that always contains a key
> called "content", the object for which is a dictionary that always
> contains a key called "status", the object for which is always
> KVO-compliant for "value"?

"relations" (the object being sent the addObserver message) is a dictionary:
"related" is an object, "content" is a dictionary; "value" is a property of
"status", another object.

> And you can getValueForKey:@"order.related.content.status.value"
> directly, but when you set the object for either of those keys, you
> fail to get notified?

Yes, but the problem I am seeing is that when "related" is changed, KVO
notifications aren't sent, even though everything descending from it must
have changed too by implication. I also tested setting "value", which isn't
working either.
 
> What happens if you register for notifications for
> @"order.related.content.status", @"order.related.content", etc.? Do
> you get any of those notifications?

Nope, none, even "order.related", i.e. when I change "related" or
"status.value". Note that other observers who are watching "status.value",
do get notifications--at least ones that are not observing through
"related".

My initial tests seem to indicate some problem observing through
relations/related, although I have NSController subclasses (using bindings)
that don't seem to have any issues, although their key path starts at the
object that own "relations".

Best,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


___

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: NSDateComponents question

2008-07-01 Thread mmalc crawford


On Jul 1, 2008, at 5:20 PM, Jason Wiggins wrote:

It look like what I thought was going to be something simple, has  
turned out to be less so and fraught with danger programatically.
I was just thinking though, would it be easier just to covert the  
weekday value into seconds (weekday * 60 * 60 * 24) and subtract  
that from the current date? This would save you from the issue of  
year and month boundaries. Following code is untested (written in  
Mail):



I'm sorry if I've obfuscated Chris's reply.  I'd thought it would be  
possible to save a few steps by reusing the date components object you  
get from decomposing the start date, but Chris indicates that the  
short-cut is not guaranteed to work in all situations.  His robust  
solution is to do the following:



NSDate *today = [NSDate date];
[NSCalendar *gregorian = [[NSCalendar alloc]  
initWithCalendarIdentifier:NSGregorianCalendar];


// Get the weekday component of the current date
NSDateComponents *weekdayComponents = [gregorian  
components:NSWeekdayCalendarUnit fromDate:today];

/*
Create a date components to represent the number of days to subtract  
from the current date.
The weekday value for Sunday in the Gregorian calendar is 1, so  
subtract 1 from the number
of days to subtract from the date in question.  (If today's Sunday,  
subtract 0 days.)

*/
NSDateComponents *componentsToSubtract = [[NSDateComponents alloc]  
init];

[componentsToSubtract setDay: - ([weekdayComponents weekday] - 1)];

NSDate *beginningOfWeek = [gregorian  
dateByAddingComponents:componentsToSubtract toDate:today options:0];


/*
Optional step:
beginningOfWeek now has the same hour, minute, and second as the  
original date (today).
To normalize to midnight, extract the year, month, and day components  
and create a new date from those components.

*/
NSDateComponents *components = [gregorian components: 
(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit)

  fromDate: beginningOfWeek];
beginningOfWeek = [gregorian dateFromComponents: components];


mmalc

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSDateComponents question

2008-07-01 Thread Jason Wiggins
It look like what I thought was going to be something simple, has  
turned out to be less so and fraught with danger programatically.
I was just thinking though, would it be easier just to covert the  
weekday value into seconds (weekday * 60 * 60 * 24) and subtract that  
from the current date? This would save you from the issue of year and  
month boundaries. Following code is untested (written in Mail):


NSDateComponents *components = [[NSDateComponents alloc] init];
NSDate *startOfTheWeek;
NSDate *now = [NSDate date];
components = [calendar components:NSWeekdayCalendarUnit fromDate:now];
	startOfTheWeek = [now addTimeInterval:-([components weekday] * 60 *  
60 * 24)];

NSLog(@"The start of the week is %@", startOfTheWeek);

JJ



On 02/07/2008, at 4:37 AM, mmalc crawford wrote:



On Jul 1, 2008, at 10:44 AM, Chris Kane wrote:

My apologies; I did do some testing and found that the resultant  
date was always correct.

Could you elaborate on what circumstances this might not be correct?
Did you try starting with a starting date of  Jan 1, 2009?  The  
Weekday would be 5, the Day 1.


Rats, no; I tried the dates at the beginning of 2008, 2003, and  
1999...



The previous Sunday is December 28, 2008.


... although, hmm, yes, that's the result I get(*).  Nevertheless...

Passing a Year, Month, Day of (2009, 1, -3)  (-3 == 1 - (5 - 1) in  
your original computation) is passing an out-of-bounds value with  
dateWithComponents:, with who-knows-what effect.  It might be well- 
defined, it might not be.  The result might change between OS  
releases.  In other words, it seems a bit ambiguous, so best to  
just avoid it.



... point taken.  I'll update the documentation accordingly.

mmalc


(*)
   NSDateComponents *components = [[NSDateComponents alloc] init];
   [components setYear:2009];
   [components setMonth:1];
   [components setDay:1];
   NSDate *testDate = [gregorian dateFromComponents:comps];
   [components release];

   NSDateComponents *components = [gregorian  
components:NSWeekdayCalendarUnit | NSYearCalendarUnit |  
NSMonthCalendarUnit | NSDayCalendarUnit fromDate:testDate];


   NSLog(@"day: %d, weekDay: %d, delta: %d", [components day],  
[components weekday], [components day] - [components weekday]);

   // day: 1, weekDay: 5, delta: -4

   [components setDay:([components day] - ([components weekday] -  
1))];

   [components setWeekday:NSUndefinedDateComponent];

   NSDate *beginningOfWeek = [gregorian  
dateFromComponents:components];

   NSLog(@"beginningOfWeek: %@", beginningOfWeek);
   // beginningOfWeek: 2008-12-28 00:00:00 -0800

___

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/jwiggins%40optusnet.com.au

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: exec(uting) Safari - How (newbie)

2008-07-01 Thread Kevin Elliott

On Jul 1, 2008, at 8:53 AM, Kyle Sluder wrote:

On Tue, Jul 1, 2008 at 11:30 AM, Jason Coco <[EMAIL PROTECTED]>  
wrote:
You could also use /usr/bin/open -- then you wouldn't have to know  
where

safari lives.


Abaddesignsayswhat?  What do you think open uses anyway?  ;-)


With out looking at the source, I'd guess a whole heaping mess of  
LaunchServices code.  If the choice is between exec directly or exec  
open, open is hands down the better choice.


Of course, they're both bad choices.  As several people have pointed  
out, NSWorkspace launchApplication or openURL depending on the  
requirements.  If it's not possible to use NSWorkspace (i.e. because  
you can't link against AppKit) consider NSTask or using  
LaunchServices.  But unless you have a SPECIFIC, low level requirement  
exec is the wrong API.


-Kevin Elliott
DTS Engineer
[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: KVC/KVO compliance of a container adding multiple objects

2008-07-01 Thread mmalc Crawford


On Jul 1, 2008, at 4:33 PM, Graham Cox wrote:

I also have a number of methods that allow "things" to be added from  
arrays, or indexed by an index set. Is there a way to make these KVC/ 
KVO compliant or would they all

have to call through to one or more of these methods to ensure that?





Batch modification of collections

mmalc

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Regarding Iphone

2008-07-01 Thread William Squires
  No, but check out Amazon.com - I believe there's a book (currently  
on hold awaiting the final release of iPhone OS) that covers iPhone  
programming; you may still be able to pre-order it. Other than that,  
iPhone is off limits here because of the NDA until the final (public)  
release, AFAIK.


On Jun 30, 2008, at 1:50 AM, Arnab Ganguly wrote:


Hi All,
I just downloaded the iphone Beta 8 SDK.It comes with Xcode 3.1 and  
extension for Iphone OS.Can you all suggest me some good tutorials  
for writing applications on Iphone.

Thanks and regards
Arnab
 ___
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list  ([EMAIL PROTECTED])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/wsquires% 
40satx.rr.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]


KVC/KVO compliance of a container adding multiple objects

2008-07-01 Thread Graham Cox

I have a container class which has a mutable array.

To allow it to be KVC/KVO compliant, I'm implementing:

- (void)setObjects:(NSArray*) objs; 
// KVC/KVO compliant
- (NSArray*)objects;
// KVC/KVO compliant
- (int) countOfObjects; 
// KVC/KVO compliant
- (thing*)  objectInObjectsAtIndex:(int) index; 
// KVC/KVO compliant
- (void)	insertObject:(thing*) obj inObjectsAtIndex:(int) index;			//  
KVC/KVO compliant
- (void)	removeObjectFromObjectsAtIndex:(int) index;// KVC/KVO  
compliant
- (void)	replaceObjectInObjectsAtIndex:(int) index withObject:(thing*)  
obj;	// KVC/KVO compliant


I also have a number of methods that allow "things" to be added from  
arrays, or indexed by an index set. Is there a way to make these KVC/ 
KVO compliant or would they all

have to call through to one or more of these methods to ensure that?

For example:

- (void)	addObjectsFromArray:(NSArray*) objs atIndexes:(NSIndexSet*)  
set;

- (void)removeObjectsInArray:(NSArray*) objs;
- (void)removeObjectsAtIndexes:(NSIndexSet*) set;

tia,

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: Best way to handle background i/o and notify main UI thread

2008-07-01 Thread Jean-Daniel Dupas


Le 2 juil. 08 à 01:24, Chris Irvine a écrit :



On Jul 1, 2008, at 3:17 PM, Douglas Davidson wrote:



On Jul 1, 2008, at 3:11 PM, Chris Irvine wrote:

I've been doing a lot of reading about this, but I still don't  
feel like I have a concise answer. I'm building a small suite of  
applications that all will all share similar interaction with a  
UDP based network based peer. It will be necessary to have various  
background threaded activities to keep the connection alive and  
monitored. I've already built a small proof of concept using a  
separate C program that does standard i/o and can be managed by a  
the Cocoa front end using NSTask. This is somewhat limiting and  
isn't portable to our most favorite mobile device.


If your need is for the receipt of UDP packets, CFSocket provides a  
run loop source that can handle that.





And then I suppose you would suggest CFRunLoopTimer to schedule  
transmission of keep-alive packets or other periodic connection  
handling activities? or, something more cocoa-esk ?


-Chris


CFRunLoopTimer, NSTimer, it's just a matter of tast ;-)




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: Best way to handle background i/o and notify main UI thread

2008-07-01 Thread Chris Irvine


On Jul 1, 2008, at 3:17 PM, Douglas Davidson wrote:



On Jul 1, 2008, at 3:11 PM, Chris Irvine wrote:

I've been doing a lot of reading about this, but I still don't feel  
like I have a concise answer. I'm building a small suite of  
applications that all will all share similar interaction with a UDP  
based network based peer. It will be necessary to have various  
background threaded activities to keep the connection alive and  
monitored. I've already built a small proof of concept using a  
separate C program that does standard i/o and can be managed by a  
the Cocoa front end using NSTask. This is somewhat limiting and  
isn't portable to our most favorite mobile device.


If your need is for the receipt of UDP packets, CFSocket provides a  
run loop source that can handle that.





And then I suppose you would suggest CFRunLoopTimer to schedule  
transmission of keep-alive packets or other periodic connection  
handling activities? or, something more cocoa-esk ?


-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: KVO Bug With Keypaths

2008-07-01 Thread Hamish Allan
On Tue, Jul 1, 2008 at 11:18 PM, Keary Suska <[EMAIL PROTECTED]> wrote:

> When I modify their contents, they are modified using setObject:forKey:,
> which I issues KVO notifications, IIRC. At least I know it does in certain
> situations, as rely on that behavior in a number of places.
>
> I also mistyped the key path. The observed object is "relations", the path
> is "order.related.content.status.value". That may make a difference.

So to clarify: "related" is a dictionary that always contains a key
called "content", the object for which is a dictionary that always
contains a key called "status", the object for which is always
KVO-compliant for "value"?

And you can getValueForKey:@"order.related.content.status.value"
directly, but when you set the object for either of those keys, you
fail to get notified?

What happens if you register for notifications for
@"order.related.content.status", @"order.related.content", etc.? Do
you get any of those notifications?

Hamish
___

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: class keeps track of object

2008-07-01 Thread Sherm Pendley
On Tue, Jul 1, 2008 at 6:49 PM, Jonathan Hess <[EMAIL PROTECTED]> wrote:
> Han Daniel -
>
> You can use a global variable just like you would in C:

Yes, but...

> static Foo *bar = nil;

That's not a global. Static vars are file scoped. :-)

In Foo.m:

Foo *globalFoo = nil;

In Foo.h, somewhere outside the class @interface:

extern Foo *globalFoo;

That said, I think you have the right idea, with a file-scoped static
var and a +sharedFoo method being the only way to get at it. I'm just
saying, that's not a global variable. :-)

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

This email sent to [EMAIL PROTECTED]


Re: Getting mouse moved events on overlay windows

2008-07-01 Thread Brett Powley

Hi Markus,

I ran into exactly the same problem; my view was in a transparent,  
borderless, and nonactivating panel.  It didn't get mouse moved  
events, and tracking rectangles didn't work either.  (My problem was  
that I wanted to change the cursor when it was inside my view, but it  
never worked).


I eventually concluded that "Cocoa doesn't expect you to be interested  
in mouse moved events or setting the cursor for a window that's not  
active" and gave up.  I suspected at the time that it was the  
"nonactivating" property of the panel that was causing the issue.


If you get any further, I'd be keen to hear what you find out.

Cheers,
Brett






On 01/07/2008, at 4:52 PM, Markus Spoettl wrote:


Hello List,

 I have a WebView with a transparent overlay window + custom view  
"attached" it to allow for custom overlay drawing on top of what the  
WebView displays. This works very well.


However, I can't figure out a way to get -mouseMoved: messages on  
the overlay window's view. Tracking areas as well as -mouseMoved:  
messages (with setting acceptsMouseMovedEvents:YES on the overlay  
window) don't work because the overlay window is borderless  
(NSBorderlessWindowMask) and transparent and the framework does not  
send those messages to it.


So I thought, I go through a WebView subclass, establishing the  
tracking area there and forward the mouse messages to the overlay  
window and its view manually. Unfortunately this doesn't work either  
because the tracking area events are only firing if there is no  
overlay.


The overlay view does get -mouseDown:, -mouseUp: and -mouseDragged:  
events, but not -mouseMoved:. I'm pretty out of ideas, how can I get  
-mouseMoved: messages on the overlay window?


Thanks for any input!

Regards
Markus




___

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: class keeps track of object [solved]

2008-07-01 Thread Daniel Richman

Thanks! Exactly what I was looking for.

Daniel


Jonathan Hess wrote:

Han Daniel -

You can use a global variable just like you would in C:

static Foo *bar = nil;

@implementation Foo
+ (id)bar {
if (!bar) {
bar = [[Foo alloc] init];
}
return bar;
}
@end


Thats the simple single threaded case. Things get much more 
interesting if you want to be able to call 'bar' from multiple threads.


Compiled in Mail -
Jon Hess

On Jul 1, 2008, at 3:35 PM, Daniel Richman wrote:


Hi All,

I have created a class (call it Foo) that there will be one and only 
one instance of (call it Bar). I need some way to have Foo keep a 
pointer to Bar, so when another object asks for the pointer to Bar, 
Foo will be able to return the pointer.


Presumably this can be done, as NSNotificationCenter has the 
defaultCenter method. But I don't know how to go about it. Any ideas?


Daniel
___

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]


Re: class keeps track of object

2008-07-01 Thread Jonathan Hess

Han Daniel -

You can use a global variable just like you would in C:

static Foo *bar = nil;

@implementation Foo
+ (id)bar {
if (!bar) {
bar = [[Foo alloc] init];
}
return bar;
}
@end

Thats the simple single threaded case. Things get much more  
interesting if you want to be able to call 'bar' from multiple threads.


Compiled in Mail -
Jon Hess

On Jul 1, 2008, at 3:35 PM, Daniel Richman wrote:


Hi All,

I have created a class (call it Foo) that there will be one and only  
one instance of (call it Bar). I need some way to have Foo keep a  
pointer to Bar, so when another object asks for the pointer to Bar,  
Foo will be able to return the pointer.


Presumably this can be done, as NSNotificationCenter has the  
defaultCenter method. But I don't know how to go about it. Any ideas?


Daniel
___

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]


Re: class keeps track of object

2008-07-01 Thread Jean-Daniel Dupas

search for singleton pattern (in the archives and in Apple doc too).

The simplest way to do it is (not thread safe):

@implementation Foo

+ (Bar *)sharedFoo {
static Foo *shardInstance = nil;
if (!sharedInstance)
sharedInstance = [[Foo alloc] init];
return sharedInstance;
}

@end


Le 2 juil. 08 à 00:35, Daniel Richman a écrit :


Hi All,

I have created a class (call it Foo) that there will be one and only  
one instance of (call it Bar). I need some way to have Foo keep a  
pointer to Bar, so when another object asks for the pointer to Bar,  
Foo will be able to return the pointer.


Presumably this can be done, as NSNotificationCenter has the  
defaultCenter method. But I don't know how to go about it. Any ideas?


Daniel
___

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/devlists%40shadowlab.org

This email sent to [EMAIL PROTECTED]





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]

class keeps track of object

2008-07-01 Thread Daniel Richman

Hi All,

I have created a class (call it Foo) that there will be one and only one 
instance of (call it Bar). I need some way to have Foo keep a pointer to 
Bar, so when another object asks for the pointer to Bar, Foo will be 
able to return the pointer.


Presumably this can be done, as NSNotificationCenter has the 
defaultCenter method. But I don't know how to go about it. Any ideas?


Daniel
___

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: KVO Bug With Keypaths

2008-07-01 Thread Keary Suska
7/1/08 3:57 PM, also sprach [EMAIL PROTECTED]:

> On Tue, Jul 1, 2008 at 5:26 PM, Keary Suska <[EMAIL PROTECTED]> wrote:
>> I think so. "relations" and "content" are read-only (no public setters).
>> Notifications aren't sent for them as they are never changed throughout the
>> lifecycle of an object. I.e., they are both dictionaries, and only their
>> contents, not the properties themselves, may vary. Would this be an issue?
> 
> Yes, if the dictionaries are modified directly rather than using
> -setValue:forKeyPath:.

When I modify their contents, they are modified using setObject:forKey:,
which I issues KVO notifications, IIRC. At least I know it does in certain
situations, as rely on that behavior in a number of places.

I also mistyped the key path. The observed object is "relations", the path
is "order.related.content.status.value". That may make a difference.

Best,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


___

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 background i/o and notify main UI thread

2008-07-01 Thread Douglas Davidson


On Jul 1, 2008, at 3:11 PM, Chris Irvine wrote:

I've been doing a lot of reading about this, but I still don't feel  
like I have a concise answer. I'm building a small suite of  
applications that all will all share similar interaction with a UDP  
based network based peer. It will be necessary to have various  
background threaded activities to keep the connection alive and  
monitored. I've already built a small proof of concept using a  
separate C program that does standard i/o and can be managed by a  
the Cocoa front end using NSTask. This is somewhat limiting and  
isn't portable to our most favorite mobile device.


If your need is for the receipt of UDP packets, CFSocket provides a  
run loop source that can handle that.


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]


Cocoa Programming for Mac OS X (2nd Edition) soultons

2008-07-01 Thread jeffs87

Hi,

Does anyone know where I can get the solutions for the 2nd Edition of 
Aaron Hillegass's book Cocoa Programming for Mac OS X?  Big Nerd Ranch 
only has the 3rd edition solutions.


thanks
Jeff

___

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]


Best way to handle background i/o and notify main UI thread

2008-07-01 Thread Chris Irvine
I've been doing a lot of reading about this, but I still don't feel  
like I have a concise answer. I'm building a small suite of  
applications that all will all share similar interaction with a UDP  
based network based peer. It will be necessary to have various  
background threaded activities to keep the connection alive and  
monitored. I've already built a small proof of concept using a  
separate C program that does standard i/o and can be managed by a the  
Cocoa front end using NSTask. This is somewhat limiting and isn't  
portable to our most favorite mobile device.


It seemed ideal to me to write a class that would provide an opaque  
API to handle this communication with an interface very similar to  
NSFileHandle and methods like readInBackgroundAndNotify. But the more  
I get into it, inter-thread notifications aren't really straight  
forward. I've read archived posts about different ways that  
NSFileHandle might be implemented. I guess I'm just curious what the  
best practice would be for me.


Requirements:
1. Asynchronous i/o using UDP,  I'd kinda prefer C-style BSD sockets  
for this.

2. Self contained module, easily reused in multiple apps.
3. Lightweight communication of very small payloads to the main thread  
where UI can be updated

4. Portable (works on Mac or iPhone)
5. I don't require really require multi-sender or multi-receiver.

Distributed Objects - seems like overkill for my small requirements

NSDistributedNotifcationCenter - discouraged for intra-process  
communication


Configure a new main run loop source - I'd have to do a lot more  
reading to understand that. Doesn't seem like code that would be  
easily reusable.


NSOperation - I only have a single ongoing task. I don't think I need  
a queue of 1.


NSThread & performSelectorOnMainThread: - Doesn't seem as opaque and  
flexible as NSFileHandle style API with notifications. This is what  
I'm leaning toward at the moment.


Something else I'm not thinking of? Suggestions?

-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: Correct Order for CFRelease-ing CFNetwork Refs?

2008-07-01 Thread Kyle Sluder
On Tue, Jul 1, 2008 at 5:49 PM, Michael Ash <[EMAIL PROTECTED]> wrote:
> Since that function contains "Create", you already own it. CFRetaining
> it will just require you to CFRelease it twice, which is pointless.

That's why I asked, to make sure that if he had obtained it somehow
other than the Create function.

--Kyle Sluder
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: KVO Bug With Keypaths

2008-07-01 Thread Kyle Sluder
On Tue, Jul 1, 2008 at 5:26 PM, Keary Suska <[EMAIL PROTECTED]> wrote:
> I think so. "relations" and "content" are read-only (no public setters).
> Notifications aren't sent for them as they are never changed throughout the
> lifecycle of an object. I.e., they are both dictionaries, and only their
> contents, not the properties themselves, may vary. Would this be an issue?

Yes, if the dictionaries are modified directly rather than using
-setValue:forKeyPath:.

--Kyle Sluder
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Correct Order for CFRelease-ing CFNetwork Refs?

2008-07-01 Thread Michael Ash
On Tue, Jul 1, 2008 at 1:09 PM, Kyle Sluder
<[EMAIL PROTECTED]> wrote:
> There won't be any documentation regarding allocating and deallocating
> most objects, because, like Cocoa, Core Foundation religiously follows
> a memory management scheme known as the Create Rule.
...
> How did you create your auth ref?
> CFHTTPAuthenticationCreateFromResponse?  It seems that you have
> forgotten to CFRetain it (when you store it somewhere is the most
> likely place) and freeing the request is releasing the auth ref which
> is also being freed.

Since that function contains "Create", you already own it. CFRetaining
it will just require you to CFRelease it twice, which is pointless.

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

This email sent to [EMAIL PROTECTED]


Detecting a double click outside the table

2008-07-01 Thread Damien Cooke

Hi all,
I have a window that has a custom NSTableView and an image cell. I  
have used this [tableView setDoubleAction: @selector(doubleAction:)];  
to set the double action.  The issue is that I have a method in the  
tableview that the window controller can use to determine if a double  
click has occurred, I check this in the delegate  (BOOL)tableView: 
(NSTableView *)aTableView shouldSelectRow:(NSInteger)rowIndex but it  
only works on the third click because it gets called every time I  
click.  There has to be a better way of detecting the double click in  
the tableview and telling my controller class this has happened.  Can  
someone point me in the right direction?


Regards
Damien
___

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: Scaled Printing

2008-07-01 Thread Scott Ribe
My apologies, I was thinking of auto-scaling.


-- 
Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice


___

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]


[TEST] Test with an orange.com address

2008-07-01 Thread Stéphane Sudre

Test


___

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: KVO Bug With Keypaths

2008-07-01 Thread Keary Suska
7/1/08 3:01 PM, also sprach [EMAIL PROTECTED]:

> On Tue, Jul 1, 2008 at 9:50 PM, Keary Suska <[EMAIL PROTECTED]> wrote:
> 
>> I thought I saw somewhere a bug in KVO where notifications aren't properly
>> sent in certain situations when "upper" parts of the path are updated. E.g.,
>> I have a situation where is am observing a keypath
>> "relations.related.content.status.value" but notifications aren't sent when
>> "related" is changed (in a KVO-compliant way).
> 
> Is every part of the key path KVO compliant? If not, the whole chain is
> broken.

I think so. "relations" and "content" are read-only (no public setters).
Notifications aren't sent for them as they are never changed throughout the
lifecycle of an object. I.e., they are both dictionaries, and only their
contents, not the properties themselves, may vary. Would this be an issue?

> Is any part of the key path a descendant of NSObjectController? If so,
> the whole chain may be broken ;)

Nope.

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


___

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: [Q] Status Bar icon and Tiger

2008-07-01 Thread JongAm Park

Hello, all.

I solved this problem for myself.

The reason was that the Tiger behaves differently from the Leopard.
On a Tiger ( MacPro 2 2.66Ghz DualCore Intel Xeon processor ), it needed 
a call setScalesWhenResized: .


So the whole code looks like :

NSSize imageSize;
activeCompanyImage = [[NSImage alloc] 
initWithContentsOfFile:activeCompanyImagePath];

imageSize = [activeCompanyImage size];
imageSize.width *= 0.3;
imageSize.height *= 0.3;
[activeCompanyImage *setScalesWhenResized*:YES]; // This line is 
additional for the Tiger

[activeCompanyImage setSize:imageSize];

I would like to report this.
Should it be a bug? Or just some note on the documentation can be enough?
___

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: [Q] Status Bar icon and Tiger

2008-07-01 Thread JongAm Park

Hello, all.

I solved this problem for myself.

The reason was that the Tiger behaves differently from the Leopard.
On a Tiger ( MacPro 2 2.66Ghz DualCore Intel Xeon processor ), it needed 
a call setScalesWhenResized: .


So the whole code looks like :

NSSize imageSize;
activeCompanyImage = [[NSImage alloc] 
initWithContentsOfFile:activeCompanyImagePath];

imageSize = [activeCompanyImage size];
imageSize.width *= 0.3;
imageSize.height *= 0.3;
[activeCompanyImage *setScalesWhenReseizd*:YES]; // This line is 
additional for the Tiger

[activeCompanyImage setSize:imageSize];

I would like to report this.
Should it be a bug? Or just some note on the documentation can be enough?
___

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: KVO Bug With Keypaths

2008-07-01 Thread Hamish Allan
On Tue, Jul 1, 2008 at 9:50 PM, Keary Suska <[EMAIL PROTECTED]> wrote:

> I thought I saw somewhere a bug in KVO where notifications aren't properly
> sent in certain situations when "upper" parts of the path are updated. E.g.,
> I have a situation where is am observing a keypath
> "relations.related.content.status.value" but notifications aren't sent when
> "related" is changed (in a KVO-compliant way).

Is every part of the key path KVO compliant? If not, the whole chain is broken.

Is any part of the key path a descendant of NSObjectController? If so,
the whole chain may be broken ;)

Hamish
___

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: Scaled Printing

2008-07-01 Thread John Nairn


On Jul 1, 2008, at 10:29 AM, Scott Ribe wrote:


but the view
always prints at 100% and thus scaling does not print correctly


Yeah, you're dividing by the scaling factor, thus negating the  
scaling. IOW,
user wants to print at 0.75, you divide by 0.75 thus scaling your  
own page
area *up*, then the printing system multiplies by 0.75, and there  
you have

it: drawing at 1.0.


But, I got that from sample code in the "Printing" topic of the  
Apple's cocoa documentation?


Nevertheless, I tried not dividing by the scaling and it still draws  
at 100%. Furthermore it calculated the number of pages incorrectly.  
For example, I had one printing that spanned 2 pages in horizontal  
direction and 2 pages in vertical direction. Printing at 50% should  
fit it all on to one page. If I remove the divide by scaling,  the  
knowsPageRange method always returns 4 pages and does not change when  
the scaling changes?


So I tried a different approach and have it solved (an unsatisfying  
solution, however, in that I still don't know why the other way failed).


Instead of overriding knowsPageRange and rectForPage, I overrode

- (void)adjustPageHeightNew:(float *)newBottom top:(float)top bottom: 
(float)proposedBottom limit:(float)bottomLimit

{   *newBottom=proposedBottom
}

and similarly for width. This uses the initial proposed setting, which  
came from my margin settings, while the default method would check all  
subviews and usually move the page break. I wanted to fill the paper  
even if it meant going through subviews and this change solved that  
problem. This way scales correctly as well.


---
John Nairn (1-541-737-4265, FAX:1-541-737-3385)
Professor and Richardson Chair
Web Page: http://woodscience.oregonstate.edu/faculty/Nairn
FEA/MPM Web Page: http://oregonstate.edu/~nairnj



___

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]


KVO Bug With Keypaths

2008-07-01 Thread Keary Suska
I thought I saw somewhere a bug in KVO where notifications aren't properly
sent in certain situations when "upper" parts of the path are updated. E.g.,
I have a situation where is am observing a keypath
"relations.related.content.status.value" but notifications aren't sent when
"related" is changed (in a KVO-compliant way).

Is anyone aware of this, or is it just a limitation of KVO?

TIA,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


___

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: [Q] Status Bar icon and Tiger

2008-07-01 Thread JongAm Park


Hello. Thanks for your comment.

The problem is about scaling.
So, on a leopard, the big eps image was scaled to its 30% size 
correctly, but on a Tiger, it doesn't.

it seems to be displayed as is.

(Peter Ammon, I'm sorry that I posted somewhat half-written inquiry. I 
hit a "return" key while I was moving my stuff. )


A screenshot taken on a Tiger is attached, so I hope it would reveal the 
problem.


Thank you.


<>___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: [Q] Status Bar icon and Tiger

2008-07-01 Thread JongAm Park

Hello. Thanks for your comment.

The problem is about scaling.
So, on a leopard, the big eps image was scaled to its 30% size 
correctly, but on a Tiger, it doesn't.

it seems to be displayed as is.

(Peter Ammon, I'm sorry that I posted somewhat half-written inquiry. I 
hit a "return" key while I was moving my stuff. )


A screenshot taken on a Tiger is attached, so I hope it would reveal the 
problem.


Thank you.
<>___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: exec(uting) Safari - How (newbie)

2008-07-01 Thread Clark Cox
On Tue, Jul 1, 2008 at 11:04 AM, Gregory Weston <[EMAIL PROTECTED]> wrote:
> Barrie Green wrote:
>
>> Hi all,
>>
>> I want to write a quick little cocoa app that fires off Safari.
>>
>> ...
>>
>> Ideally I would like to run the app without it asking me for my
>> password, how could I achieve that?
>
> Considering that I can think of no common purpose for "launch Safari" that
> doesn't continue with "and show the contents of a designated file or URL"
> I'll point out that the proper way to achieve that goal is NSWorkspace's
> openURL: method. But I'll caution that it doesn't necessarily launch Safari;
> it launches the user's default web browser.

Also note that exec'ing an application and launching it are two very
different things. Running a Mac application via exec is almost never
the right thing to do. Use the appropriate NSWorkspace call (either
openURL: or launchApplication:) and forget about exec.




-- 
Clark S. Cox III
[EMAIL PROTECTED]
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Correct Order for CFRelease-ing CFNetwork Refs?

2008-07-01 Thread Jonathan Hohle
>
> The Core Foundation Ownership Policy is actually specified in terms of a
> naming convention similar to that for Cocoa and defined by two rules, the
> Create Rule and the Get Rule:
>

> <
> http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/Concepts/Ownership.html
> >.


I looked at it again, and couldn't reproduce the crashes. I spent a while
yesterday, however, ensuring My Create/Copy/Retains were all properly
matched with Release's.

Unfortunately, I'm not running into an issue where otest fails (tests don't
fail, but otest reports an non-zero exit status with messages about a
ReplicaData class), but running the program doesn't when run.

Thanks for the help!

-- 
Jon
<><
___

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: Why aren't my bindings firing?

2008-07-01 Thread Hamish Allan
On Tue, Jul 1, 2008 at 12:56 AM, Michael Ash <[EMAIL PROTECTED]> wrote:

> However, if you're curious about what Apple does, it shouldn't be too
> hard to find out. You know one thing that happens reliably: your
> model's key is set. So set up a test app, put a breakpoint on the
> model's setter, then see what's calling it. The rest should follow
> from there.

This gets you into a whole world of wondering why _NSBindingAdapter,
NSValueBinder, NSBinder etc. exist. I think I'll leave that for now!

I do wonder, incidentally, why the NSKeyValueBindingCreation category
of NSObject is in AppKit rather than Foundation.

Hamish
___

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: [Q] Status Bar icon and Tiger

2008-07-01 Thread Nathan Kinsinger


On Jul 1, 2008, at 8:53 AM, JongAm Park wrote:


Hello, all.

Can anyone help me to figure out an issue regarding to a status menu  
width issue on Tiger?

The project I work on is for the Tiger and the Leopard.

I used this code to set an icon, which is longer horizontally than  
vertically, and it worked on the Leopard.


NSStatusBar *statusBar = [NSStatusBar systemStatusBar];

// Because it is a eps version of our company's name, it is longer  
horizontally. So, I used

// NSVariableStatusItemLength instead of NSSquareStatusItemLength
statusBarItem = [[statusBar statusItemWithLength:  
NSVariableStatusItemLength] retain];


[statusBarItem setImage:inactiveCompanyImage];
[statusBarItem setEnabled:YES];
[statusBarItem setToolTip:@"Blah blah.."];
[statusBarItem setHighlightMode:YES];

It works nicely with the Leopard, but our support team people say  
that it doesn't with the Tiger.
I'm suspicious if they use a small status bar program for displaying  
CPU temperature, etc.

(During the ToolBox era, I noticed such a case.. )

I would appreciate any help.

Thank you.


In my status menu I set the width a little larger than the image, I  
seem to recall needing to do that to make the spacing between items  
look right, but I'm not sure now. In the line below change the number  
at the end to make things look right (8.0 is what I'm using).


	statusBarItem = [[statusBar statusItemWithLength:  
([inactiveCompanyImage size].width + 8.0)] retain];


There is also a setLength: method if you change the image size later  
in your program.


--Nathan


___

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]


PDF printing now blurry

2008-07-01 Thread John MacMullin
I have an application that under Tiger assembled print images, scaled  
them with NSImage, and printed a PDF to a file ([[printInfo  
dictionary] setObject:filePathString forKey:NSPrintSavePath];).  The  
print images were always clear under Tiger.


Under Leopard, 10.5.3, the last page of a multipage document is  
blurry; if the document is one page, it is blurry.


Anyone seen this before or have any suggestions?

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: How to make the FileOwner of a nib file accessible globally in whole project (was Re: Cocoa-dev Digest, Vol 5, Issue 1168)

2008-07-01 Thread Andy Lee

On Jul 1, 2008, at 3:01 PM, JArod Wen wrote:
A way I can find from my head is setting the instant variable in  
other classes... So all the related classes should have one instant  
variable like


MovieDocument *movieDocument;

And also the getter and setter. Is there any other way for this  
purpose?


This sounds right for you.

When one object X is supposed to know about another object Y, using an  
instance variable is generally the right approach.


If there is only one instance of Y in the whole program, sometimes a  
global variable is a reasonable approach, or a singleton instance that  
can be retrieved by a class method.  But this is usually not the right  
approach for objects that are treated as documents, because an  
application can usually open multiple documents.


There are other ways objects can know about each other, like KVO and  
bindings.  Sometimes X doesn't need to know about Y all the time, only  
when certain messages are sent, in which case Y can be passed as an  
argument in the message.


But the most natural approach in most cases is an instance variable.

I don't know much about using NSDocument, so if you have questions  
about that perhaps others can help.


--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: How to make the FileOwner of a nib file accessible globally in whole project (JArod Wen)

2008-07-01 Thread Andy Lee
Please don't repeat a question over and over.  Some questions get  
answered right away, some take longer, others never get answered at  
all.  It is up to the people on the list who are volunteering their  
time.


I replied to your second post, not because you repeated the question,  
but because that's when I had some time to answer.  Please see my  
answer.


--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: How to make the FileOwner of a nib file accessible globally in whole project (was Re: Cocoa-dev Digest, Vol 5, Issue 1168)

2008-07-01 Thread JArod Wen

Thanks for your fast reply.

On Jul 1, 2008, at 2:36 PM, Andy Lee wrote:


On Jul 1, 2008, at 2:07 PM, JArod Wen wrote:
I need to make some clearance on this problem: the biggest issue is  
that MovieDocument is instantiated by IB, since it is the FileOwner  
of the MovieDocument.nib. So the problem should be: is there a way  
to access a class from a method of another class when the

first class is instantiated from a NIB file.


Either I am misunderstanding you or you are misunderstanding how  
File's Owner works.  File's Owner is *not* instantiated by loading  
the nib.


Yes you are right. I make mistake on this point. I constructed the  
project as a cocoa-based NSDocument project, and MovieDocument.mm is  
the first class from NSDocument. So in fact it is instantiated by the  
application, right? But for other nibs, file's owner should be  
initialized before setting it as a file's owner, right?





Here's an explanation I gave earlier, with a few edits:

Unlike most other objects in a nib file (First Responder being the  
other exception), File's Owner is not a specific object.  It is a  
placeholder for an "owner" object that will be specified when the  
nib file is loaded by your program.


You edit a nib file knowing the file will be loaded at some point  
when your program is running, and *at that future time* you will  
specify the owner of the file (hence "File's Owner" -- it's the  
second argument to loadNibNamed:owner:).  It will be an object that  
your program created prior to loading the nib.


The File's Owner gives your program access to the objects in the  
nib file, through the connections you made to it in the nib.



So making your MovieDocument object visible to other classes isn't  
really affected by the fact that it's a File's Owner for a nib.  You  
can use any of the techniques you'd normally use in code to make one  
object visible to another.


A way I can find from my head is setting the instant variable in other  
classes... So all the related classes should have one instant variable  
like


MovieDocument *movieDocument;

And also the getter and setter. Is there any other way for this purpose?




Note also that a given object can be File's Owner for more than one  
nib, if that helps.


--Andy




Thanks Andy!
---
JArod Wen




___

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 make the FileOwner of a nib file accessible globally in whole project (JArod Wen)

2008-07-01 Thread JArod Wen
I need to make some clearance on this problem: the biggest issue is  
that MovieDocument is instantiated by IB, since it is the FileOwner of  
the MovieDocument.nib. So the problem should be: is there a way to  
access a class from a method of another class when the

first class is instantiated from a NIB file.

I am now trying to set an IBOutlet in the other classes for  
MovieDocument. It is the only way I can find from my brain... Frankly  
say, I am a real newbie...


sorry for any confusion...


Hi Jedis,

Here is my problem: my application now have a main nib file
MovieDocument.nib with its FileOwner MovieDocument.mm(We used
AVCVideoServices which requires to be in a c++ source file). I need to
send messages to the methods in MovieDocument.mm from other classes in
the project(I have many other windows and also corresponding
controllers), so i need a way to access the movieDocument globally.

One example: there is another controller VideoController.m which
contains some measurement methods on the movie loaded in
movieDocument. Once we finish the measurement in VideoController, we
need to update the movie in MovieDocument, where we need to send
message to the methods in MovieDocument.

This is from VideoController.m

- (void)writeMeasureOutput:(MeasureView *)sender
{
// Some measurement code here...

object = [[movieDocument measureView]   whatsNext];

NSLog(@"Next measurement: %@",object);

}

Such calls should be used in many other controllers in the projects.
So the instant of MovieDocument should be accessed globally.

I have tried to instantiate MovieDocument in MovieDocument.h, but it
is clearly wrong since when the header file is imported, the instant
will be created once.

So any suggestion on this problem? Thanks in advance!

---
JArod Wen


---
JArod Wen




___

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 make the FileOwner of a nib file accessible globally in whole project

2008-07-01 Thread JArod Wen
I need to make some clearance on this problem: the biggest issue is  
that MovieDocument is instantiated by IB, since it is the FileOwner of  
the MovieDocument.nib. So the problem should be: is there a way to  
access a class from a method of another class when the

first class is instantiated from a NIB file.

I am now trying to set an IBOutlet in the other classes for  
MovieDocument. It is the only way I can find from my brain... Frankly  
say, I am a real newbie...


sorry for any confusion... If there were any repeated posts, please  
forgive me...


On Jul 1, 2008, at 12:35 PM, [EMAIL PROTECTED] wrote:


Message: 8
Date: Tue, 1 Jul 2008 12:05:43 -0400
From: JArod Wen <[EMAIL PROTECTED]>
Subject: How to make the FileOwner of a nib file accessible globally
in  whole project
To: cocoa-dev@lists.apple.com
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain;   charset=US-ASCII;   format=flowed;  
delsp=yes

Hi Jedis,

Here is my problem: my application now have a main nib file
MovieDocument.nib with its FileOwner MovieDocument.mm(We used
AVCVideoServices which requires to be in a c++ source file). I need to
send messages to the methods in MovieDocument.mm from other classes in
the project(I have many other windows and also corresponding
controllers), so i need a way to access the movieDocument globally.

One example: there is another controller VideoController.m which
contains some measurement methods on the movie loaded in
movieDocument. Once we finish the measurement in VideoController, we
need to update the movie in MovieDocument, where we need to send
message to the methods in MovieDocument.

This is from VideoController.m

- (void)writeMeasureOutput:(MeasureView *)sender
{
// Some measurement code here...

object = [[movieDocument measureView]   whatsNext];

NSLog(@"Next measurement: %@",object);

}

Such calls should be used in many other controllers in the projects.
So the instant of MovieDocument should be accessed globally.

I have tried to instantiate MovieDocument in MovieDocument.h, but it
is clearly wrong since when the header file is imported, the instant
will be created once.

So any suggestion on this problem? Thanks in advance!

---
JArod Wen


---
JArod Wen




___

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: Struct, Object, or Dictionary?

2008-07-01 Thread lbland

hi-

If you have to bind your entities to anything then you might try a  
Core Data representation.


If you have multiple entities and need to store in a list then a  
dictionary or class would be best as NSArray, etc. takes ids and  
there is no easy store for multiple structs, unless you role your own.


The Core Data would be New-Cocoa-Cool IMHO.

thanks!-

-lance


On Jul 1, 2008, at 1:53 PM, Bridger Maxwell wrote:


Hey,
I have been debating using one method over another for a while now,  
and I
would like to know what the Cocoa way of doing things is. I need to  
group a
set of data together to use as one entity. In one program I was  
representing
a puzzle as four strings and a BOOL. My first thought would be to  
represent
these as a struct. However, the strings within the struct would  
have to be
memory managed, so I guess that would mean writing my own methods  
to retain,
release, autorelease, etc. the struct. My second option in this  
case is to
declare an object that would contain all of those data members as  
ivars, and
the memory management would be taken care of. However, it doesn't  
seem right
to make an object that only has data and no methods. My third  
option would

be to store all of the data in dictionary pairs. This doesn't seem as
reliable as the last methods though, because there is no guarantee  
that the
dictionary would contain all the necessary name/value pairs. What  
is the

"correct" way to do this in Cocoa?

Thank You,
Bridger Maxwell
___

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/lbland%40vvi.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: Struct, Object, or Dictionary?

2008-07-01 Thread Bridger Maxwell
Object, class, method, function Obviously I am not very good at this
computer talk :P
Anyway, thanks for all of your answers. It has really cleared some things up
for me. I will be using the object approach.
___

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]


Bindings - registering change notification for multiple keys

2008-07-01 Thread dreamcat7

Hi,
I have my application's data and settings stored in 2 plist file, each  
containing several/many keys.*


I would like to to save the changed items permanently in my data store  
after the user interacts with the ui. Control elements are bound to a  
settings NSDictionary in my data model.



For any bindings notifications, the following method

- (void)registerAsObserver
{
[model addObserver:self forKeyPath:@"prefs.debug"
			   options:(NSKeyValueObservingOptionNew |  
NSKeyValueObservingOptionOld)

   context:NULL];
}

will only register for observing one value at a time. However I may  
have a wide variety of controls and settings that need to trigger the  
same code to write out the dictionary to the plist file (or to any  
arbitrary data storage mechanism i might use). And cant write anything  
like  @"prefs.*" because this syntax does not constitute a valid key- 
path.

And if there is any way to listen for all values within a path or set.

So i am looking at other ways. Can you listen for all objects held by  
an NSArray ? This might be a useful alternative.
Although probably very expensive to convert between NSDictionary <=>  
NSArray each time an element was changed.
But i might try to change my data representation and avoid the  
NSDictionary altogether.


Of course there is the method setKeys:  
triggerChangeNotificationsForDependentKey: however i did find all the  
explanations about this really difficult to follow.  Awhile back i  
tried doing with the apple example but unfortunately no luck. And  
don't the array of triggering keys need to be first registered  
individually anyway ? (perhaps thats why it failed to work for me).


Has anybody had successes with these or other method for multiple keys ?


*Note - no core data yet as i am a newbie and having core data in my  
app would be alot do all at once.
But if this kind of issue is solved by a core data feature please let  
me know.


___

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: NSDateComponents question

2008-07-01 Thread mmalc crawford


On Jul 1, 2008, at 10:44 AM, Chris Kane wrote:

My apologies; I did do some testing and found that the resultant  
date was always correct.

Could you elaborate on what circumstances this might not be correct?
Did you try starting with a starting date of  Jan 1, 2009?  The  
Weekday would be 5, the Day 1.



Rats, no; I tried the dates at the beginning of 2008, 2003, and 1999...


The previous Sunday is December 28, 2008.


... although, hmm, yes, that's the result I get(*).  Nevertheless...

Passing a Year, Month, Day of (2009, 1, -3)  (-3 == 1 - (5 - 1) in  
your original computation) is passing an out-of-bounds value with  
dateWithComponents:, with who-knows-what effect.  It might be well- 
defined, it might not be.  The result might change between OS  
releases.  In other words, it seems a bit ambiguous, so best to just  
avoid it.



... point taken.  I'll update the documentation accordingly.

mmalc


(*)
NSDateComponents *components = [[NSDateComponents alloc] init];
[components setYear:2009];
[components setMonth:1];
[components setDay:1];
NSDate *testDate = [gregorian dateFromComponents:comps];
[components release];

NSDateComponents *components = [gregorian  
components:NSWeekdayCalendarUnit | NSYearCalendarUnit |  
NSMonthCalendarUnit | NSDayCalendarUnit fromDate:testDate];


NSLog(@"day: %d, weekDay: %d, delta: %d", [components day],  
[components weekday], [components day] - [components weekday]);

// day: 1, weekDay: 5, delta: -4

[components setDay:([components day] - ([components weekday] -  
1))];

[components setWeekday:NSUndefinedDateComponent];

NSDate *beginningOfWeek = [gregorian  
dateFromComponents:components];

NSLog(@"beginningOfWeek: %@", beginningOfWeek);
// beginningOfWeek: 2008-12-28 00:00:00 -0800

___

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: Struct, Object, or Dictionary?

2008-07-01 Thread Andy Lee

On Jul 1, 2008, at 1:53 PM, Bridger Maxwell wrote:


Hey,
I have been debating using one method over another for a while now,  
and I
would like to know what the Cocoa way of doing things is. I need to  
group a
set of data together to use as one entity. In one program I was  
representing

a puzzle as four strings and a BOOL.




My first thought would be to represent
these as a struct. However, the strings within the struct would have  
to be
memory managed, so I guess that would mean writing my own methods to  
retain,

release, autorelease, etc. the struct.


I think you mean functions, as in C functions, rather than methods,  
unless you mean you would create a class that has methods for  
manipulating the struct -- in which case you might as well put the  
data into instance variables of the class in the first place, and  
there is no need for a struct.


The struct approach is bad because you can't actually do the memory  
management right in the general case.  For example you can copy a  
struct using assignment -- myStructOne = myStruct2 -- and now you have  
increased the number of references to the strings inside the structs,  
but you haven't retaining those strings an extra time.  Similarly if  
you pass a struct by value as an argument to a function or method.



My second option in this case is to
declare an object that would contain all of those data members as  
ivars, and
the memory management would be taken care of. However, it doesn't  
seem right

to make an object that only has data and no methods.


Even if you use properties and the dot notation, your class would  
still have methods for getting and setting its instance variables.   
The compiler creates the methods for you and they are implicitly  
called when you do something like myObject.myString = @"hello".  It is  
perfectly okay to have a class whose only methods are accessor methods  
(getters and setters for its properties).  This is the approach you  
should take.



My third option would
be to store all of the data in dictionary pairs. This doesn't seem as
reliable as the last methods though, because there is no guarantee  
that the

dictionary would contain all the necessary name/value pairs.


There is a time and place for the dictionary approach -- Cocoa does it  
in a few places -- but the previous approach is almost always the  
right one.


--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]


How to make the FileOwner of a nib file accessible globally in whole project (was Re: Cocoa-dev Digest, Vol 5, Issue 1168)

2008-07-01 Thread Andy Lee

On Jul 1, 2008, at 2:07 PM, JArod Wen wrote:
I need to make some clearance on this problem: the biggest issue is  
that MovieDocument is instantiated by IB, since it is the FileOwner  
of the MovieDocument.nib. So the problem should be: is there a way  
to access a class from a method of another class when the

first class is instantiated from a NIB file.


Either I am misunderstanding you or you are misunderstanding how  
File's Owner works.  File's Owner is *not* instantiated by loading the  
nib.


Here's an explanation I gave earlier, with a few edits:

Unlike most other objects in a nib file (First Responder being the  
other exception), File's Owner is not a specific object.  It is a  
placeholder for an "owner" object that will be specified when the  
nib file is loaded by your program.


You edit a nib file knowing the file will be loaded at some point  
when your program is running, and *at that future time* you will  
specify the owner of the file (hence "File's Owner" -- it's the  
second argument to loadNibNamed:owner:).  It will be an object that  
your program created prior to loading the nib.


The File's Owner gives your program access to the objects in the nib  
file, through the connections you made to it in the nib.



So making your MovieDocument object visible to other classes isn't  
really affected by the fact that it's a File's Owner for a nib.  You  
can use any of the techniques you'd normally use in code to make one  
object visible to another.


Note also that a given object can be File's Owner for more than one  
nib, if that helps.


--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: [Q] Status Bar icon and Tiger

2008-07-01 Thread Peter Ammon

On Jul 1, 2008, at 7:53 AM, JongAm Park wrote:


Hello, all.

Can anyone help me to figure out an issue regarding to a status menu  
width issue on Tiger?

The project I work on is for the Tiger and the Leopard.


[...]

It works nicely with the Leopard, but our support team people say  
that it doesn't with the Tiger.
I'm suspicious if they use a small status bar program for displaying  
CPU temperature, etc.

(During the ToolBox era, I noticed such a case.. )


Can you please describe how it fails on Tiger?

Thanks,
-Peter

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Struct, Object, or Dictionary?

2008-07-01 Thread Keary Suska
7/1/08 11:53 AM, also sprach [EMAIL PROTECTED]:

> I have been debating using one method over another for a while now, and I
> would like to know what the Cocoa way of doing things is. I need to group a
> set of data together to use as one entity. In one program I was representing
> a puzzle as four strings and a BOOL. My first thought would be to represent
> these as a struct. However, the strings within the struct would have to be
> memory managed, so I guess that would mean writing my own methods to retain,
> release, autorelease, etc. the struct. My second option in this case is to
> declare an object that would contain all of those data members as ivars, and
> the memory management would be taken care of. However, it doesn't seem right
> to make an object that only has data and no methods. My third option would
> be to store all of the data in dictionary pairs. This doesn't seem as
> reliable as the last methods though, because there is no guarantee that the
> dictionary would contain all the necessary name/value pairs. What is the
> "correct" way to do this in Cocoa?

I don't know that a "Cocoa" way exists for this kind of thing, per se, but I
would look at it in a more OOP and "why reinvent the wheel" approach. That
would call for an NSDictionary. In short, I would start with generic,
existing classes first.

As a general rule, when I have a situation where I need a group of data
items to be kept together and passed around, I would consider these in
order:

1. If all data values are Objective-C types or string literals, then a
struct is probably appropriate;

2. If *all* (or most) data values are objects, and no special handling (such
as validation) is needed, then an NSDictionary is probably appropriate;

3. At this point, I am usually looking at a custom object, but only if I
expect to have a number of them. If there is only one, there is likely
something wrong with my design, and I need to refactor.

4. Lastly, and I have it here because of its non-trivial implementation, is
to consider Core data. This is most appropriate with object graphs of some
complexity. You get a lot "for free" (without code), including basic (but
flexible) validation and undo support.

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


___

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: Struct, Object, or Dictionary?

2008-07-01 Thread James Bucanek
Bridger Maxwell  wrote (Tuesday, 
July 1, 2008 10:53 AM -0600):

My second option in this case is to
declare an object that would contain all of those data members as ivars, and
the memory management would be taken care of.


Class


However, it doesn't seem right
to make an object that only has data and no methods. My third option would
be to store all of the data in dictionary pairs. This doesn't seem as
reliable as the last methods though, because there is no guarantee that the
dictionary would contain all the necessary name/value pairs. What is the
"correct" way to do this in Cocoa?


You just answered your own reservation. If the class has any 
"business logic" (i.e. default values, ensuring that certain 
data value are present, maintaining a valid state, releasing the 
objects when done) then the class will most certainly have 
methods, even if it's only init and dealloc.


As a general rule, any well defined data entity should be 
defined as a class. Especially if there's any chance that 
behavior of that data object will need to change at some point 
in the future. Good OO programming would encourage you to wrap 
all of the member values in accessor methods, which makes it 
easy to redefine them in the future. This also allows you to 
bind to and observe the values. If you're using Obj-C 2.0 use properties.


Structs are typically used when you need tight control over how 
the data is stored/allocated or if you must have a non-object 
data blob that you need to pass around by value (e.g. NSRect).


Dictionaries are good for dynamic structures, where you don't 
necessarily know or care about what kind or how many values it contains.


--
James Bucanek

___

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]


[MEETING] Toronto Area Cocoa & WebObjects Developer Group - July 8

2008-07-01 Thread Karl Moskowski
The next meeting of tacow/Toronto CocoaHeads will be held on Tuesday,  
July 8 at 6:30 PM at Ryerson University.


First, David Leber will be leading a recap of the publicly available  
info from WWDC and WOWODC.


Then, Brandon Walkin, who started the IndieHIG www.indiehig.com/>, has volunteered to present his latest project.  
He’s been working on a framework & Interface Builder plug–in with a  
collection of UI elements useful for modern Mac apps.


Up-to-date info and directions are available at .




Karl Moskowski <[EMAIL PROTECTED]>
Voodoo Ergonomics Inc. 





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: Cocoa-dev Digest, Vol 5, Issue 1168

2008-07-01 Thread JArod Wen
I need to make some clearance on this problem: the biggest issue is  
that MovieDocument is instantiated by IB, since it is the FileOwner of  
the MovieDocument.nib. So the problem should be: is there a way to  
access a class from a method of another class when the

first class is instantiated from a NIB file.

I am now trying to set an IBOutlet in the other classes for  
MovieDocument. It is the only way I can find from my brain... Frankly  
say, I am a real newbie...


sorry for any confusion...

On Jul 1, 2008, at 12:35 PM, [EMAIL PROTECTED] wrote:


Hi Jedis,

Here is my problem: my application now have a main nib file
MovieDocument.nib with its FileOwner MovieDocument.mm(We used
AVCVideoServices which requires to be in a c++ source file). I need to
send messages to the methods in MovieDocument.mm from other classes in
the project(I have many other windows and also corresponding
controllers), so i need a way to access the movieDocument globally.

One example: there is another controller VideoController.m which
contains some measurement methods on the movie loaded in
movieDocument. Once we finish the measurement in VideoController, we
need to update the movie in MovieDocument, where we need to send
message to the methods in MovieDocument.

This is from VideoController.m

- (void)writeMeasureOutput:(MeasureView *)sender
{
// Some measurement code here...

object = [[movieDocument measureView]   whatsNext];

NSLog(@"Next measurement: %@",object);

}

Such calls should be used in many other controllers in the projects.
So the instant of MovieDocument should be accessed globally.

I have tried to instantiate MovieDocument in MovieDocument.h, but it
is clearly wrong since when the header file is imported, the instant
will be created once.

So any suggestion on this problem? Thanks in advance!

---
JArod Wen


---
JArod Wen




___

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: exec(uting) Safari - How (newbie)

2008-07-01 Thread Gregory Weston

Barrie Green wrote:


Hi all,

I want to write a quick little cocoa app that fires off Safari.

...

Ideally I would like to run the app without it asking me for my
password, how could I achieve that?


Considering that I can think of no common purpose for "launch Safari"  
that doesn't continue with "and show the contents of a designated  
file or URL" I'll point out that the proper way to achieve that goal  
is NSWorkspace's openURL: method. But I'll caution that it doesn't  
necessarily launch Safari; it launches the user's default web browser.


___

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]


[Q] Regression of setSize for NSImage?

2008-07-01 Thread JongAm Park

Hello, all.

On the Leopard, I set a status bar item an icon with an eps image.
Because the eps image is somewhat big, I used the NSImage's size method 
to retrieve the size and

multiplied by 0.3 for its width and height.
And setSize method is called for the NSImage.

It works well on a Leopard machine, but on a Tiger it doesn't resized.
According to the document, the setSize has existed from 10.0.0.
Is this a bug? regression?

Thank you.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Struct, Object, or Dictionary?

2008-07-01 Thread Bridger Maxwell
Hey,
I have been debating using one method over another for a while now, and I
would like to know what the Cocoa way of doing things is. I need to group a
set of data together to use as one entity. In one program I was representing
a puzzle as four strings and a BOOL. My first thought would be to represent
these as a struct. However, the strings within the struct would have to be
memory managed, so I guess that would mean writing my own methods to retain,
release, autorelease, etc. the struct. My second option in this case is to
declare an object that would contain all of those data members as ivars, and
the memory management would be taken care of. However, it doesn't seem right
to make an object that only has data and no methods. My third option would
be to store all of the data in dictionary pairs. This doesn't seem as
reliable as the last methods though, because there is no guarantee that the
dictionary would contain all the necessary name/value pairs. What is the
"correct" way to do this in Cocoa?

Thank You,
Bridger Maxwell
___

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: exec(uting) Safari - How (newbie)

2008-07-01 Thread Ilan Volow
Another option (which may or may not work for you) is embedding a  
WebKit view in your application window and using that to display web  
stuff.


-- Ilan


On Jul 1, 2008, at 11:15 AM, Barrie Green wrote:


Hi all,

I want to write a quick little cocoa app that fires off Safari.

I started with something like

int main(int argc, char* argv[]) {
 ...
 ...
 if(execv("/Applications/Safari.app", someArgs) == -1) {
   NSLog(@"execv failed with %s", strerror(errno));
 }
}

It always fails with 'Permission denied', OK I kinda expect that. But
how do I fix it?

Would authorization would help? I've looked a the docs a little and it
would appear that I should do a
AuthorizationCreate/AuthorizationCopyRights shuffle but if so what
rights should I use?

Ideally I would like to run the app without it asking me for my
password, how could I achieve that?

TIA

bg
___

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/listboy%40clarux.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: NSDateComponents question

2008-07-01 Thread Chris Kane


On Jul 1, 2008, at 9:26, mmalc crawford wrote:


Hi Chris,

On Jul 1, 2008, at 9:10 AM, Christopher Kane wrote:

The more subtle and serious issue is that Sunday in the current  
week might be in the previous Month (so, Day < Weekday), or even  
previous Year, so setting the Day to a negative value and keeping  
the Month and Year the same will have ... "who knows what effect".


My apologies; I did do some testing and found that the resultant  
date was always correct.

Could you elaborate on what circumstances this might not be correct?



Did you try starting with a starting date of  Jan 1, 2009?  The  
Weekday would be 5, the Day 1.


January 2009
Su Mo Tu We Th Fr Sa
 1  2  3
 4  5  6  7  8  9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

The previous Sunday is December 28, 2008.

Passing a Year, Month, Day of (2009, 1, -3)  (-3 == 1 - (5 - 1) in  
your original computation) is passing an out-of-bounds value with  
dateWithComponents:, with who-knows-what effect.  It might be well- 
defined, it might not be.  The result might change between OS  
releases.  In other words, it seems a bit ambiguous, so best to just  
avoid it.



Chris Kane
Cocoa Frameworks, Apple

___

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: Scaled Printing

2008-07-01 Thread Scott Ribe
> but the view  
> always prints at 100% and thus scaling does not print correctly

Yeah, you're dividing by the scaling factor, thus negating the scaling. IOW,
user wants to print at 0.75, you divide by 0.75 thus scaling your own page
area *up*, then the printing system multiplies by 0.75, and there you have
it: drawing at 1.0.

-- 
Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice


___

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: Newbie question: Timers

2008-07-01 Thread Matthew Youney
Thanks,
I will have to investigate further about how exactly to implement this.
Again, thanks for your help,
Matt

-Original Message-
From: Daniel Richman [mailto:[EMAIL PROTECTED]
Sent: Monday, June 30, 2008 5:46 PM
To: Matthew Youney
Cc: Cocoa
Subject: Re: Newbie question: Timers

Use this:

NSTimer *myTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 // number
of seconds as double
target:self // targer
selector:@selector(checkTimer:) // selector to call (parameter is the timer)
userInfo:nil // I don't use any user info
repeats:YES]; // whether the timer repeats or is once only (this is a BOOL)


Daniel


Matthew Youney wrote:
> Hello everyone:
> I have another question that is based on my Microsoft background (yes I am
> ashamed).
>
> In the VS environment, there is a "timer" control that can be dropped onto
a
> form, and will generate timer events every X milliseconds.  How would I
> impliment similar functionality in Cocoa, or what would you gurus suggest
> that I look into?  What is best?
>
>
> As always, thanks for your help, and best regards,
> Matt
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
http://lists.apple.com/mailman/options/cocoa-dev/applemaillist%40mm.danielri
chman.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]


Date and Time Conversion with TimeZone

2008-07-01 Thread wayne . daley

Hello,

I have a date event returned as a date time string from a feed in the
following format,

"Tue 01 Jul 2008 15:00:00 +0100"

I'm assuming this is GMT plus one hour,  I'd like to convert this string to
the to a more user friendly date time string such as,

"Today at 9:00am" or "Tue Jul 01, 2008 9:00am"

that would take into account the current Time Zone setting of the Mac
displaying the date event.  I've looked at the NSDateFormatter and
NSCalendarDate, but didn't see anything that takes into account the Time
Zone setting on the current Mac.  Does anyone know of where I might find or
have a sample of a code snippet that does something similar to this?

Thank you,
Wayne

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Correct Order for CFRelease-ing CFNetwork Refs?

2008-07-01 Thread mmalc crawford


On Jul 1, 2008, at 10:09 AM, Kyle Sluder wrote:


There won't be any documentation regarding allocating and deallocating
most objects, because, like Cocoa, Core Foundation religiously follows
a memory management scheme known as the Create Rule.

The Core Foundation Ownership Policy is actually specified in terms of  
a naming convention similar to that for Cocoa and defined by two  
rules, the Create Rule and the Get Rule:


.


mmalc

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Flowcharts in Cocoa

2008-07-01 Thread Angus Hardie


On 1 Jul 2008, at 04:23, Matt Orr wrote:


Hi guys!
I am very new to Cocoa, but not new to UNIX development. GUI  
programming is

new to me, and I am tackling it heavily ;)

I have a little assignment at work to create a simple application  
which

charts a bunch of processes, much like OmniGraffle (
http://www.omnigroup.com/applications/omnigraffle/). I was wondering  
how
such graphing was implemented, and more importantly, where to read.  
I went
through the 3rd edition of Cocoa Programming for Mac OS X, but I  
still dont

have any ideas on how to start implementing such a beast.
Can you please point me to potential topics and aspects of Cocoa I  
should

research? I have played a little bit with quartz, but it seems too
complicated (or is it?) of a solution for the simple thing I am  
trying to

achieve.

Any input is much appreciated!



Hi,

First, I totally recommend looking at DrawKit, which is a brilliant  
framework for interactive graphics.

I wish it had been around when I started writing SQLEditor.

Another thing to look at is the Apple Sketch example.

It might also be worth looking at whether you can use Graphviz code  
and display the result in a window as an image of some kind.



I have some thoughts, which may or may not prove useful:

Conceptually you have an application that might consist of a document  
window with a view that is a subclass of NSView in it.
That view draws shapes (like rectangles and circles) and joins them  
together with lines.


You can implement the drawRect: method of your subclass and draw the  
objects there, which is fairly easy to do. (http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaDrawingGuide 
)


If you just want to display the diagram and you don't need any  
interaction with your objects you could probably stop there.


Allowing interaction with the objects makes everything more complicated.

If you have interaction you will want to allow dragging (detect  
whether the mouse click is in the drag region of an object and move it  
with the mouse)
and resizing (detect if the mouse is in the resize handle and then  
resize the object)


NSView (via its superclass NSResponder) has mouseDown: and mouseUp:  
methods that may help here. There are also methods for detecting mouse  
dragging.



The way that I structured my app was to have a canvas class (a  
subclass of NSView) and then "object views" which are drawn into the  
canvas,
an object view knows how to draw itself into a suitable canvas object  
and the canvas object asks each object that is visible to draw itself  
when it gets a drawRect message.


If you have connectable objects you also need a mechanism to notify  
connectors that the objects they connect between have moved, so the  
connectors can update.
An easy way of doing this is just to store pointers to the connected  
objects and send them messages directly, but notifications might work  
as well.


If you want to write code, the sketch sample may give some more examples

hope the project goes well!

Angus


--
Angus Hardie
[EMAIL PROTECTED]




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Correct Order for CFRelease-ing CFNetwork Refs?

2008-07-01 Thread Kyle Sluder
On Tue, Jul 1, 2008 at 9:09 AM, Jonathan Hohle <[EMAIL PROTECTED]> wrote:
> I recently wrote some code to retrieve data from an NTLM authenticated web
> server. As far as I can tell NTLM isn't supported at the Cocoa level, so I
> used CFNetwork to make the request. The example docs were clear and helpful,
> but I couldn't find anything on deallocating a CFHTTPAuthenticationRef.

There won't be any documentation regarding allocating and deallocating
most objects, because, like Cocoa, Core Foundation religiously follows
a memory management scheme known as the Create Rule.

> The example code saves off the CFHTTPAuthenticationRef for reuse, a pattern
> which I followed. In my -dealloc method, I was calling CFRelease with the
> request ref (which may or may not have an authentication ref applied to it),
> followed by CFRelease with the authentication ref. This consistently crashed
> with EXC_BAD_ACCESS. By chance, I switched the order, and now the code works
> without crashing.

How did you create your auth ref?
CFHTTPAuthenticationCreateFromResponse?  It seems that you have
forgotten to CFRetain it (when you store it somewhere is the most
likely place) and freeing the request is releasing the auth ref which
is also being freed.

--Kyle Sluder
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: exec(uting) Safari - How (newbie)

2008-07-01 Thread Andrew Merenbach

On Jul 1, 2008, at 8:15 AM, Barrie Green wrote:


Hi all,

I want to write a quick little cocoa app that fires off Safari.

I started with something like

int main(int argc, char* argv[]) {
 ...
 ...
 if(execv("/Applications/Safari.app", someArgs) == -1) {
   NSLog(@"execv failed with %s", strerror(errno));
 }
}

It always fails with 'Permission denied', OK I kinda expect that. But
how do I fix it?

Would authorization would help? I've looked a the docs a little and it
would appear that I should do a
AuthorizationCreate/AuthorizationCopyRights shuffle but if so what
rights should I use?

Ideally I would like to run the app without it asking me for my
password, how could I achieve that?

TIA

bg



Hi!  Is it possible that using this would work?

NSURL *myURL = [NSURL urlWithString:@"http://www.example.com/";];
[[NSWorkspace sharedWorkspace] openURL:myURL];

That way, if a user prefers Opera/Firefox/Omniweb/another browser,  
your site would open in that -- thus confusing them less.


Cheers,
Andrew


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: Trying to display a static image on my window. Any tips would be great

2008-07-01 Thread Steve Christensen
If you add an IBAction method to your window controller's class, it  
can respond to a click on the image by calling


[[NSWorkspace sharedWorkspace] openURL:@"http://www.apple.com";];


On Jul 1, 2008, at 9:09 AM, Papa-Raboon wrote:


Thanks loads for that Steve. It seems to be doing as I wanted now.
Someone kindly pointed out that if I created my image with an Alpha
chanel that it could also have transparencies too which worked
beautifully. I just need to figure out how to hyperlink it so it can
open a URL in a browser now.

Cheers
Paul

2008/7/1 Steve Christensen <[EMAIL PROTECTED]>:

On Jul 1, 2008, at 6:41 AM, Papa-Raboon wrote:

I have been trying to get a static image to display in a corner  
of my
window and it has to literally just sit there and do nothing  
however I

have searched and searched Apple's dodumentation but no success yet.

I have dropped an Image View onto the window in IB and set the
following in my .h file in Xcode:

  IBOutlet NSImageView *theImage;

Then in my .m file I have this so far:

   NSString *imageName;
   NSImage *tempImage;

   imageName = [[NSBundle mainBundle] pathForResource:@"logo"
ofType:@"PNG"];
   tempImage = [[NSImage alloc]  
initWithContentsOfFile:imageName];


My image is set in my project in the resources folder and is called
logo.png and I hooked up the object to the NSImageView using IB.

Can't seem to get it to display. I believe I have a line of code
missing that will tie my MSImage to my NSImageView but not sure how.

Any Ideas please?

I'm pretty new to cocoa and don't understand all the lingo yet so be
gentle please.


This is just a static image from your application's bundle, so you  
should be
able to do everything in IB without writing any code. After  
dragging a
NSImageView into your window, open the Inspector window if it's  
not already
open. Then set attributes Image=logo (Cocoa will figure out the  
file's
extension), Border=none, Scale: to fit. Select Size from the  
inspector's
popup menu and set the size to the image's size. Depending on  
where the
image will be in your window, you may need to set the autosizing  
struts and
springs right below the size info. You can find out if it stays in  
the
correct place when your window resizes by selecting Test Interface  
from the

File menu (command-R).

steve


___

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: OpenStreetMap GPS/Map Viewer

2008-07-01 Thread Bill Dudney

Hi Joeles,

The tiled layer does much of the work for you in terms of scrolling  
and scaling.


I have an example on my blog;

http://bill.dudney.net/roller/objc/entry/catiledlayer_example

that does something like what you want (I expect based on the  
description).


Good luck!

-bd-
http://bill.dudney.net/roller/objc

On Jul 1, 2008, at 3:00 AM, Joeles Baker wrote:


Hi,

I am trying to develop a "map viewer".
Later i'd like to port it to the iPh***, but since we don't talk  
about the iPh*** in here,

i'll just start with a basic osx app ;-)

My final goal is to develop a feature equivalent application to the  
iPh*** (google) Maps app,
but instead it will use the free and open source maps provided by  
the http://www.openstreetmap.org project.


(of course it will be free and i'll provide the community with the  
source).


currently i am able to show a specific map part for example like:
http://tile.openstreetmap.org/cgi-bin/export?bbox=11.56832,48.13196,11.5827,48.14255&scale=6800&format=png

but i am a bit stuck with the scrolling and zooming thing.
now if my user scrolls (taps) or zooms, howto dynamically reload map  
parts in a iPh*** like fashion?



any pointer or anyone interested in the project and willing to join  
forces is greatly appreciated :-)



best,

--Joeles

P.S.:
just in case you wonder, why to use openstreetmap instead of google:
its opensource - you may do whatever you want with the map data  
without getting sued by google or their map provider.
openstreetmap is wikipedia for maps - in some areas (where all those  
geeks with the gps equipped bicycles are around) openstreetmap
map data is MUCH more accurate than google maps.. evenfootpaths,  
bicycle paths... and so on


P.P.S.:
yes, i'll integrate coreloc*, but we don't talk about coreloc

P.P.P.S.:
if apple wouldn't provide such a nice toolchain and sometimes even  
nice products, currently i'd be really frustrated enough
with all this iphone sim-locking, opensource counterproductive  
appstore concept, nda shizzle marketing tactics, . to move one  
to another platform.



___

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/bdudney%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: mutableArrayForKeyValue Question (ignore other email)

2008-07-01 Thread Ron Lue-Sang


On Jun 29, 2008, at 10:44 AM, Stuart Malin wrote:



On Jun 29, 2008, at 7:05 AM, Scot t Anguish wrote:


From: Scott Anguish <[EMAIL PROTECTED]>
Subject: Re: mutableArrayForKeyValue Question (ignore other email)
To: "Alex Wait" <[EMAIL PROTECTED]>
Cc: cocoa-dev 
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes

I think there is still some clarification necessary.

what exactly are you trying to accomplish, rather than how you are
trying to do it?

would I be correct to guess that you want to create a new Person
object and add it to the array?

if so you need to create the object and add it to the array

id newObjectToAdd = [theArrayController newObject];
[theArrayController addObject:newObjectToAdd];


or you can programmatically create the Person object, and add it
directly to the datamodel using, say

Person *aPerson=[[[Person alloc] init] autorelease];
and then add that to the data model using the  
mutableArrayforKeyValue:



As I am playing around with the very same concepts now, I tried  
these two approaches in my code, and get (slightly) different results.


When using the controller to add the Person object, the added object  
is NOT initialized.  My Person class's -init method sets initial  
values for its ivar properties. When I create an explicit instance  
of aPerson, and add that to the model, the values are shown in the  
view(s).  However, when I use the controller to add a new object,  
the ivars are not initialized.


This is surprising. Is Person an NSManagedObject subclass? If it were  
a plain old NSObject subclass, the controller creates new instances by  
invoking [[ alloc] init].


I'm not sure how else you'd end up with an object at all if your init  
method weren't getting called.


If Person is an NSManagedObject subclass, init isn't the designated  
initializer. In this case, the controller creates the new object using  
the initWithEntity:inManagedObjectContext: or whatever the  
NSManagedObject designated initializer is.


If you've put setup logic in your NSManagedObject subclass's init  
method, you've put the logic in the wrong place.





Am I doing something wrong? Or is this is known artifact of using  
the controller as an intermediary to add an new instance?


~~~

Separately, there's another way to add an explicitly created Person  
to the data model -- using the index accessors, such as:
	[mutableArrayModel insertObject:aPerson inAtIndex: 
[mutableArrayModel countOf]];


Actually, in my case, I made an instance method in the model class  
that adds a new person:  -(void) add:(Person*)aPerson that  
invokes the above referenced index accessors on self to add the new  
person to the  property.



___

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]



--
RONZILLA



___

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: NSDateComponents question

2008-07-01 Thread mmalc crawford

Hi Chris,

On Jul 1, 2008, at 9:10 AM, Christopher Kane wrote:

The more subtle and serious issue is that Sunday in the current week  
might be in the previous Month (so, Day < Weekday), or even previous  
Year, so setting the Day to a negative value and keeping the Month  
and Year the same will have ... "who knows what effect".


My apologies; I did do some testing and found that the resultant date  
was always correct.

Could you elaborate on what circumstances this might not be correct?


A more robust approach would be to just get the weekday value:

Ironically that's effectively what I first suggested (with the  
addendum of the normalisation).


mmalc

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Implementing NSOutlineView autosaveExpandedItems with CoreData

2008-07-01 Thread Ron Lue-Sang


On Jul 1, 2008, at 12:05 AM, Andy Kim wrote:

Thanks - I've seen solutions like this before, I just wanted to get  
it working the regular way!


I totally understand the sentiment.

Is itemForPersistentObject expecting an NSTreeNode? You say you  
have it working in a similar way - what does your  
itemForPersistentObject method return?


Many thanks
Ian


Here's what I do:

- (id)outlineView:(NSOutlineView *)ov itemForPersistentObject: 
(id)object

{
	return [[gAppDelegate library] groupWithUID:object]; // This  
fetches the group from the managed object context

}

- (id)outlineView:(NSOutlineView *)ov persistentObjectForItem:(id)item
{
return [item uid];
}

According to the docs I'm supposed to archive the persistent object  
before returning it, but in my case, it doesn't matter because it's  
just a string and it all goes into a plist anyway. I have tried it  
both ways after seeing your implementation though, and there are  
indeed no differences.


I see why you're thinking that you need to return a NSTreeNode  
though. I don't need to do that because I don't use a  
NSTreeController and instead implement the data source protocol in  
my custom controller. So for me the item is the model object itself.


In your case, I'm fairly positive that you do need to return the  
NSTreeNode object. Instead of fetching the model object, walk the  
controller's content tree looking for the right representedObject  
with the UID.


- Andy Kim



Andy, you're right.
Ian's code needs to return an NSTreeNode. Please file a bug that this  
is too hard.





___

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]



--
RONZILLA



___

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: PDFDocument subclass with an undo manager

2008-07-01 Thread Kevin Ross
That did the trick, thank you for the insight.  It seems so obvious  
after the fact!

Thank  you again very much!

- Kevin



On Jun 30, 2008, at 6:23 PM, Graham Cox wrote:

It won't redo because when it performs the undo, it is calling - 
initWithData: directly, and I take it from this snippet that  
initWithData: isn't recording the undo.


You need to create a wrapper method for initWithData that contains  
the undo recording step, then make that method the target of the  
undo, something like:


- (void)myInitWithData:(NSData*) newData
{
	[[undoManager prepareWithInvocationTarget:self] myInitWithData: 
[self oldData]];

[self initWithData:newData];
}


hth,

cheers, Graham




On 1 Jul 2008, at 9:02 am, Kevin Ross wrote:

Hi everyone, I have a question that might seems a little silly.  I  
have a PDFDocument subclass which can perform page impositions.  I  
would also like to be able to undo the impositions.  In the methods  
I have this when I make the change to the PDF:


[[undoManager prepareWithInvocationTarget:self] initWithData:[self  
dataRepresentation]];

[self initWithData:(NSData *)newPDFData];


When I call -undo: later, it works, but I can't get it to -redo:

Is what I'm trying to do even possible this way ?  Is there a  
better way?


Thanks for any pointers and/or suggestions!!

Kevin
___

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/graham.cox%40bigpond.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: Creating AppControllers in InterfaceBuilder 3.1

2008-07-01 Thread Ron Lue-Sang


On Jun 30, 2008, at 10:25 AM, Owen Yamauchi wrote:


On Mon, Jun 30, 2008 at 7:27 AM, j o a r <[EMAIL PROTECTED]> wrote:
The thinking here is indeed that Xcode handles the creation of  
classes,

while IB handles instances of classes and their configuration.


IB can actually create classes. In the Identity inspector, after
creating a generic NSObject, type in a class name that you want to
create. Then you can add outlets and actions below. Once you're
finished, File->Write Class Files... will create the .h and .m files
(unfortunately it won't add them to your Xcode project, or at least I
haven't found a way to make it do so).


This works fine for me. Is the nib already a part of your project? Is  
the little dot at the bottom left of the nib document window green?
When I do the "write class files" step and save it anywhere in my  
project directory, IB asks me if I want to add it to the project.






Owen
___

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]



--
RONZILLA



___

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: NSDateComponents question

2008-07-01 Thread Christopher Kane

On Jul 1, 2008, at 1:08 AM, mmalc crawford wrote:

On Jun 30, 2008, at 10:27 AM, Jason Wiggins wrote:

Thanks mmalc for your reply. What you say makes sense. So comps is  
the whole date (now) minus 3 days. I wasn't expecting that.
I should've made it clear what I was trying to achieve. I want to  
set the start date to the start of the week, hence line 11. 3 was  
just an arbitrary figure that happens to be today (localised in  
Sydney at 3:20am)
I want to get the weekday and subtract *that* from the current  
date. I can't get a weekday figure without line 7. Any suggestions?


Assuming you want just the actual day of the beginning of the week,  
rather than a specific time on the day (and assuming a Gregorian  
calendar and that you want the week to start on a Sunday):


NSDate *currentDate = [NSDate date];

/*
Get the components required to:
(a) determine the current day of the week, and
(b) create the day of the beginning of the week.
*/
   NSDateComponents *components = [gregorian  
components:NSWeekdayCalendarUnit | NSYearCalendarUnit |  
NSMonthCalendarUnit | NSDayCalendarUnit fromDate:currentDate];


/*
Update the components to represent the beginning of the week by  
subtracting the weekday number from the current day.
Weekday for Sunday in the Gregorian calendar is 1, so subtract 1  
from the number of days you want to subtract from the date in  
question.  (If today's Sunday, subtract 0 days.)

*/
   [components setDay:([components day] - ([components weekday] -  
1))];



It is probably a little bit better to also set the weekday to  
undefined before the next computation:


[components setWeekday: NSUndefinedDateComponent];

so that the dateFromComponents: operation doesn't try to use the  
weekday info, which now is not in agreement with the day, so "who  
knows what might happen".



The more subtle and serious issue is that Sunday in the current week  
might be in the previous Month (so, Day < Weekday), or even previous  
Year, so setting the Day to a negative value and keeping the Month and  
Year the same will have ... "who knows what effect".



A more robust approach would be to just get the weekday value:

   NSDateComponents *components = [gregorian  
components:NSWeekdayCalendarUnit fromDate: currentDate];


and subtract WD-1 days, e.g. (in the most straightforward way):

NSDateComponents *toSubtract = [[NSDateComponents new]  
autorelease];

[toSubtract setDay: - ([components weekday] - 1)];

NSDate * beginningOfWeek = [currentDate dateByAddingComponents:  
toSubtract toDate: currentDate options:0];


That gets you to Sunday, at least, though not necessarily the first  
day of the week in the user's current locale.


Note that in this case, beginningOfWeek has the same hour, minute, and  
second as the original date currentDate.  Another go with  
components:fromDate: and dateFromComponents: is one straightforward  
way to normalize those to midnight:


  components = [gregorian components: NSYearCalendarUnit |  
NSMonthCalendarUnit | NSDayCalendarUnit fromDate: beginningOfWeek];

   beginningOfWeek = [gregorian dateFromComponents: components];

Fetching hour, minute, and second into the original 'components' and  
subtracting them would have been another way, though DST transitions  
might be a "gotcha" there, spoiling that approach (you'd subtract one  
too many or few hours to actually get back to midnight).  Probably  
better to explicitly state what you want in that case (ie, use  
dateFromComponents: not dateByAddingComponents:...).



Chris Kane
Cocoa Frameworks, Apple






// Create the day for the beginning of the week from the updated  
components.
   NSDate *beginningOfWeek = [gregorian  
dateFromComponents:components];



mmalc

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/ckane%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]


How to make the FileOwner of a nib file accessible globally in whole project

2008-07-01 Thread JArod Wen

Hi Jedis,

Here is my problem: my application now have a main nib file  
MovieDocument.nib with its FileOwner MovieDocument.mm(We used  
AVCVideoServices which requires to be in a c++ source file). I need to  
send messages to the methods in MovieDocument.mm from other classes in  
the project(I have many other windows and also corresponding  
controllers), so i need a way to access the movieDocument globally.


One example: there is another controller VideoController.m which  
contains some measurement methods on the movie loaded in  
movieDocument. Once we finish the measurement in VideoController, we  
need to update the movie in MovieDocument, where we need to send  
message to the methods in MovieDocument.


This is from VideoController.m

- (void)writeMeasureOutput:(MeasureView *)sender
{
// Some measurement code here...

object = [[movieDocument measureView]   whatsNext];

NSLog(@"Next measurement: %@",object);

}

Such calls should be used in many other controllers in the projects.  
So the instant of MovieDocument should be accessed globally.


I have tried to instantiate MovieDocument in MovieDocument.h, but it  
is clearly wrong since when the header file is imported, the instant  
will be created once.


So any suggestion on this problem? Thanks in advance!

---
JArod Wen




___

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: Trying to display a static image on my window. Any tips would be great

2008-07-01 Thread Steve Christensen

On Jul 1, 2008, at 6:41 AM, Papa-Raboon wrote:


I have been trying to get a static image to display in a corner of my
window and it has to literally just sit there and do nothing however I
have searched and searched Apple's dodumentation but no success yet.

I have dropped an Image View onto the window in IB and set the
following in my .h file in Xcode:

   IBOutlet NSImageView *theImage;

Then in my .m file I have this so far:

NSString *imageName;
NSImage *tempImage;

	imageName = [[NSBundle mainBundle] pathForResource:@"logo"  
ofType:@"PNG"];

tempImage = [[NSImage alloc] initWithContentsOfFile:imageName];

My image is set in my project in the resources folder and is called
logo.png and I hooked up the object to the NSImageView using IB.

Can't seem to get it to display. I believe I have a line of code
missing that will tie my MSImage to my NSImageView but not sure how.

Any Ideas please?

I'm pretty new to cocoa and don't understand all the lingo yet so be
gentle please.


This is just a static image from your application's bundle, so you  
should be able to do everything in IB without writing any code. After  
dragging a NSImageView into your window, open the Inspector window if  
it's not already open. Then set attributes Image=logo (Cocoa will  
figure out the file's extension), Border=none, Scale: to fit. Select  
Size from the inspector's popup menu and set the size to the image's  
size. Depending on where the image will be in your window, you may  
need to set the autosizing struts and springs right below the size  
info. You can find out if it stays in the correct place when your  
window resizes by selecting Test Interface from the File menu  
(command-R).


steve



___

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: exec(uting) Safari - How (newbie)

2008-07-01 Thread Kyle Sluder
On Tue, Jul 1, 2008 at 11:30 AM, Jason Coco <[EMAIL PROTECTED]> wrote:
> You could also use /usr/bin/open -- then you wouldn't have to know where
> safari lives.

Abaddesignsayswhat?  What do you think open uses anyway?  ;-)
___

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]


mouse down selectively not select the cell

2008-07-01 Thread Mitchell Livingston

Hello,

I have an outline view that consists of custom-drawn cells, where I  
have images representing buttons. I want a left click on the buttons  
to not change the selected cells but still perform mouse tracking (I  
use hitTestForEvent:inRect:ofView: to determine if it should track); a  
mouse down anywhere else would not perform mouse tracking and would  
change the selection. I went through all the possible return values  
for the hit test method, but the only one that doesn't select the cell  
(NSCellHitNone) also causes tracking to not perform. Is there a  
straightforward way to do this?


Thanks,
Mitchell Livingston
___

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: OpenStreetMap GPS/Map Viewer

2008-07-01 Thread I. Savant

i'll just start with a basic osx app ;-)

...

but i am a bit stuck with the scrolling and zooming thing.
now if my user scrolls (taps) or zooms, howto dynamically reload map  
parts in a iPh*** like fashion?


  In a basic OS X app, you respond to the desired events, such as a  
mouse click, a keyboard keypress, network activity, etc.


  Whatever this iPh*** thing is, I'm sure it has support for the  
necessary events. If it comes with documentation, you can bet that  
documentation mentions these iPh*** specific events.


if apple wouldn't provide such a nice toolchain and sometimes even  
nice products, currently i'd be really frustrated enough
with all this iphone sim-locking, opensource counterproductive  
appstore concept, nda shizzle marketing tactics, . to move one  
to another platform.


  Completely irrelevant. Nobody here can/will do anything about that  
and yours is just another voice in the rather large and overpowering  
chorus. It's not that I don't sympathize it's just that your words  
(and those of the many others before you) are wasted on that topic here.


--
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: exec(uting) Safari - How (newbie)

2008-07-01 Thread Jason Coco
You could also use /usr/bin/open -- then you wouldn't have to know  
where safari lives.


execl("/usr/bin/open", "/usr/bin/open", "-a", "Safari", 0);

On Jul 1, 2008, at 11:19 , Kristopher Matthews wrote:


Try executing "/Applications/Safari.app/Contents/MacOS/Safari".

/Applications/Safari.app identifies a bundle, not the actual  
application (and execv() is not aware of bundles).


--Kris

On Jul 1, 2008, at 10:15 AM, Barrie Green wrote:


Hi all,

I want to write a quick little cocoa app that fires off Safari.

I started with something like

int main(int argc, char* argv[]) {
...
...
if(execv("/Applications/Safari.app", someArgs) == -1) {
  NSLog(@"execv failed with %s", strerror(errno));
}
}

It always fails with 'Permission denied', OK I kinda expect that. But
how do I fix it?

Would authorization would help? I've looked a the docs a little and  
it

would appear that I should do a
AuthorizationCreate/AuthorizationCopyRights shuffle but if so what
rights should I use?

Ideally I would like to run the app without it asking me for my
password, how could I achieve that?

TIA

bg


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: Displaying NSArray in NSTableView

2008-07-01 Thread mmalc crawford


On Jul 1, 2008, at 8:12 AM, Brandon Schlenker wrote:

I'm using MGTwitterEngine and I am having problems displaying the  
downloaded tweets (an NSArray) in a table view or text view.

MGTwitterEngine downloads the tweets using this.
"- (void)statusesReceived:(NSArray *)statuses forRequest:(NSString  
*)identifier"
I need to display "statuses" in an NSTableView or each individual  
item in its own NSTextField (ex. "name" etc.) These can be found in  
any Twitter XML doc. (twitter.com/statuses/public_timeline.xml).



What problems are you having?
Have you tried to use the technique described in ?  In what way did it fail?


mmalc

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: exec(uting) Safari - How (newbie)

2008-07-01 Thread Marcelo Alves
Why not use [NSWorkspace launchApplication:] method?



2008/7/1 Barrie Green <[EMAIL PROTECTED]>:
> Hi all,
>
> I want to write a quick little cocoa app that fires off Safari.
>
> I started with something like
>
> int main(int argc, char* argv[]) {
>  ...
>  ...
>  if(execv("/Applications/Safari.app", someArgs) == -1) {
>NSLog(@"execv failed with %s", strerror(errno));
>  }
> }
>
> It always fails with 'Permission denied', OK I kinda expect that. But
> how do I fix it?
>
> Would authorization would help? I've looked a the docs a little and it
> would appear that I should do a
> AuthorizationCreate/AuthorizationCopyRights shuffle but if so what
> rights should I use?
>
> Ideally I would like to run the app without it asking me for my
> password, how could I achieve that?
>
> TIA
>
> bg
> ___
>
> 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/marcelo.alves%40redefined.cc
>
> 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: exec(uting) Safari - How (newbie)

2008-07-01 Thread Kristopher Matthews

Try executing "/Applications/Safari.app/Contents/MacOS/Safari".

/Applications/Safari.app identifies a bundle, not the actual  
application (and execv() is not aware of bundles).


--Kris

On Jul 1, 2008, at 10:15 AM, Barrie Green wrote:


Hi all,

I want to write a quick little cocoa app that fires off Safari.

I started with something like

int main(int argc, char* argv[]) {
 ...
 ...
 if(execv("/Applications/Safari.app", someArgs) == -1) {
   NSLog(@"execv failed with %s", strerror(errno));
 }
}

It always fails with 'Permission denied', OK I kinda expect that. But
how do I fix it?

Would authorization would help? I've looked a the docs a little and it
would appear that I should do a
AuthorizationCreate/AuthorizationCopyRights shuffle but if so what
rights should I use?

Ideally I would like to run the app without it asking me for my
password, how could I achieve that?

TIA

bg
___

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

This email sent to [EMAIL PROTECTED]




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]

exec(uting) Safari - How (newbie)

2008-07-01 Thread Barrie Green
Hi all,

I want to write a quick little cocoa app that fires off Safari.

I started with something like

int main(int argc, char* argv[]) {
  ...
  ...
  if(execv("/Applications/Safari.app", someArgs) == -1) {
NSLog(@"execv failed with %s", strerror(errno));
  }
}

It always fails with 'Permission denied', OK I kinda expect that. But
how do I fix it?

Would authorization would help? I've looked a the docs a little and it
would appear that I should do a
AuthorizationCreate/AuthorizationCopyRights shuffle but if so what
rights should I use?

Ideally I would like to run the app without it asking me for my
password, how could I achieve that?

TIA

bg
___

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]


Displaying NSArray in NSTableView

2008-07-01 Thread Brandon Schlenker
I'm using MGTwitterEngine and I am having problems displaying the  
downloaded tweets (an NSArray) in a table view or text view.


MGTwitterEngine downloads the tweets using this.

"- (void)statusesReceived:(NSArray *)statuses forRequest:(NSString  
*)identifier"



I need to display "statuses" in an NSTableView or each individual item  
in its own NSTextField (ex. "name" etc.) These can be found in any  
Twitter XML doc. (twitter.com/statuses/public_timeline.xml).



Thanks!
___

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

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

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

This email sent to [EMAIL PROTECTED]


CATextLayer and preferredFrameSize

2008-07-01 Thread shoaib
Does CATextLayer override preferredFrameSize to always return a size that 
accomodates the text in it?

I'm adding a CATextLayer, say myTextLayer, to a parent layer which uses a 
custom layout manager. In the custom layout manager's layoutSublayersOfLayer: 
method, I'm setting the frame of the text layer so that it's width fits inside 
the parent layer.

Calling myTextLayer.frame.size.width returns the width that was set by the 
parent's layout manager. Calling myTextLayer.preferredFrameSize.width returns a 
size that matches the size of the text. 

- Kevin
Sent via BlackBerry by AT&T
___

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]


  1   2   >