Re: Bindings Question

2010-09-24 Thread Quincey Morris
On Sep 24, 2010, at 20:09, livinginlosange...@mac.com wrote:

> I have variable in my NSDocument subclass that is bound to the following path 
> _myNSArrayController.selection.subNSArrayController.selection.variableOfInterest.
> 
> When I change the subNSArrayController's selection, I don't always see my 
> variable's setters getting called in my NSDocument subclass.

Bound how?


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


Bindings Question

2010-09-24 Thread livinginlosangeles
I have variable in my NSDocument subclass that is bound to the following path 
_myNSArrayController.selection.subNSArrayController.selection.variableOfInterest.

When I change the subNSArrayController's selection, I don't always see my 
variable's setters getting called in my NSDocument subclass. WHY?? Its not like 
I'm a binding noob!  Ugh.


Patrick
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


What would cause my animation's delegate methods to not be called?

2010-09-24 Thread Gideon King
Hi, I have a CALayer subclass with a CGPoint that I am animating using a 
CABasicAnimation. The layer is one of many sublayers in a layer hosting view.  

I set up the animation to point to my layer as the delegate, and use 
addAnimation:forKey: to add the animation. The animation works fine, but the 
animationDidStart: and animationDidStop:finished: methods are never called.

I am not setting up an animation group, and it doesn't seem to make any 
difference whether I use an explicit transaction or not.

Any ideas why the animation delegate methods would not be called?


Thanks

Gideon




___

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

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

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

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


Re: Cocoa Text System - Temporarily Disabling Layout

2010-09-24 Thread Douglas Davidson

On Sep 23, 2010, at 7:54 AM, Jonathan Dann wrote:

> In our app, Kaleidoscope, I have 2 text views side-by-side. In one 
> configuration the layout of the text in each text view is dependent both on 
> regions of layout in the "sibling" text view, and the model objects which 
> represent the the insert, equal and deleted regions of the diff.
> 
> The problem I've had to continuously hack around is that NSTextView, in 
> conjunction with NSLayoutManager, is rather eager to get the text to 
> re-layout. For example, when I resize the window and need to adjust the 
> frames of both scroll views, calling -[NSTextView setFrame:] results in the 
> layout manager invalidating and ensuring layout for the newly visible 
> character range.
> 
> I'd like to know if anybody has had any experience/luck with completely 
> disabling the automatic layout that the text system does in response to these 
> changes in state?

You can look at the source to TextEdit for an example of removing the layout 
manager(s) from the text storage and then re-adding them, to prevent layout 
from occurring for a certain period.  This would probably not be appropriate if 
you want to retain any layout information across this transition, but if all 
the text needs to be laid out again anyway, it could be useful.

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


How do you remove an item from recentDocumentURLs?

2010-09-24 Thread bmaclist
If a valid document gets into my 'Recent Documents' menu, and then gets 
corrupted such that I am unable to open it, how can I programmatically remove 
it from the Recent Documents list (without removing everything in the list)?

Documentation says overriding recentDocumentURLs isn't used by the 
DocumentController internals

I've tried overriding the applicationDelegate's application:OpenFile: and 
returning NO, but that causes cocoa to attempt to open via the document 
controller (and does not remove it from the list) when the open fails.
(some postings say returning NO tells cocoa to remove the item for the 
list...and it may for non-Document based 
apps)___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSBox setContentView: messing with the cursor

2010-09-24 Thread Richard Somers

On Sep 23, 2010, at 10:18 PM, Richard Somers wrote:

I have a NSBox in a portion of a window. The box is used to swap  
views into the window by setting the content view of the box.


When a view is swapped in I need to set the cursor but NSBox is  
changing the cursor out from underneath me.




When the content view of a NSBox is changed, the window updates the  
cursor even if the cursor is not inside the box. If you do not want  
this, then send the window a 'disableCursorRects' message.


Thanks to everyone for helping me figure this out.

--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: invalid conversion from 'void*' to 'CGImage*' (QTMovie)

2010-09-24 Thread Quincey Morris
On Sep 24, 2010, at 05:13, Carles Gutierrez wrote:

> CGImageRef capturedImage = [(QTMovie*)movie frameImageAtTime:time
> withAttributes:attributes error:NULL];
> 
> I am getting this error for the last line:
> error: invalid conversion from 'void*' to 'CGImage*'
> 
> BUT I am NOT getting an error for the line above that...
> 
> Given the attributes I have set, particularly [attributes
> setObject:QTMovieFrameImageTypeCGImageRef forKey: QTMovieFrameImageType];
> Shouldn't frameAtImageTime: return a CGImageRef?

It doesn't matter what kind of object you've asked for at run time, because the 
error you're seeing is a compilation error.

So this code is in a Objective-C++ file? It compiles without error for me (GCC 
4.2) as plain Objective-C.

As C++, it probably requires an explicit cast from the return type of 
frameImageAtTime:withAttributes:error: -- that is, NSImage* -- to CGImageRef.


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: UITableview scrollStyle

2010-09-24 Thread Eric E. Dolecki
That's what I was getting after... the ability to use something besides
white, black or black with a white border. I guess it will have to do. Odd
we can specify colors for separators but not the scroll indicator.


  Google Voice: (508) 656-0622
  Twitter: eric_dolecki  XBoxLive: edolecki  PSN: eric_dolecki
  http://blog.ericd.net



On Fri, Sep 24, 2010 at 3:22 PM, glenn andreas  wrote:

>
> On Sep 24, 2010, at 1:03 PM, Eric E. Dolecki wrote:
>
> > Is white and black our only options for the scroller indicator in a
> > UITableView? I was hoping to change mine to a blue since mine is on top
> of
> > black and would match the design better.
> >
>
> UITableView is a subclass of UIScrollView, so you can just set the
> scrollbar type.
>
> However, like UIScrollView, you are limited to three choices - all black,
> all white, or black with a white border...
>
>
>
> Glenn Andreas  gandr...@gandreas.com
> The most merciful thing in the world ... is the inability of the human mind
> to correlate all its contents - HPL
>
>
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: UITableview scrollStyle

2010-09-24 Thread glenn andreas

On Sep 24, 2010, at 1:03 PM, Eric E. Dolecki wrote:

> Is white and black our only options for the scroller indicator in a
> UITableView? I was hoping to change mine to a blue since mine is on top of
> black and would match the design better.
> 

UITableView is a subclass of UIScrollView, so you can just set the scrollbar 
type.

However, like UIScrollView, you are limited to three choices - all black, all 
white, or black with a white border...



Glenn Andreas  gandr...@gandreas.com 
The most merciful thing in the world ... is the inability of the human mind to 
correlate all its contents - HPL

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


invalid conversion from 'void*' to 'CGImage*' (QTMovie)

2010-09-24 Thread Carles Gutierrez
I'm getting a strange error I cannot fix.
I have declared a QTMovie like this, using an opensource template
(openframeworks):

// It's a Cocoa QTMovie, void*'s so it's C++ compatible
void*movie;

I have the following code in my project:

NSMutableDictionary *attributes = [NSMutableDictionary dictionary];

   NSSize imageSize = NSMakeSize(95, 120);
   NSValue *sizeValue = [NSValue valueWithSize:imageSize];
   [attributes setObject:sizeValue forKey:QTMovieFrameImageSize];
   [attributes setObject:
QTMovieFrameImageTypeCGImageRef forKey: QTMovieFrameImageType];

QTTime time = [(QTMovie*)movie currentTime];

CGImageRef capturedImage = [(QTMovie*)movie frameImageAtTime:time
withAttributes:attributes error:NULL];

I am getting this error for the last line:
error: invalid conversion from 'void*' to 'CGImage*'

BUT I am NOT getting an error for the line above that...

Given the attributes I have set, particularly [attributes
setObject:QTMovieFrameImageTypeCGImageRef forKey: QTMovieFrameImageType];
Shouldn't frameAtImageTime: return a CGImageRef?

Cheers,
Carles
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


UITableview scrollStyle

2010-09-24 Thread Eric E. Dolecki
Is white and black our only options for the scroller indicator in a
UITableView? I was hoping to change mine to a blue since mine is on top of
black and would match the design better.


  Google Voice: (508) 656-0622
  Twitter: eric_dolecki  XBoxLive: edolecki  PSN: eric_dolecki
  http://blog.ericd.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: Cocoa Text System - Temporarily Disabling Layout

2010-09-24 Thread Martin Wierschin
when I resize the window and need to adjust the frames of both  
scroll views, calling -[NSTextView setFrame:] results in the  
layout manager invalidating and ensuring layout for the newly  
visible character range.


