Re: Distributed object vending problem

2010-09-20 Thread Ken Thomases
On Sep 20, 2010, at 4:14 AM, Ken Tozier wrote:

> server: (** NSConnection 0x114720 receivePort  sendPort 
>  refCount 1 **)

> Ultimately, the client and server will need to work on different machines on 
> a network, thus the call to [NSSocketPortNameServer sharedInstance]
> 
> Anyone see what I'm doing wrong?

You are using a name server appropriate for socket ports but your connection is 
set up using Mach ports.  Those two don't interoperate.

You might be able to use 
+serviceConnectionWithName:rootObject:usingNameServer:.  You can definitely use 
+connectionWithReceivePort:sendPort: with socket ports.

It's probably easier to start with using Mach ports on a single machine and 
then switch to socket ports after you've got everything working.

Regards,
Ken

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Text item delimiters

2010-09-20 Thread Ron Fleckner

On 21/09/2010, at 8:34 AM, Evan Coleman wrote:

> In applescript I was able to do this:
> 
> *set* TID *to* AppleScript's text item delimiters
> 
> *set* AppleScript's text item delimiters *to* space
> 
> *set* theString *to* *text** items* *of* theString
> 
> *set* AppleScript's text item delimiters *to* "%20"
> 
> *set* theString *to* theString *as* *string*
> 
> *set* AppleScript's text item delimiters *to* TID
> 
> 
> How would I do the same thing in objective-c/cocoa?
> 
> 
> Thanks,
> 
> Evan

see the NSString Class Reference and have a look at 
-componentsSeparatedByString:.  There are lots of ways to cut up a string so 
read more of that reference for more ideas

Ron

___

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

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

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

This email sent to arch...@mail-archive.com


php and cocoa

2010-09-20 Thread douglas chanco
For those on the xcode mailing list I am not spamming or anything but on one of 
these lists xcode or cocoa, someone posted a link with an example of getting 
data from a php web page into objective-c

The responses I got on the xcode list while useful is not what I am looking 
for.  What I am beginning to look at is an app that will send a http request to 
a php page and display the results (an image, description and qty)

I plan to have a php page that will return (depending on what it received)

1. a link to a image (or the actual image) I am still thinking this out
2. a single numeric value (quantity available)
3. a description of the item (a string)

any advice or the above mentioned link would be greatly appriciated

thanks

dougc



___

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

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

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

This email sent to arch...@mail-archive.com


Re: Distributed object vending problem

2010-09-20 Thread Ken Tozier
Thanks Laurent.

I followed the DO instructions here: 
http://www.informit.com/articles/article.aspx?p=1438422&seqNum=3 but can't seem 
to get a connection to the server from my client app.

Here's how I'm setting up the listener connection for the server

server = [NSConnection new];
[server setRootObject: self];
[server registerName: @"PMXServer" withNameServer: [NSSocketPortNameServer 
sharedInstance]];
NSLog(@"server: %@", server);

Which seems to run OK, printing the following to the console

server: (** NSConnection 0x114720 receivePort  sendPort 
 refCount 1 **)

On the client end, I'm doing the following 

server  = [[NSConnection rootProxyForConnectionWithRegisteredName: serverName
// tried all of the following
host: @"localhost"
host: @"10.0.1.3"
host: @"Ken-Toziers-MacBook-Pro.local"
host: nil
usingNameServer: [NSSocketPortNameServer sharedInstance]] 
retain];
NSLog(@"server: %@", server);


But all I'm getting in the console is

server: (null)

Ultimately, the client and server will need to work on different machines on a 
network, thus the call to [NSSocketPortNameServer sharedInstance]

Anyone see what I'm doing wrong?

Thanks for any help

On Sep 20, 2010, at 4:08 AM, Laurent Daudelin wrote:

> I haven't used DO since the NeXT days but if I recall correctly, it is very 
> strongly suggested you use protocols for your methods. Using additional 
> keywords, you can tell the runtime system what to expect when it sends your 
> message from one process to another. For example, using "oneway void" will 
> tell the runtime system that the message you're sending is not expecting a 
> reply which can speed things up on a network. Your server objects should be 
> receiving the remote messages and you need to find a way to dispatch the 
> message to the correct destination based on the message's signature or other 
> system you devise. As far as I remember, it was fairly simple to use. I don't 
> really understand why you're worried about vending the whole server's tree. 
> If you use protocols in your client and your server, sending a message to a 
> distant object is not a problem. You first need to determine which messages 
> you need to send to your server, then put them into a protocol and use DO 
> additional keywords to let the runtime system about the behavior of your 
> messages. Then, you just send to the server object you discover and it should 
> work.
> 
> -Laurent.
> -- 
> Laurent Daudelin
> AIM/iChat/Skype:LaurentDaudelin   
> http://www.nemesys-soft.com/
> Logiciels Nemesys Software
> laur...@nemesys-soft.com
> 
> On Sep 18, 2010, at 09:14, Ken Tozier wrote:
> 
>> Hi
>> 
>> I'm writing two apps: A server and client and am having some trouble 
>> figuring exactly what to link to in the client program. The server 
>> application has a main class that has dozens of dependencies. I don't want 
>> to have to import all the server app dependencies into the client 
>> application as that defeats the purpose of factoring code into separate 
>> apps. How do I send messages to a server's vended object without having to 
>> include the server's entire dependency tree? I looked into protocols and 
>> proxies but am not sure which to use.
>> 
>> Any help appreciated.___
> 

___

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

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

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

This email sent to arch...@mail-archive.com


Text item delimiters

2010-09-20 Thread Evan Coleman
In applescript I was able to do this:

*set* TID *to* AppleScript's text item delimiters

*set* AppleScript's text item delimiters *to* space

*set* theString *to* *text** items* *of* theString

*set* AppleScript's text item delimiters *to* "%20"

*set* theString *to* theString *as* *string*

*set* AppleScript's text item delimiters *to* TID


How would I do the same thing in objective-c/cocoa?


Thanks,

Evan
___

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

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

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

This email sent to arch...@mail-archive.com


Toolbar Item -Menu Form Representation - Key Equivalent

2010-09-20 Thread Richard Somers
The key equivalent will not work for a toolbar item, menu form  
representation.


The relevant code is

 NSToolbarItem *item = [[NSToolbarItem alloc]  
initWithItemIdentifier:identifier];


 [item setLabel:label];
 [item setPaletteLabel:paletteLabel];
 [item setToolTip:toolTip];

NSMenuItem *menuFormRep = [[NSMenuItem alloc] initWithTitle:@""  
action:nil keyEquivalent:@""];
 NSMenu *submenu = [[[NSMenu alloc] initWithTitle:@""]  
autorelease];
 [submenu addItemWithTitle:@"Thing1" action:@selector(change:)  
keyEquivalent:@"1"];
 [submenu addItemWithTitle:@"Thing2" action:@selector(change:)  
keyEquivalent:@"2"];

 [menuFormRep setSubmenu:submenu];

 [item setMenuFormRepresentation:menuFormRep];

Everything works but the key equivalent does nothing, 'change:' is not  
called.


Has anyone had success with a key equivalent for a toolbar item, menu  
form representation?


--Richard

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Animating a non-standard layer property

2010-09-20 Thread David Duncan
I believe this is talked about in one of the WWDC2010 Core Animation in 
Practice sessions. Lots of good information in both, so I highly recommend 
watching.

On Sep 20, 2010, at 4:24 PM, Kenneth Baxter wrote:

> Brilliant! Works now, thanks David. 
> 
> Is there somewhere I can find out more about this? It is not mentioned in the 
> Core Animation Programming Guide (2010-08-12), and I have got two e-books on 
> core animation, and it is not mentioned in either of them.
> 
> Thanks
> 
> Ken
> 
> On 21 Sep, 2010,at 09:07 AM, David Duncan  wrote:
> 
>> On Sep 20, 2010, at 3:42 PM, Kenneth Baxter wrote:
>> 
>> > To see the changes as they are made, in addition to the normal synthesize 
>> > of the testPoint, I have implemented the setter as follows:
>> 
>> 
>> There's your problem. Your not supposed to @synthesize these properties. 
>> Unless you let Core Animation define them (by declaring them @dynamic) they 
>> cannot be animated and you will see the symptoms you see. In your 
>> -drawInContext: method you can then query the property to get the current 
>> value.
>> --
>> David Duncan
>> 

--
David Duncan

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Animating a non-standard layer property

2010-09-20 Thread Kenneth Baxter

Brilliant! Works now, thanks David. 

Is there somewhere I can find out more about this? It is not mentioned in the 
Core Animation Programming Guide (2010-08-12), and I have got two e-books on 
core animation, and it is not mentioned in either of them.

Thanks

Ken

On 21 Sep, 2010,at 09:07 AM, David Duncan  wrote:

On Sep 20, 2010, at 3:42 PM, Kenneth Baxter wrote:


To see the changes as they are made, in addition to the normal synthesize of 
the testPoint, I have implemented the setter as follows:



There's your problem. Your not supposed to @synthesize these properties. Unless 
you let Core Animation define them (by declaring them @dynamic) they cannot be 
animated and you will see the symptoms you see. In your -drawInContext: method 
you can then query the property to get the current value.
--
David Duncan

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Animating a non-standard layer property

2010-09-20 Thread David Duncan
On Sep 20, 2010, at 3:42 PM, Kenneth Baxter wrote:

> To see the changes as they are made, in addition to the normal synthesize of 
> the testPoint, I have implemented the setter as follows:


There's your problem. Your not supposed to @synthesize these properties. Unless 
you let Core Animation define them (by declaring them @dynamic) they cannot be 
animated and you will see the symptoms you see. In your -drawInContext: method 
you can then query the property to get the current value.
--
David Duncan

___

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

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

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

This email sent to arch...@mail-archive.com


Animating a non-standard layer property

2010-09-20 Thread Kenneth Baxter

Hi, I have a layer where I want to animate a point, testPoint. For the moment, 
I want to animate the y value of the point. I have testPoint as a property of 
the layer. I want to get it to redisplay (and preferably also call the 
setTestPoint) on every frame of the animation, so I implement:

+ (BOOL)needsDisplayForKey:(NSString *)key {
if ([key isEqualToString:@"testPoint"]) {
return YES;
}
return [super needsDisplayForKey:key];
}

To see the changes as they are made, in addition to the normal synthesize of 
the testPoint, I have implemented the setter as follows:

- (void)setTestPoint:(CGPoint)p {
NSLog(@"Setting test point to %f, %f", p.x, p.y);
[self willChangeValueForKey:@"testPoint"];
testPoint = p;
[self didChangeValueForKey:@"testPoint"];
}

When I create the layer, I initialize the testPoint as follows:

layer.testPoint = CGPointMake(5.0f, 10.0f);

I try to animate the move of the point using:

CABasicAnimation *movePointAnimation = [CABasicAnimation animation];
movePointAnimation.keyPath = @"testPoint.y";
movePointAnimation.toValue = [NSNumber numberWithFloat:y];
movePointAnimation.duration = 5.0f;
movePointAnimation.removedOnCompletion = YES;
movePointAnimation.fillMode = kCAFillModeBoth; 
movePointAnimation.repeatCount = 0;
movePointAnimation.timingFunction = [CAMediaTimingFunction 
functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
[layer addAnimation:movePointAnimation forKey:@"testPoint.y"];

What I expected to happen is that I would get a bunch of calls to 
setTestPoint:, passing in the original x value of 5.0 and animating from the 
previous y point (initially 10.0) to the new point, and that my 
drawLayer:inContext: would have been called for each iteration.

Here's a typical run (each call to the animation separated by a line gap):

2010-09-21 08:16:36.717 CADisplay[20048:a0f] Starting animation to 4383.00

2010-09-21 08:16:48.422 CADisplay[20048:a0f] Starting animation to 886.00
2010-09-21 08:16:48.424 CADisplay[20048:a0f] Setting test point to 0.00, 
0.041937
2010-09-21 08:16:48.424 CADisplay[20048:a0f] Setting test point to 0.00, 
0.042831
2010-09-21 08:16:48.425 CADisplay[20048:a0f] Setting test point to 0.00, 
0.044800
2010-09-21 08:16:48.445 CADisplay[20048:a0f] Setting test point to 0.00, 
0.140321
2010-09-21 08:16:48.456 CADisplay[20048:a0f] Setting test point to 0.00, 
0.215275

2010-09-21 08:17:01.422 CADisplay[20048:a0f] Setting test point to 0.00, 
886.00
2010-09-21 08:17:01.583 CADisplay[20048:a0f] Starting animation to 2777.00

2010-09-21 08:17:15.142 CADisplay[20048:a0f] Starting animation to 1915.00
2010-09-21 08:17:15.143 CADisplay[20048:a0f] Setting test point to 0.00, 
0.090642
2010-09-21 08:17:15.144 CADisplay[20048:a0f] Setting test point to 0.00, 
0.092054
2010-09-21 08:17:15.144 CADisplay[20048:a0f] Setting test point to 0.00, 
0.095602
2010-09-21 08:17:15.160 CADisplay[20048:a0f] Setting test point to 0.00, 
0.247579
2010-09-21 08:17:15.175 CADisplay[20048:a0f] Setting test point to 0.00, 
0.464084

And when I clicked on XCode, it added:

2010-09-21 08:17:26.118 CADisplay[20048:a0f] Setting test point to 0.00, 
1915.00

...and my drawLayer:inContext: was not called at all during the animation.

What am I missing here? Why is my layer not being drawn on every frame? Why is 
the setTestPoint getting called with a zero X value? Why am I just getting 
these strange values in setTestPoint, and why for only the first tiny bit of 
the animation?

Also, if I wanted to animate the whole point rather than just the y value, what 
should I pass in? I don't see an NSValue valueWithCGPoint...


Thanks in advance

Ken___

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

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

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

This email sent to arch...@mail-archive.com


CFSockets callbacks not firing when menus are being tracked in cocoa app

2010-09-20 Thread Alexander Cohen
Hi,

I have a cocoa app that uses a library which uses CFSockets. Those sockets run 
loop sources are added to all known run loop modes ( common, default, event 
tracking and modal ). I would expect that the socket callbacks would fire 
during menu tracking but they dont. Is this a know issues, by design or is it 
just not possible?

thx

AC___

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

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

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

This email sent to arch...@mail-archive.com


Re: One last try: how do you make a bookmark bar like Safari?

2010-09-20 Thread John Nairn

On Sep 20, 2010, at 12:02 PM, cocoa-dev-requ...@lists.apple.com wrote:

I sent this out last week and go no replies.  Please excuse me for  
sending it out again but I want to try one more time in case someone  
has an answer.


I've been spending some time searching and thinking about how I can  
make a bookmark bar like in Safari or Firefox.  It has some of the  
characteristics of a toolbar especially when the window is small it  
puts the remaining toolbar items in a drop-down menu but it also has  
some of the properties of a collectionView with editable views,  
reordering and dragging.  I've seen some threads here but haven't  
found anything definitive.


How have any of you implemented one?



You need a custom control. I found this one

http://www.positivespinmedia.com/dev/PSMTabBarControl.html

which is freely available under BSD license. It looks good, but I have  
not gotten as far yet as implementing it in any of my applications.


---
John Nairn
GEDitCOM - Genealogy Software for the Macintosh
http://www.geditcom.com


___

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

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

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

This email sent to arch...@mail-archive.com


Re: NSSavePanel

2010-09-20 Thread koko

Thanks Sean and Nick.

Yeah I am on 10.5.8 for specific reasons.

-koko

On Sep 20, 2010, at 3:30 PM, Nick Zitzmann wrote:



On Sep 20, 2010, at 3:25 PM, Sean McBride wrote:


Is it not possible to set the file name text field before displaying
an NSSavePanel?  I see no "setters" in the docs for filename.


Incredibly, this was only added in 10.6.  Are you on an older OS?   
See

setNameFieldStringValue:


Well, sort of. On Snow Leopard, that is the correct method. On  
Leopard and earlier, the -runModalForDirectory:file: and the sheet- 
based equivalent do the same thing if you pass in a string for the  
file argument. Incidentally, that method works in Snow Leopard as  
well, although its use is now deprecated.


Nick Zitzmann


___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/koko%40highrolls.net

This email sent to k...@highrolls.net



___

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

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

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

This email sent to arch...@mail-archive.com


Re: creating docx file

2010-09-20 Thread Douglas Davidson

On Sep 20, 2010, at 12:57 PM, Philip White wrote:

> Hello,
>  I've tried using the following code to save an attributed string as a docx 
> file.
> 
> //the attributed string is 'contents'
> 
> NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys: 
> NSOfficeOpenXMLTextDocumentType, NSDocumentTypeDocumentAttribute, nil];
> NSRange range = {0,[contents length]};
>   
> NSError *error=nil;
> NSFileWrapper *wrapper = [contents fileWrapperFromRange: range 
> documentAttributes: attributes error: &error];
> 
> [wrapper writeToFile:[path stringByExpandingTildeInPath] atomically:YES 
> updateFilenames:NO];
> 
> 
> What I end up with is what appears to be an unzipped docx file (my 
> understanding is that docx files are zipped archives), i.e a folder full of 
> various resource files. I then try zipping it and changing the extension to 
> docx but I don't seem to end up with a valid docx file, or at least not 
> something that Pages 2008 can open. Maybe that version of Pages can't open 
> that format anyway, but still that code clearly isn't creating what I would 
> call a docx file. Any thoughts?

fileWrapperFromRange... is what you use when you want something that has a 
directory structure on disk, e.g. RTFD.  Use dataFromRange... instead.

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


Re: NSSavePanel

2010-09-20 Thread Nick Zitzmann

On Sep 20, 2010, at 3:25 PM, Sean McBride wrote:

>> Is it not possible to set the file name text field before displaying
>> an NSSavePanel?  I see no "setters" in the docs for filename.
> 
> Incredibly, this was only added in 10.6.  Are you on an older OS?  See
> setNameFieldStringValue:

Well, sort of. On Snow Leopard, that is the correct method. On Leopard and 
earlier, the -runModalForDirectory:file: and the sheet-based equivalent do the 
same thing if you pass in a string for the file argument. Incidentally, that 
method works in Snow Leopard as well, although its use is now deprecated.