Why not just turn off text view width/height tracking for the  
container during the resize? That should let the layout manager use  
the existing layout information (ie: for the stale container size).


Because that's just moving the problem further down the line. When I  
finally update the text container size for the first text view it  
will begin to layout before I've reached the next line of my code  
where I can fix the size of the second view.


My next suggestion would be to subclass NSLayoutManager and override  
methods that handle invalidation, eg:


- (void) textContainerChangedGeometry:(NSTextContainer*)tc ;
	- (void) invalidateLayoutForCharacterRange:(NSRange)charRng isSoft: 
(BOOL)isSoft actualCharacterRange:(NSRange*)charRngPtr ;
	- (void) invalidateLayoutForCharacterRange:(NSRange)charRng  
actualCharacterRange:(NSRange*)charRngPtr ;


When your resize starts, set some flag on your subclass that makes all  
those methods no-ops. When you've finished resizing both text systems,  
clear your flag and re-invalidate as necessary.


But really, I might ask you why your own code is so delicate that it  
needs both layout systems to be in some perfectly matched state at all  
times. Surely your code could have a flag that tells it layout is not  
yet synced up, and ancillary tasks should be avoided/delayed until a  
stable state is established.


The other "state change" you explicitly touch upon is editing the  
text. If you bracket all your changes to the text storage with  
begin/end editing calls, you shouldn't trigger layout until all  
your changes are finished (unless you're also inadvertently  
triggering layout in other ways).


I'll see how that fits in with setting the 2 strings that are  
dependent on each other. It may be a nice workaround.


Just be careful that you don't trigger layout while the text storage  
has an edit open, eg:


[textStorage beginEditing];
[textStorage deleteCharactersInRange:someRange];
	[layoutManager ensureLayoutForCharacterRange:NSMakeRange(0,  
[textStorage length])];

[textStorage endEditing];

The layout system isn't tolerant of that. It used to just throw out-of- 
bounds exceptions, though now it seems to give you exceptions with  
nice explanations of what you've done wrong.


~Martin

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: "Settings" button in UITableView

2010-09-24 Thread Remco Poelstra
Op 24 sep. 2010 om 17:15 heeft Matt Neuburg  het volgende 
geschreven:

> On Fri, 24 Sep 2010 10:33:28 +0200, Remco Poelstra 
> said:
>> Hi,
>> 
>> I've a UITableView with UITableViewCell of style UITableViewStyleSubtitle.
>> The table shows devices that the app has found on the Wifi network. When
>> I click on a row I show a detailview of the device. This all works fine.
>> The device has some internal configuration settings that the user needs
>> to be able to change (like whether the device uses DHCP for its IP
>> address). In order to let the user change these settings I've added a
>> "settings" button to my UIToolbar. When the user taps the button I want
>> to show a button for each row which allows the user to enter the
>> configuration view. Much like the "Delete" button in the e-mail app.
>> I've found out that I can change the text of the default "Delete"
>> button, but how can I show that button without putting the UITableView
>> in edit mode and requiring the user to tap the delete circle (on the
>> left) first?
>> Or can I add such a button on the fly to all rows?
> 
> Sure, just use a custom table view cell and you can make each cell show
> anything you want. What I would do is always have the button be there, and
> just show or hide it when I provide the cell, according to some state
> variable. Call reload data to ask Cocoa to ask you to provide cells again.
> 

Hi,

Is there some precaution I've to take to make sure the buttons slide in nicely 
like they do in the mail app? I've currently no idea about coding animations 
and such.

Regards,

Remco Poelstra

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: "Settings" button in UITableView

2010-09-24 Thread Remco Poelstra
Hi,

Interesting point, I've been thinking about that as well. The problem is that I 
think it's confusing for the user. In the wifi settings pane, the user either 
selects the row or goes to a detail view. In my case the user goes to a 
tableview when he selects the row, but the disclosure button will give a 
(modal) detail view, so the responses are quite the same. Wouldn't that confuse 
them?

Regards,

Remco Poelstra

Op 24 sep. 2010 om 17:19 heeft Conrad Shultz  
het volgende geschreven:

> Hi Remco,
> 
> I haven't done what you're asking so I don't have the sort of ready answer 
> others on the list probably do, but I would ask why you don't use a detail 
> disclosure button (i.e. the right arrow inside a blue circle) in each table 
> cell for this purpose. UITableView very much supports this motif (tap the 
> cell contents for one set of details, tap the accessory for another) and 
> users will be familiar with the paradigm (e.g. in WiFi settings). 
> 
> It also saves users a tap, and minimizes the hiding of functionality.  
> 
> Conrad Shultz
> www.synthetiqsolutions.com
> 
> On Sep 24, 2010, at 1:33, Remco Poelstra  wrote:
> 
>> Hi,
>> 
>> I've a UITableView with UITableViewCell of style UITableViewStyleSubtitle.
>> The table shows devices that the app has found on the Wifi network. When I 
>> click on a row I show a detailview of the device. This all works fine.
>> The device has some internal configuration settings that the user needs to 
>> be able to change (like whether the device uses DHCP for its IP address). In 
>> order to let the user change these settings I've added a "settings" button 
>> to my UIToolbar. When the user taps the button I want to show a button for 
>> each row which allows the user to enter the configuration view. Much like 
>> the "Delete" button in the e-mail app.
>> I've found out that I can change the text of the default "Delete" button, 
>> but how can I show that button without putting the UITableView in edit mode 
>> and requiring the user to tap the delete circle (on the left) first?
>> Or can I add such a button on the fly to all rows?
> 
___

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

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

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

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


Re: Cocoa Text System - Temporarily Disabling Layout

2010-09-24 Thread Ross Carter

> Yeah I have line numbers views set up in all of this too, for which I have to 
> set the width before I set the strings of the text views so you don't see the 
> views resizing on first load if the line numbers aren't wide enough to 
> accommodate the number of lines in the new string. Resizing the line numbers 
> shrinks the available width for the text views and then everything lays out 
> again.

You might want to take a look at the WWDC 2010 session that Aki gave on Cocoa 
text. He showed how to do line numbering by subclassing NSGlyphGenerator.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: How to remove an item from recentDocumentURLs

2010-09-24 Thread Jerry Krinock

On 2010 Sep 22, at 11:11, bmaclist wrote:

> f a valid document gets into my 'Recent Documents' menu, and then gets 
> corrupted such that I am unable to open it, how can I programmatically remove 
> it from the Recent Documents list (without removing everything in the list)?

Create a category on NSDocumentController and add this…


/*!
 @briefRemoves a document with a given URL from the receiver's
 list of Recent Documents

 @details  Due to lack of sufficient API from Apple, this method
 actually removes *all* recent documents, then replaces all except
 the one specified.  Seems to work OK, though.
*/
- (void)forgetRecentDocumentUrl:(NSURL*)url ;


- (void)forgetRecentDocumentUrl:(NSURL*)url {
if (url) {
NSArray* recentDocumentURLs = [self recentDocumentURLs] ;
[self clearRecentDocuments:self] ;
// Because noteNewRecentDocumentURL: adds to the top
// of the list, I need a reverse enumeration to avoid
// reversing the order of the remaining recent documents
NSEnumerator* e = [recentDocumentURLs reverseObjectEnumerator] ;
for (NSURL* aUrl in e) {
if (![aUrl isEqual:url]) {
[self noteNewRecentDocumentURL:aUrl] ;
}
}
}
}


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Subclass NSTableView

2010-09-24 Thread Kevin Wojniak
It's supported, and people have been doing it for years. If you search the 
NSTableVIew doc page for "subclass" you'll see references to it.


On Sep 24, 2010, at 7:50 AM, k...@highrolls.net wrote:

> I don't see anything in the docs about subclassing NSTableView.  Are there 
> any known issues in doing so?
> 
> -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/kainjow%40kainjow.com
> 
> This email sent to kain...@kainjow.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: DO problem with NSConnection/NSSocketPortNameServer

2010-09-24 Thread Ken Tozier
Thanks Ken that worked

I wrapped up the solution in an NSConnection category in case others run into 
this problem

@interface NSConnection (NetworkServiceAdditions)

+ (id) networkServiceConnectionWithName:(NSString *) inName
rootObject:(id) inRootObject;

@end

@implementation NSConnection (NetworkServiceAdditions)

+ (id) networkServiceConnectionWithName:(NSString *) inName
rootObject:(id) inRootObject;
{
NSSocketPort*port   = [[NSSocketPort alloc] init];
NSConnection*connection = [NSConnection 
connectionWithReceivePort: port sendPort: nil];

[[NSSocketPortNameServer sharedInstance] registerPort: port name: 
inName];
[connection setRootObject: inRootObject];

return connection;
}