Nick Zitzmann


___

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

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

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

This email sent to arch...@mail-archive.com


Re: NSSavePanel

2010-09-20 Thread Sean McBride
On Mon, 20 Sep 2010 15:11:21 -0600, k...@highrolls.net said:

>Is it not possible to set the file name text field before displaying
>an NSSavePanel?  I see no "setters" in the docs for filename.

Incredibly, this was only added in 10.6.  Are you on an older OS?  See
setNameFieldStringValue:

--

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


___

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

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

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

This email sent to arch...@mail-archive.com


NSSavePanel

2010-09-20 Thread koko
Is it not possible to set the file name text field before displaying  
an NSSavePanel?  I see no "setters" in the docs for filename.


-koko
___

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

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

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

This email sent to arch...@mail-archive.com


Re: NSView resizing problems.

2010-09-20 Thread Ken Ferry
On Mon, Sep 20, 2010 at 7:52 AM, Keary Suska wrote:

> On Sep 20, 2010, at 5:45 AM, Geoffrey Holden wrote:
>
> > My problem is that when I load this view into a tab (using the attached
> > code), the textview doesn't fit on the screen.  It covers up the top
> > textfield and seems to have it's top edge somewhere above the tabview (as
> > follows)
>
> The most common reason for this is that you are shrinking the view such
> that it forces the subviews to overlap, which creates an undefined situation
> that the view cannot handle.
>
> > Messenger* messenger = [[Messenger alloc] initWithApp:@"Messenger"
> > :self];
> > [currentConversations setObject:messenger forKey:[NSNumber
> > numberWithInt:convId]];
>
> And here is where you are doing it:
>
> > NSView* newView = [[[NSView alloc] init] autorelease];
>
> This is not the designated initializer. Don't do this.
>

FYI, designated initializers are something subclassers need to be aware of,
not users of class.

You can use whatever init method you want to make an object.

-Ken
Cocoa Frameworks


>
> > [newView setAutoresizesSubviews:YES];
> > [[messenger view] setFrame:[newView frame]];
>
> Why do you expect [newView frame] to return a sensible value?
>
> 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/kenferry%40gmail.com
>
> This email sent to kenfe...@gmail.com
>
___

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

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

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

This email sent to arch...@mail-archive.com


creating docx file

2010-09-20 Thread Philip White
Hello,
  I've tried using the following code to save an attributed string as a docx 
file.

//the attributed string is 'contents'

NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys: 
NSOfficeOpenXMLTextDocumentType, NSDocumentTypeDocumentAttribute, nil];
NSRange range = {0,[contents length]};

NSError *error=nil;
NSFileWrapper *wrapper = [contents fileWrapperFromRange: range 
documentAttributes: attributes error: &error];

[wrapper writeToFile:[path stringByExpandingTildeInPath] atomically:YES 
updateFilenames:NO];


What I end up with is what appears to be an unzipped docx file (my 
understanding is that docx files are zipped archives), i.e a folder full of 
various resource files. I then try zipping it and changing the extension to 
docx but I don't seem to end up with a valid docx file, or at least not 
something that Pages 2008 can open. Maybe that version of Pages can't open that 
format anyway, but still that code clearly isn't creating what I would call a 
docx file. Any thoughts?

Thanks,
  Philip
___

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

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

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

This email sent to arch...@mail-archive.com


Re: What's the point of @properties?

2010-09-20 Thread Antonio Nunes
On 20 Sep 2010, at 20:00, Kyle Sluder wrote:

> Did you mean "synthesized ivars"? It is important you be precise.

Yes that is what I meant.

> Automatically showing synthesized properties—or any properties at
> all—would be a bad idea, because methods have side effects, and even
> calling simple accessors at the wrong time can be detrimental to your
> program (remember, the debugger can be stopped anywhere; what if it's
> in the middle of updating the method cache in objc_msgSend, and then
> you go up a few frames into your own code?).
> 
> Automatically showing synthesized ivars is a much safer operation, and
> one I too would like to see in the debugger.

Yes, that is what I'd like to see to.

Hmmm, I guess this should really move over to xcode-users if we continue the 
thread.

António

-
Forgiveness is not an occasional act;
it is a permanent attitude.

--Martin Luther King, Jr
-




___

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

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

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

This email sent to arch...@mail-archive.com


Re: One last try: how do you make a bookmark bar like Safari?

2010-09-20 Thread Mike Abdullah
There is also http://mattgemmell.com/2008/10/28/mgscopebar

On 20 Sep 2010, at 19:42, Brad Stone wrote:

> I sent this out last week and go no replies.  Please excuse me for sending it 
> out again but I want to try one more time in case someone has an answer.
> 
> I've been spending some time searching and thinking about how I can make a 
> bookmark bar like in Safari or Firefox.  It has some of the characteristics 
> of a toolbar especially when the window is small it puts the remaining 
> toolbar items in a drop-down menu but it also has some of the properties of a 
> collectionView with editable views, reordering and dragging.  I've seen some 
> threads here but haven't found anything definitive.
> 
> How have any of you implemented one?
> 
> 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/cocoadev%40mikeabdullah.net
> 
> This email sent to cocoa...@mikeabdullah.net

___

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

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

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

This email sent to arch...@mail-archive.com


Re: What's the point of @properties?

2010-09-20 Thread Kyle Sluder
On Mon, Sep 20, 2010 at 11:39 AM, Antonio Nunes
 wrote:
> On 20 Sep 2010, at 19:27, Seth Willits wrote:
>
>> And Chris explained that properties don't necessarily *have* ivars for you 
>> to look at anyway. If you want to see its value, then you need to run the 
>> print/po command on the gdb command line.
>
> Fair enough. And what I would like to see, is the debugger window in code 
> being smart enough to show the synthesised properties. Any chance of that 
> ever happening?

Did you mean "synthesized ivars"? It is important you be precise.

Automatically showing synthesized properties—or any properties at
all—would be a bad idea, because methods have side effects, and even
calling simple accessors at the wrong time can be detrimental to your
program (remember, the debugger can be stopped anywhere; what if it's
in the middle of updating the method cache in objc_msgSend, and then
you go up a few frames into your own code?).

Automatically showing synthesized ivars is a much safer operation, and
one I too would like to see in the debugger.

--Kyle Sluder
___

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

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

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

This email sent to arch...@mail-archive.com


Re: One last try: how do you make a bookmark bar like Safari?

2010-09-20 Thread Chris Ridd

On 20 Sep 2010, at 19:42, Brad Stone wrote:

> I sent this out last week and go no replies.  Please excuse me for sending it 
> out again but I want to try one more time in case someone has an answer.
> 
> I've been spending some time searching and thinking about how I can make a 
> bookmark bar like in Safari or Firefox.  It has some of the characteristics 
> of a toolbar especially when the window is small it puts the remaining 
> toolbar items in a drop-down menu but it also has some of the properties of a 
> collectionView with editable views, reordering and dragging.  I've seen some 
> threads here but haven't found anything definitive.
> 
> How have any of you implemented one?

Do any of the ones at  work for you?

Cheers,

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


One last try: how do you make a bookmark bar like Safari?

2010-09-20 Thread Brad Stone
I sent this out last week and go no replies.  Please excuse me for sending it 
out again but I want to try one more time in case someone has an answer.

I've been spending some time searching and thinking about how I can make a 
bookmark bar like in Safari or Firefox.  It has some of the characteristics of 
a toolbar especially when the window is small it puts the remaining toolbar 
items in a drop-down menu but it also has some of the properties of a 
collectionView with editable views, reordering and dragging.  I've seen some 
threads here but haven't found anything definitive.

How have any of you implemented one?

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


Re: What's the point of @properties?

2010-09-20 Thread Antonio Nunes
On 20 Sep 2010, at 19:27, Seth Willits wrote:

> And Chris explained that properties don't necessarily *have* ivars for you to 
> look at anyway. If you want to see its value, then you need to run the 
> print/po command on the gdb command line.

Fair enough. And what I would like to see, is the debugger window in code being 
smart enough to show the synthesised properties. Any chance of that ever 
happening?

Cheers,
António

---
Some things have to be believed to be seen.

--Ralph Hodgson
---



___

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

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

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

This email sent to arch...@mail-archive.com


Re: What's the point of @properties?

2010-09-20 Thread Seth Willits
On Sep 20, 2010, at 9:23 AM, Stefan Nobis wrote:

> Antonio Nunes  writes:
> 
>> Maybe Stefan meant rather that the ivars do not show up in the
>> debugger window.
> 
> Yes, that was the point of the question.

And Chris explained that properties don't necessarily *have* ivars for you to 
look at anyway. If you want to see its value, then you need to run the print/po 
command on the gdb command line.


--
Seth Willits



___

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

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

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

This email sent to arch...@mail-archive.com


Re: Accessing NSDistantObject from different threads concurrently

2010-09-20 Thread Oleg Krupnov
Thanks, Kyle

> Multithreading is not a prerequisite for serving multiple clients. Depending 
> on what your server's doing, sticking with NSRunLoop-based multiplexing might 
> be a lot easier.

The server's job is associated with slow devices, such as disk, but
are quite lengthy in time. In your scenario, all client threads will
be unnecessarily waiting for the server to complete the current job,
while there is still a lot of CPU time to run the other jobs
concurrently.

> The NSConnection documentation has a bunch of methods for dealing with 
> multiple threads.

Maybe you're right, but I haven't found examples. A pointer would be
appreciated. Am I correct assuming that by default there is only one
thread in the server process, and if multiple threads are trying to
access the proxy, all but one will be blocked?

> In your case, though, it sounds like you only want to vend one object through 
> which all your clients communicate. Even if that communication is achieved by 
> asking the vended object for another object with which to communicate.

I don't mind to vend only a single object, through which to ask for
the other object to actually communicate with clients. I've been
thinking about it myself. The problem is how to spawn a new thread for
each such object in the server process and make it listen to all
incoming requests from the corresponding client.

Thanks,

Oleg.
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Accessing NSDistantObject from different threads concurrently

2010-09-20 Thread Kyle Sluder
On Sep 20, 2010, at 8:51 AM, Oleg Krupnov  wrote:

> Hi,
> 
> I have a main process and an auxiliary process that vends
> NSDistantObject to do some job for the main process upon request. In
> other words, the main process is a client, and the auxiliary process
> is a server. I have been able to implement this when there is only one
> thread in the client process.
> 
> Now I need to have multiple threads in the client process. Each client
> thread must run concurrently with other client threads, so that if two
> or more client threads request the server process at the same time,
> they should not block waiting for each other. In other words, the
> server should probably create a thread for each client thread.

Multithreading is not a prerequisite for serving multiple clients. Depending on 
what your server's doing, sticking with NSRunLoop-based multiplexing might be a 
lot easier.

> 
> What is the best way to do this? It's not clear how to vend multiple
> NSDistantObjects for multiple client threads, and spawning multiple
> auxiliary processes for each client thread would be a nightmare...

The NSConnection documentation has a bunch of methods for dealing with multiple 
threads.

In your case, though, it sounds like you only want to vend one object through 
which all your clients communicate. Even if that communication is achieved by 
asking the vended object for another object with which to communicate.

--Kyle Sluder___

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

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

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

This email sent to arch...@mail-archive.com


Re: NSView resizing problems.

2010-09-20 Thread Kyle Sluder
On Sep 20, 2010, at 8:31 AM, Geoffrey Holden <45rpmli...@googlemail.com> wrote:

> You make an excellent point.  But you raise two questions.
> 
> 1. If '' isn't the correct way to initialize, what is?

Read the docs. NSView has two dedicated initializers, neither of which is -init.

> 2. Should I just create an arbitrary placeholder framesize and use that
> during initialization? Or is it acceptable to set no framesize at all at
> this stage?

Why are you creating a view at all? Just add the one you've loaded from NIB to 
your tab view. It already has a size.

--Kyle Sluder
> 

___

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

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

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

This email sent to arch...@mail-archive.com


Re: NSInvocationOperation problem with a signal exc_bad_access

2010-09-20 Thread Ken Thomases
On Sep 20, 2010, at 11:06 AM, ico wrote:

>   NSInvocationOperation *theOp = [[[NSInvocationOperation alloc]
> initWithTarget:dp selector:@selector(massiveWork:) object:nil] autorelease];

The selector here is "massiveWork:" with a colon.

> - (void) massiveWork {

The selector for this method is "massiveWork" with no colon.

Those are not the same.  You are trying to construct an NSInvocationOperation 
to invoke a method which doesn't exist, probably.

Regards,
Ken

___

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

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

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

This email sent to arch...@mail-archive.com


Re: What's the point of @properties?

2010-09-20 Thread Stefan Nobis
Antonio Nunes  writes:

> Maybe Stefan meant rather that the ivars do not show up in the
> debugger window.

Yes, that was the point of the question.

-- 
Until the next mail...,
Stefan.


pgpasS7cYk4A8.pgp
Description: PGP 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 arch...@mail-archive.com

Re: NSInvocationOperation problem with a signal exc_bad_access

2010-09-20 Thread Nick Zitzmann

On Sep 20, 2010, at 10:06 AM, ico wrote:

> can someone tell me what problem is, NSInvocationOperation allocation is
> even failed, I guess it maybe a simple problem

Not without a crash report. You didn't release the target before creating the 
invocation operation, did you? Also, if you're using Snow Leopard, then try 
running your app in Instruments using the zombies instrument. If the crash was 
caused by accessing a dead object, then Instruments will show you the object's 
history.

Nick Zitzmann


___

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

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

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

This email sent to arch...@mail-archive.com


NSInvocationOperation problem with a signal exc_bad_access

2010-09-20 Thread ico
Hi All,

I have a test program which is "command line tool" type when I created the
project.
I also have added a class into this project, called DemoPoint.
My main function showed as follow:

int main (int argc, const char * argv[]) {
   NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
   // perform some test codes;

   DemoPoint *dp = [[DemoPoint alloc] init];
   [dp display];
   // so far so good

   // receive signal exc_bad_access when the program execute the next
statment
   NSInvocationOperation *theOp = [[[NSInvocationOperation alloc]
initWithTarget:dp selector:@selector(massiveWork:) object:nil] autorelease];

   [dp release];
   [pool drain];
   return 0;
}

here is the massiveWork method in DemoPoint class:

- (void) massiveWork {

int count = 0;

for (int i = 0; i < 1000; i++) {

count += 2;

}

NSLog(@"massive work done!");

}

can someone tell me what problem is, NSInvocationOperation allocation is
even failed, I guess it maybe a simple problem
but I am just new to Objective-C, so please help, thanks.

-- 
==
Life isn't about finding yourself.
Life is about creating yourself.
___

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

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

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

This email sent to arch...@mail-archive.com


Accessing NSDistantObject from different threads concurrently

2010-09-20 Thread Oleg Krupnov
Hi,

I have a main process and an auxiliary process that vends
NSDistantObject to do some job for the main process upon request. In
other words, the main process is a client, and the auxiliary process
is a server. I have been able to implement this when there is only one
thread in the client process.

Now I need to have multiple threads in the client process. Each client
thread must run concurrently with other client threads, so that if two
or more client threads request the server process at the same time,
they should not block waiting for each other. In other words, the
server should probably create a thread for each client thread.

What is the best way to do this? It's not clear how to vend multiple
NSDistantObjects for multiple client threads, and spawning multiple
auxiliary processes for each client thread would be a nightmare...

Thanks,

Oleg.
___

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

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

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

This email sent to arch...@mail-archive.com


Re: NSView resizing problems.

2010-09-20 Thread Geoffrey Holden
You make an excellent point.  But you raise two questions.

1. If '' isn't the correct way to initialize, what is?
2. Should I just create an arbitrary placeholder framesize and use that
during initialization? Or is it acceptable to set no framesize at all at
this stage?

Thanks for your help.

On Mon, Sep 20, 2010 at 3:52 PM, Keary Suska wrote:

> On Sep 20, 2010, at 5:45 AM, Geoffrey Holden wrote:
>
> > My problem is that when I load this view into a tab (using the attached
> > code), the textview doesn't fit on the screen.  It covers up the top
> > textfield and seems to have it's top edge somewhere above the tabview (as
> > follows)
>
> The most common reason for this is that you are shrinking the view such
> that it forces the subviews to overlap, which creates an undefined situation
> that the view cannot handle.
>
> > Messenger* messenger = [[Messenger alloc] initWithApp:@"Messenger"
> > :self];
> > [currentConversations setObject:messenger forKey:[NSNumber
> > numberWithInt:convId]];
>
> And here is where you are doing it:
>
> > NSView* newView = [[[NSView alloc] init] autorelease];
>
> This is not the designated initializer. Don't do this.
>
> > [newView setAutoresizesSubviews:YES];
> > [[messenger view] setFrame:[newView frame]];
>
> Why do you expect [newView frame] to return a sensible value?
>
> 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 arch...@mail-archive.com


Re: Distributed object vending problem

2010-09-20 Thread Ken Thomases
On Sep 18, 2010, at 11:14 AM, Ken Tozier wrote:

> I'm writing two apps: A server and client and am having some trouble figuring 
> exactly what to link to in the client program. The server application has a 
> main class that has dozens of dependencies. I don't want to have to import 
> all the server app dependencies into the client application as that defeats 
> the purpose of factoring code into separate apps. How do I send messages to a 
> server's vended object without having to include the server's entire 
> dependency tree? I looked into protocols and proxies but am not sure which to 
> use.

The client shouldn't have or need any of the server's implementation code.  You 
should define a protocol for the interface to the vended object in a header 
that's shared by both the client and the server.

Then, cast the NSDistantObject* pointer returned by one of the rootProxy... 
methods to NSDistantObject* (or, if you prefer, 
id).  Then, just invoke the appropriate methods on it.

The client should also use -[NSDistantObject setProtocolForProxy:] for 
efficiency.  And the server should probably vend an NSProtocolChecker instead 
of the actual object.  Any actual object is likely to have a number of private 
or internal-use-only methods on it, which you don't want accessible from 
client.  The NSProtocolChecker makes sure that only the appropriate methods are 
accessible.

The client code should have no mention of the actual class used on the server.