@end


On Sep 24, 2010, at 10:47 AM, Ken Thomases wrote:

> On Sep 24, 2010, at 1:35 AM, Ken Tozier wrote:
> 
>> However, when I try to use NSSocketPortNameServer instead of 
>> NSPortNameServer, I get server = nil
>> 
>> server = [[NSConnection serviceConnectionWithName: @"PMXServer"
>>  rootObject: self 
>>  usingNameServer: [NSSocketPortNameServer sharedInstance]] 
>>  retain];
>> 
>> The documentation here serviceConnectionWithName:rootObject:usingNameServer: 
>> seems to indicate that this should work. 
> 
> I may have been the one to direct you to this method, but I honestly don't 
> know if this approach is supposed to work.  Seems like it should, but...
> 
> In any case, it would just be a convenience method wrapping some other 
> approaches.  I recommend that you try creating a receive NSSocketPort 
> yourself and using +connectionWithReceivePort:sendPort: and 
> -registerName:withNameServer:.
> 
> In other words, my suspicion for why the other method isn't working is that 
> it doesn't know how to create NSSocketPorts to go along with the specified 
> name server.  It's trying to use generic NSPorts or something.
> 
> 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: "Settings" button in UITableView

2010-09-24 Thread Conrad Shultz
Hi Remco,

I haven't done what you're asking so I don't have the sort of ready answer 
others on the list probably do, but I would ask why you don't use a detail 
disclosure button (i.e. the right arrow inside a blue circle) in each table 
cell for this purpose. UITableView very much supports this motif (tap the cell 
contents for one set of details, tap the accessory for another) and users will 
be familiar with the paradigm (e.g. in WiFi settings). 

It also saves users a tap, and minimizes the hiding of functionality.  

Conrad Shultz
www.synthetiqsolutions.com

On Sep 24, 2010, at 1:33, Remco Poelstra  wrote:

> Hi,
> 
> I've a UITableView with UITableViewCell of style UITableViewStyleSubtitle.
> The table shows devices that the app has found on the Wifi network. When I 
> click on a row I show a detailview of the device. This all works fine.
> The device has some internal configuration settings that the user needs to be 
> able to change (like whether the device uses DHCP for its IP address). In 
> order to let the user change these settings I've added a "settings" button to 
> my UIToolbar. When the user taps the button I want to show a button for each 
> row which allows the user to enter the configuration view. Much like the 
> "Delete" button in the e-mail app.
> I've found out that I can change the text of the default "Delete" button, but 
> how can I show that button without putting the UITableView in edit mode and 
> requiring the user to tap the delete circle (on the left) first?
> Or can I add such a button on the fly to all rows?

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: "Settings" button in UITableView

2010-09-24 Thread Matt Neuburg
On Fri, 24 Sep 2010 10:33:28 +0200, Remco Poelstra 
said:
>Hi,
>
>I've a UITableView with UITableViewCell of style UITableViewStyleSubtitle.
>The table shows devices that the app has found on the Wifi network. When
>I click on a row I show a detailview of the device. This all works fine.
>The device has some internal configuration settings that the user needs
>to be able to change (like whether the device uses DHCP for its IP
>address). In order to let the user change these settings I've added a
>"settings" button to my UIToolbar. When the user taps the button I want
>to show a button for each row which allows the user to enter the
>configuration view. Much like the "Delete" button in the e-mail app.
>I've found out that I can change the text of the default "Delete"
>button, but how can I show that button without putting the UITableView
>in edit mode and requiring the user to tap the delete circle (on the
>left) first?
>Or can I add such a button on the fly to all rows?

Sure, just use a custom table view cell and you can make each cell show
anything you want. What I would do is always have the button be there, and
just show or hide it when I provide the cell, according to some state
variable. Call reload data to ask Cocoa to ask you to provide cells again.
m. 

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



___

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

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

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

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


Re: Question in regards to UITableView

2010-09-24 Thread Eric E. Dolecki
Thanks Matt.


  Google Voice: (508) 656-0622
  Twitter: eric_dolecki  XBoxLive: edolecki  PSN: eric_dolecki
  http://blog.ericd.net



On Fri, Sep 24, 2010 at 11:05 AM, Matt Neuburg  wrote:

> On Thu, 23 Sep 2010 13:27:08 -0400, "Eric E. Dolecki" 
> said:
> >I have a view that contains a UITableView. It does not take up the full
> view
> >(320x480). When an item is selected, the thing is supposed to slide to the
> >left and bring in a new table in it's place. Other items in the main view
> do
> >not change... so I can't use a UINavigationController (I don't believe).
>
> So far, it sounds exactly like a UINavigationController. But of course you
> don't have to use it if you don't want to; the value of
> UINavigationController is that it makes it easy to do this, and especially
> to find your way back.
>
> >Is
> >it okay to use two UITableViews to pull off all the data digging here?
> >(animate back and forth and reloading data for them)?
>
> Why not? Table views have nothing to do with their data. They are view, not
> model. m.
>
> --
> matt neuburg, phd = m...@tidbits.com, 
> A fool + a tool + an autorelease pool = cool!
> AppleScript: the Definitive Guide - Second Edition!
> http://www.apeth.net/matt/default.html#applescriptthings
>
>
>
>
___

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

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

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

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


Re: To make an application start everytime when another program starts

2010-09-24 Thread Matt Neuburg
On Fri, 24 Sep 2010 00:42:06 +0300, eveningnick eveningnick
 said:
>I have written an application, that interacts with another
>"stranger"-program by Applescript. The problem is that i need my
>application to look like a plugin for "stranger program"- to display a

I've written several applications that behave like this, but the user
voluntarily runs them (even if it's launched as a login item and is just
invisible because it's a background app). I don't think users would like
automatic (involuntary) launch.

To know when my target app is launched / frontmost I use Carbon Events. As
you say, NSWorkspace may now supply this functionality, but it didn't at the
time. m.

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



___

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

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

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

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


Visible Rect and objectValueForColumn

2010-09-24 Thread koko
Is it true that NSTableDataSource method  
tableView:objectValueForTableColumn:row is called as function of ther  
associated NSTableView's visible rect?


If so, can one make adjustments to the visible rect thereby tricking  
NSTableDataSource into calling tableView:objectValueForTableColumn:row ?


-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: Question in regards to UITableView

2010-09-24 Thread Matt Neuburg
On Thu, 23 Sep 2010 13:27:08 -0400, "Eric E. Dolecki" 
said:
>I have a view that contains a UITableView. It does not take up the full view
>(320x480). When an item is selected, the thing is supposed to slide to the
>left and bring in a new table in it's place. Other items in the main view do
>not change... so I can't use a UINavigationController (I don't believe).

So far, it sounds exactly like a UINavigationController. But of course you
don't have to use it if you don't want to; the value of
UINavigationController is that it makes it easy to do this, and especially
to find your way back.

>Is
>it okay to use two UITableViews to pull off all the data digging here?
>(animate back and forth and reloading data for them)?

Why not? Table views have nothing to do with their data. They are view, not
model. m.

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



___

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

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

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

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


Subclass NSTableView

2010-09-24 Thread koko
I don't see anything in the docs about subclassing NSTableView.  Are  
there any known issues in doing so?


-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: DO problem with NSConnection/NSSocketPortNameServer

2010-09-24 Thread Ken Thomases
On Sep 24, 2010, at 1:35 AM, Ken Tozier wrote:

> However, when I try to use NSSocketPortNameServer instead of 
> NSPortNameServer, I get server = nil
> 
> server = [[NSConnection serviceConnectionWithName: @"PMXServer"
>   rootObject: self 
>   usingNameServer: [NSSocketPortNameServer sharedInstance]] 
>   retain];
> 
> The documentation here serviceConnectionWithName:rootObject:usingNameServer: 
> seems to indicate that this should work. 

I may have been the one to direct you to this method, but I honestly don't know 
if this approach is supposed to work.  Seems like it should, but...

In any case, it would just be a convenience method wrapping some other 
approaches.  I recommend that you try creating a receive NSSocketPort yourself 
and using +connectionWithReceivePort:sendPort: and 
-registerName:withNameServer:.

In other words, my suspicion for why the other method isn't working is that it 
doesn't know how to create NSSocketPorts to go along with the specified name 
server.  It's trying to use generic NSPorts or something.

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-24 Thread Frederick Bartram

There is no magic in Objective-C.