Regards,
Ken

___

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

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

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

This email sent to arch...@mail-archive.com


Re: NSView resizing problems.

2010-09-20 Thread Keary Suska
On Sep 20, 2010, at 5:45 AM, Geoffrey Holden wrote:

> My problem is that when I load this view into a tab (using the attached
> code), the textview doesn't fit on the screen.  It covers up the top
> textfield and seems to have it's top edge somewhere above the tabview (as
> follows)

The most common reason for this is that you are shrinking the view such that it 
forces the subviews to overlap, which creates an undefined situation that the 
view cannot handle.

> Messenger* messenger = [[Messenger alloc] initWithApp:@"Messenger"
> :self];
> [currentConversations setObject:messenger forKey:[NSNumber
> numberWithInt:convId]];

And here is where you are doing it:

> NSView* newView = [[[NSView alloc] init] autorelease];

This is not the designated initializer. Don't do this.

> [newView setAutoresizesSubviews:YES];
> [[messenger view] setFrame:[newView frame]];

Why do you expect [newView frame] to return a sensible value?

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


Re: NSImage

2010-09-20 Thread Uli Kusterer
On Sep 19, 2010, at 6:36 PM, k...@highrolls.net wrote:
> So I thought I would draw the images as subclasses of NSImage in the tool 
> box.  Use mouseDown and mouseMoved to move them around the tool box.

 Did you perhaps mean NSImageView?

> Use drag and drop to go from the tool box to the layout and then mouseDown 
> and mouseMoved to reposition and reorient them in the layout.

 This may be a little awkward. You only get mouseDragged: etc. when the mouse 
is over your view, so if the user is dragging outside, you won't know where the 
mouse is (usually items dragged inside a canvas stop e.g. at the left edge of 
the canvas, but still follow up-and-down movements).

> Am I on the right track or is there something even easier?


 I think the best idea is probably to look at Apple's "Sketch" sample code, it 
is a little sample app available with full source code from Apple's web site. 
What it essentially does is create an NSObject subclass for each item that 
*has* an NSImage (or NSBezierPath or NSRect or whatever drawing primitive makes 
sense), not *is* a subclass of one. It then keeps a list of those and has the 
view draw them.

 However, if you want to draw *between* two views, or even from one window into 
another, you'll want to do the actual dragging using "drag and drop". This 
takes care of the actual moving of an image for you, but is a little more 
complicated because you need to come up with a way of attaching your NSObject 
subclass to the drag as a drag flavor (which can't take custom classes -- so I 
recommend you look into NSKeyedArchiver/NSKeyedUnarchiver to generate an NSData 
from your objects).

 I hope I've pointed you in the right general direction(s).

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Programmatic View Question

2010-09-20 Thread Uli Kusterer

On Sep 20, 2010, at 2:23 PM, Richard Somers wrote:

> On Sep 18, 2010, at 5:43 PM, Raleigh Ledet wrote:
> 
>> Then you were not aware that if you can load a nib multiple times to create 
>> multiple instances of the same view hierarchy.
> 
> Correct. I did not know that you could load a nib multiple times. Thanks for 
> the info.


 You'll need a new file's owner, though. Otherwise the newly-loaded NIB will 
fill out the same outlets each time, losing the old ones.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Programmatic View Question

2010-09-20 Thread Richard Somers

On Sep 18, 2010, at 5:43 PM, Raleigh Ledet wrote:

Then you were not aware that if you can load a nib multiple times to  
create multiple instances of the same view hierarchy.


Correct. I did not know that you could load a nib multiple times.  
Thanks for the info.


--Richard

___

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

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

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

This email sent to arch...@mail-archive.com


re; Distributed object vending problem

2010-09-20 Thread Kirk Kerekes
> How do I send messages to a server's vended object without having to include 
> the server's entire dependency tree?


Incorporate the methods that you actually need for remote interaction into a 
protocol that is defined in a separate .h file, and #import it at both ends of 
the connection. You want to do that anyway to specify the special DO properties 
for those methods (bycopy, oneway, et al).

To keep things clean on the server end, I would factor out the same methods 
into a category on the server class. The category then implements the protocol 
compliance.

If you are communication across the wire I highly recommend oneway void methods 
with explicit bycopy params, BTW -- combined with async callbacks (also 
oneway-void + bycopy) you get a robust system that will survive real-world 
issues better. 





___

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

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

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

This email sent to arch...@mail-archive.com


Re: What's the point of @properties?

2010-09-20 Thread Antonio Nunes
On 20 Sep 2010, at 11:47, Chris Hanson wrote:

> GDB doesn’t support dot syntax for invoking property getters, so you just 
> need to use bracket syntax when doing it:

Maybe Stefan meant rather that the ivars do not show up in the debugger window. 
It's a real pain to have to go to the console every time you want to know the 
value of an ivar, when stepping through your code. I was highly surprised by 
this behaviour when I first ran into it, and it is the single most important 
reason why I continue to declare ivars in the @interface block in projects 
where I otherwise would not have to. 

António

---
Don't believe everything you think
---




___

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

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

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

This email sent to arch...@mail-archive.com


NSView resizing problems.

2010-09-20 Thread Geoffrey Holden
I've set up a view in it's own separate NIB.  I've done this because the
same view will be loaded multiple times into an NSTabView (where each tab is
a conversation with a different person).  The NIB contains the following
elements:

NSTextField (*) (top of the screen, anchored top, left and right, and set to
shrink/grow as the screen width changes)
NSTextView (#) (middle of the screen, anchored top, left, right and bottom,
and set to shrink/grow as the screen width and height changes)
NSTextField (=) (bottom of the screen, anchored bottom, left and right, and
set to shrink/grow as the screen width changes)
3 Buttons (B) (bottom of the screen, anchored bottom and right)






== B
== B
== B

My problem is that when I load this view into a tab (using the attached
code), the textview doesn't fit on the screen.  It covers up the top
textfield and seems to have it's top edge somewhere above the tabview (as
follows)

Tab view right
|
|
- Tab view top
|
|
|
|
|
== B|=
== B|=
== B|=

Furthermore, the bottom textfield seems to have its right edge to the right
of the right edge of the tab view.  Using the interface simulator (in IB) on
the view, the view appears to behave correctly.  The problem only occurs
when I load the NIB into a tab.

My current workaround (for testing only - it doesn't look at all
professional) is to turn off the shrink/grow functionality in IB for each of
the elements.  I've tried putting all the elements into an NSBox - but the
same issue occurs.  Can anyone suggest what I'm doing wrong?

Messenger* messenger = [[Messenger alloc] initWithApp:@"Messenger"
:self];
[currentConversations setObject:messenger forKey:[NSNumber
numberWithInt:convId]];

NSView* newView = [[[NSView alloc] init] autorelease];
[newView setAutoresizesSubviews:YES];
[[messenger view] setFrame:[newView frame]];
[[messenger view] setAutoresizingMask:NSViewWidthSizable |
NSViewHeightSizable];
[newView addSubview:[messenger view]];

NSTabViewItem* newTabView = [[[NSTabViewItem alloc] init] autorelease];
[newTabView setLabel:recipient];
[newTabView setToolTip:recipient];
[newTabView setView:newView];

[messagePane addTabViewItem:newTabView];
___

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

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

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

This email sent to arch...@mail-archive.com


Re: What's the point of @properties?

2010-09-20 Thread Chris Hanson
On Sep 19, 2010, at 12:52 PM, Jim Thomason wrote:

> I'm refactoring and updating a lot of my older code, and one of the
> things I'm finally looking into is declaring things as properties.
> 
> But...what's the point? I've been trying to read up on the subject and
> have found a lot of posts and discussion about the subject, but very
> little of it seems to get down to the meat of what these things are
> and why I should care about them.
> 
> At the simplest level, I just look at them as some syntactic sugar.

Don't think of @property as syntactic sugar for declaring getter and setter 
methods.

Think of @property as the way to declare the state exposed by an instance of a 
class, and methods as the way to declare the behavior exposed by an instance of 
a class.  (Or the class itself.)

> I know I'd get use of the dot syntax (I do need to use @properties to
> do that, right?), but I'm eschewing it anyway.

The same argument applies:

Don't think of dot syntax as syntactic sugar for sending messages.

Think of dot syntax as the way to access the state exposed by an object, and 
bracket syntax as the way to have an object do something.

Yes, getting or setting state might “do something” behind the scenes, but 
conceptually you’re more getting or modifying some information “about” the 
object than treating it like an actor.

This is part of why Xcode only offers dot syntax completions for properties 
declared via @property; it helps maintain the state versus behavior 
distinction.  (Otherwise, it would offer completions like “.retain” and 
“.copy”.)

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


Re: What's the point of @properties?

2010-09-20 Thread Chris Hanson
On Sep 20, 2010, at 3:30 AM, Stefan Nobis wrote:

> Bill Bumgarner  writes:
> 
>> Thus, with the latest bleeding edge compiler, all you need is the
>> @property() (and cleanup in -dealloc) to declare a fully KVO
>> compliant attribute of your class.
> 
> Is this also supported by the debugger? In XCode 3.x I once tried to
> omit the iVars but that's not very funny to debug (as it's hard to
> inspect the property values without manually declared iVars).

Instance variables are just one way of providing backing storage for a 
property.  Core Data, for example, provides its own mechanisms.  You could also 
do something similar for your own classes.  Or you can have properties that 
expose state which is entirely dynamic, and not backed by any storage of its 
own (such as the count of a collection).

Thus to inspect the property, you need to actually run the getter to access the 
property.  (With, alas, all the caveats that implies.)

GDB doesn’t support dot syntax for invoking property getters, so you just need 
to use bracket syntax when doing it:

// Code:
@interface Account : NSObject
@property (readwrite, copy) NSString *name;
@property (readwrite, getter=isEnabled) BOOL enabled;
@end

// While debugging:
(gdb) po [someAccount name]
(gdb) print (BOOL)[someAccount isEnabled]

If you’re using automatic or manual ivar synthesis, the default name is the 
same as the ivar, so with a little bit of work you can get the ivar values in 
gdb:

(gdb) po object_getIvar(someAccount, class_getInstanceVariable([someAccount 
class], "name")
(gdb) print *((BOOL *)((void *)someAccount + 
ivar_getOffset(class_getInstanceVariable([someAccount class], "enabled")))

(Note: Written in Mail, so there may be casting etc. that the above needs to 
actually work.)

Something like that should work well enough to encapsulate in a debugger macro, 
if someone so desires. 

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


Re: What's the point of @properties?

2010-09-20 Thread Stefan Nobis
Bill Bumgarner  writes:

> Thus, with the latest bleeding edge compiler, all you need is the
> @property() (and cleanup in -dealloc) to declare a fully KVO
> compliant attribute of your class.

Is this also supported by the debugger? In XCode 3.x I once tried to
omit the iVars but that's not very funny to debug (as it's hard to
inspect the property values without manually declared iVars).

-- 
Until the next mail...,
Stefan.


pgphvyyOqvWWh.pgp
Description: PGP 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 arch...@mail-archive.com

iPhone 4 debugger error repeating everytime

2010-09-20 Thread Sivakumar Kandappan Singaravadivelu
Hello everyone
I`m getting this strange warning when i start my program in debugging mode
and repeats for every step.

*
*

*Asertion failed: (cls), function getName, file
/SourceCache/objc4_Sim/objc4-427.1.1/runtime/objc-runtime-new.m, *

*
*

*
*

*I created my program in xcode 3.2.2 but i`m getting this error when i run
this program in xcode 4. Can any one tell me the solution . *

*
*

*thanks everyone*

*Sivakumar*
___

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

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

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

This email sent to arch...@mail-archive.com


Distributed object vending problem

2010-09-20 Thread Ken Tozier
Hi

I'm writing two apps: A server and client and am having some trouble figuring 
exactly what to link to in the client program. The server application has a 
main class that has dozens of dependencies. I don't want to have to import all 
the server app dependencies into the client application as that defeats the 
purpose of factoring code into separate apps. How do I send messages to a 
server's vended object without having to include the server's entire dependency 
tree? I looked into protocols and proxies but am not sure which to use.

Any help appreciated.___

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

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

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

This email sent to arch...@mail-archive.com