There is nothing that you do using Objective-C that cannot be done in  
C. Technically, it is ALL syntactic sugar but, imo,  it is some of the  
best stuff on the planet. :)


Yes, I think that it is useful to partition the syntax and think of  
properties as a mechanism to expose state and methods as mechanisms to  
operate on that state.


Just my $0.02.

Frederick Bartram, long-time bitpusher.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSTimer memory management

2010-09-24 Thread Andreas Grosam

On Sep 23, 2010, at 3:50 AM, Jeff Johnson wrote:

> Your object retains the timer, and the timer retains your object. That is 
> obviously a kind of retain cycle.
I think, this kind of retain cycle is not a problem by itself when a repeating 
timer is used.

> What can happen is that your app gets into a situation where the only thing 
> that retains a reference to your object is its own theTimer ivar.
This can not happen that easily when a repeating timer is used, since there 
must exist one other object holding a reference to the timer and invoking the 
-invalidate message. The reference to the timer is most likely an ivar of this 
other object, or the timer is indirectly retained by the other object (say, as 
an element of NSArray).

> When the timer is invalidated, it releases your object (the target), and at 
> that point it has a 0 retainCount, so your object is immediately deallocated. 
> Then, boom!

I don't think that this can happen in a garbage collected system. 

A number of conditions must be true to make a boom happen, though:

- GC is not active (I believe so)
- the run loop is still alive retaining the target, and the timer is still valid
- there is no other object retaining the target!
- there exists a "third object" sending a message (say, -stopTimer) to the 
target which in turn invokes -invalidate.
- the "third object" does not retain the target! 
- the target executes additionally code within this method -stopTimer after 
sending -invalidate, and thereby accessing ivars.
- the run loop *immediately* releases the timer object itself when the timer is 
invalidated.

Only then, the target receives -dealloc while it is executing the method 
-stopTimer -- and then: boom!


@slasktrattenator:
In order to prevent this, it must be ensured, that the *target is retained 
elsewhere* when the timer will be invalidated. In this case, it is irrelevant 
whether the target itself retains the timer or not. However, if you do not 
retain the timer in the target, you must not send it further messages after you 
sent -invalidate to it. It's a good practice to set the unretained timer 
reference to nil immediately after invalidating it.

Ensure also that scheduling the timer and invalidating the timer will be 
invoked in the same thread.



Andreas

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSTextView

2010-09-24 Thread Ken Ferry
Can you sample the app while it's hung and produce backtraces?

I'm curious if perhaps you are violating Cocoa threading contracts.  Are you
aware that for the most part, the UI portions of Cocoa may not be used from
background threads?

Just adding text quickly should not be causing a hang.

-Ken

On Wed, Sep 22, 2010 at 2:56 PM, albert jordan  wrote:

>
> Thanks Kyle for the suggestion,
>
>
> I still get the app to hang.  if I bypass writing to the text view things
> work fine, so I'm certain it's this operation that hangs the application.
>  Based on everyone's feedback, below is what I've come up with so far.
>  "adbLog" is the culprit TextView.The app works initially, and I always
> get the shouldChangeTextInRange method to return YES.
>
> I'm going to try buffering the lines, and update the view in a batch
> mode...  running out of ideas...
>
>
> Thanks again for all that have helped so far.
>
> Regards,
>
> Albert
>
>
>
>
>
>BOOL flag = [adbLog shouldChangeTextInRange:NSMakeRange(NSNotFound,
> 0) replacementString:nil];
>
>if ( flag == YES ) {
>
>NSLog(@"DeviceWindowController: permission to write to
> buffer\n");
>
>NSMutableAttributedString *attstr =
> [[[NSMutableAttributedString alloc] initWithString:line] autorelease];
>[[adbLog textStorage] beginEditing];
>[[adbLog textStorage] appendAttributedString:attstr];
>[[adbLog textStorage] endEditing];
>[adbLog didChangeText];
>//[adbLog display] ;
>} else {
>NSLog(@"Couldn't get permission to change the text\n");
> }
>
> On Sep 22, 2010, at 11:04 AM, Kyle Sluder wrote:
>
> > On Wed, Sep 22, 2010 at 10:43 AM, albert jordan 
> wrote:
> >> Hi Martin,
> >>
> >> THanks so much for the suggestion.
> >>
> >> The approach improves the situation, but unfortunately does not resolve
> it.  But understand now that this is the issue, I'm going to see if there
> will be another work around.
> >
> > If you want to edit a text view's text storage, you must call
> > -shouldChangeTextInRange:replacementString: on the text view before
> > mutating the text storage, and then call -didChangeText afterwards.
> >
> > --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/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


Re: Cocoa Text System - Temporarily Disabling Layout

2010-09-24 Thread Jonathan Dann

On 23 Sep 2010, at 23:46, Martin Wierschin wrote:

>>> The problem I've had to continuously hack around is that NSTextView, in 
>>> conjunction with NSLayoutManager, is rather eager to get the text to 
>>> re-layout.
>> 
>> Maybe, to disable layout, set the textview's textContainer to nil, then 
>> restore it to enable layout?
> 
> That's one idea, though I wouldn't be surprised if other things go weird as a 
> result.
> 
> Personally I'd try to work with the text system in a way it expects. For 
> example:
> 
>>> when I resize the window and need to adjust the frames of both scroll 
>>> views, calling -[NSTextView setFrame:] results in the layout manager 
>>> invalidating and ensuring layout for the newly visible character range.
> 
> Why not just turn off text view width/height tracking for the container 
> during the resize? That should let the layout manager use the existing layout 
> information (ie: for the stale container size).

Because that's just moving the problem further down the line. When I finally 
update the text container size for the first text view it will begin to layout 
before I've reached the next line of my code where I can fix the size of the 
second view.

The hacky fix for such things is to force the text views (or containers) to be 
the same size in the first call -[NSLayoutManager layoutParagraphAtPoint] or 
something thereabouts, but the underlying problem (the automatic layout) keeps 
rearing it's ugly head in other situations.

> 
> The other "state change" you explicitly touch upon is editing the text. If 
> you bracket all your changes to the text storage with begin/end editing 
> calls, you shouldn't trigger layout until all your changes are finished 
> (unless you're also inadvertently triggering layout in other ways).

I'll see how that fits in with setting the 2 strings that are dependent on each 
other. It may be a nice workaround.

> 
> Are there any other scenarios where you trigger layout before you're ready?

Yeah I have line numbers views set up in all of this too, for which I have to 
set the width before I set the strings of the text views so you don't see the 
views resizing on first load if the line numbers aren't wide enough to 
accommodate the number of lines in the new string. Resizing the line numbers 
shrinks the available width for the text views and then everything lays out 
again.

It's, all in all, a very complex setup :)

Thanks,

Jonathan

___

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

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

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

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


Re: Cocoa Text System - Temporarily Disabling Layout

2010-09-24 Thread Jonathan Dann

On 23 Sep 2010, at 23:12, Ross Carter wrote:

> Maybe, to disable layout, set the textview's textContainer to nil, then 
> restore it to enable layout?

Hi Ross,

I'll give it a go. I think tricks like that may help in some of the cases I 
have.

Thanks,

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


"Settings" button in UITableView

2010-09-24 Thread Remco Poelstra

Hi,

I've a UITableView with UITableViewCell of style UITableViewStyleSubtitle.
The table shows devices that the app has found on the Wifi network. When 
I click on a row I show a detailview of the device. This all works fine.
The device has some internal configuration settings that the user needs 
to be able to change (like whether the device uses DHCP for its IP 
address). In order to let the user change these settings I've added a 
"settings" button to my UIToolbar. When the user taps the button I want 
to show a button for each row which allows the user to enter the 
configuration view. Much like the "Delete" button in the e-mail app.
I've found out that I can change the text of the default "Delete" 
button, but how can I show that button without putting the UITableView 
in edit mode and requiring the user to tap the delete circle (on the 
left) first?

Or can I add such a button on the fly to all rows?

Thanks in advance.

Kind regards,

Remco Poelstra
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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-24 Thread Michael Watson
On 21 Sep, 2010, at 18:48, Matt Neuburg wrote:

> On Mon, 20 Sep 2010 03:56:20 -0700, Chris Hanson  said:
>> 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.
> 
> No, I think that's bollocks. Dot syntax is *exactly* syntactic sugar for
> calling the accessor, and using it correctly depends upon keeping that fact
> firmly in mind. m.

I believe what Chris is saying is that you want to /think of/ properties as 
being state exposition. He isn't saying they're not technically sugar. If you 
think of them purely as sugar, you're missing the semantic value of using them 
in the first place.


--
michael

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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