Re: Enforcing trial software on Mac

2009-03-17 Thread Jean-Daniel Dupas


Le 17 mars 09 à 03:46, Jeff Laing a écrit :


I have seen a couple of fairly nice solutions, and lots of really
awful ones.  Generally speaking, the awful ones try to go to great
lengths to be sneaky and hide files or other data in places in your
computer they shouldn't be messing with.


Its worth pointing out that most hacker-types know about 'fs_usage' -
there's little hiding that your app can do without being seen by  
those

who want to know.

http://developer.apple.com/DOCUMENTATION/Darwin/Reference/ManPages/man1/
fs_usage.1.html


Very good point, and for those who don't know about fs_usage,  
Instrument (known by all developers) provide a similar facility.


I really don't like softwares that write random files where it should  
not.



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Garbage Collection, Core Foundation, and the -finalize problem

2009-03-17 Thread Bill Cheeseman


On Mar 16, 2009, at 2:32 PM, Michael Tsai wrote:


On Mar 16, 2009, at 2:08 PM, Bill Cheeseman wrote:

I am looking for a strategy to avoid implementing a -finalize  
method in a garbage-collected Objective-C class that declares a  
CFTypeRef-style Core Foundation instance variable. I believe this  
is a fairly common problem, because any Cocoa wrapper class for a  
Core Foundation API would have to do it, but I haven't seen a  
usable solution. Apple's GC documentation stops just short of  
suggesting an answer.



I believe you're supposed to declare your CFTypeRef ivar as __strong  
and call CFMakeCollectable so that the garbage collector will be  
responsible for releasing it. You can still use CFRelease in - 
dealloc for when you aren't running under garbage collection.


After thinking on this overnight, I have concluded that in a mixed- 
mode framework the best practice is indeed to call CFMakeCollectable  
as soon as the CFTypeRef ivar is created so that garbage-collected  
clients can ignore memory management issues.


As a corollary, when the problem domain served by the framework is  
such that there is no convenient way to know when to call an - 
invalidate method, simply put all the cleanup code in -finalize and be  
done with it.


But perhaps even in this situation, it would be good practice to  
provide -invalidate and -isValid methods, and write -finalize so that  
it checks -isValid before calling -invalidate itself. This way,  
clients who do know when to call -invalidate can do so.


This leaves unresolved the need in some cases to do cleanup work  
before -finalize because of order-of-execution issues with -finalize.  
My tentative conclusion is that this is a huge can of worms for  
garbage collection when CFTypeRef ivars are involved.


--

Bill Cheeseman
b...@cheeseman.name

___

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

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

2009-03-17 Thread haresh vavdiya
Hi,

Actually i want to develop small application which is for register
and login.

I have set one box on MainMenu.xib and it should contain login view
and if i will press register then it should change the view to register view
in same box itself.

   I have one login view and one button which will derive to register
view. What should i do for that? any sample code or app?

Thanks,
Haresh.
___

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

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

2009-03-17 Thread Ron Fleckner


On 17/03/2009, at 8:16 PM, haresh vavdiya wrote:


Hi,

   Actually i want to develop small application which is for  
register

and login.

   I have set one box on MainMenu.xib and it should contain  
login view
and if i will press register then it should change the view to  
register view

in same box itself.

  I have one login view and one button which will derive to  
register

view. What should i do for that? any sample code or app?

Thanks,
Haresh.


A tabless NSTabView might help you here.  I'd first have a look at  
using NSTabView, then google tabless NSTabView to find some sample  
code.


The effect is to essentially swap the views on your 'box' window.

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


Re: Double Initialize - is that how it should be?

2009-03-17 Thread Jim Correia

On Mar 16, 2009, at 10:21 PM, Steve Cronin wrote:

I use an object in my application called 'appDelegate'; it's a  
subclass of NSObject.


I instantiate this object in the main Nib file
This object has  IBActions for the main menu and since it is -app  
delegate it is a kind on central dispatcher.


My question is this:
The +initialize is run twice when the app loads:
2009-03-16 20:21:42.690 XYZ[6676:813] *[AppDelegate initialize]
2009-03-16 20:21:42.781 XYZ[6676:813] *[NSKVONotifying_AppDelegate  
initialize]


Once for the object itself and then again as the instance in the  
Nib.  That's how I read this.  Is that wrong?


The specific reason that you got +initialize twice has to do with an  
implementation detail of automatic KVO.


There are also other reasons that you could get +initialize twice.  
(For example, a subclass of yours doesn't implement initialize.)


This is discussed in the NSObject documentation, and the pattern to  
use to avoid double initialization is given.


http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/nsobject_Class/Reference/Reference.html#/ 
/apple_ref/occ/clm/NSObject/initialize


Jim

___

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

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


NSTableView Drag and Drop doesn't work

2009-03-17 Thread Jushin
In MyDocument.xib, I have a table and an array list (dataList) for data source.
Then I created a subclass of NSArrayController (dataListController)
and linked the array list (dataList) to this class.
And in the dataListcontroller, I made an outlet of the table and made
a connection.
Ok, that's my setup.

Now, I want to implement drag and drop for the table.
So, I added followings to the dataListController class.

- (void)awakeFromNib {

[tableView setDraggingSourceOperationMask:NSDragOperationLink 
forLocal:NO];
[tableView setDraggingSourceOperationMask:(NSDragOperationCopy |
NSDragOperationMove) forLocal:YES];

[tableView registerForDraggedTypes:types];
[tableView setAllowsMultipleSelection:YES];

[super awakeFromNib];
}

- (BOOL)tableView:(NSTableView *)aTableView
writeRowsWithIndexes:(NSIndexSet *)rowIndexes
toPasteboard:(NSPasteboard *)pboard {
NSLog(@drag1);
return YES;
}

- (NSDragOperation)tableView:(NSTableView*)tv validateDrop:(id
NSDraggingInfo)info proposedRow:(int)row
proposedDropOperation:(NSTableViewDropOperation)op {

NSDragOperation dragOp = NSDragOperationCopy;

NSLog(@drag2);

return dragOp;
}

- (BOOL)tableView:(NSTableView*)tv acceptDrop:(id
NSDraggingInfo)info row:(int)row
dropOperation:(NSTableViewDropOperation)op {
NSLog(@drag3);
return NO;
}

For now, as you can see, I just put NSLog whether the table receives
drag and drop action.
However, none of the NSLog message was printed out.
It looks like the drag and drop doesn't work at all.
What else should I do to make it work?
___

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

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

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

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


Re: Working with weekdays on NSDate, NSDateComponents, NSCalendar and NSValueTransformer

2009-03-17 Thread Joar Wingfors


On 17 mar 2009, at 06.32, Michele Barboni wrote:


if(value = nil) return nil;


missed a =.. sorry..



...and that's why it's great to re-train yourself to type it the other  
way around:


if (nil == value)

A stricter set of compiler warnings helps too, of course:

-Wall -Wextra -Winit-self -Wundeclared-selector

(At least when compiling your Release configuration)

Cheers,

j o a r


___

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

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

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

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


Re: NSTableView Drag and Drop doesn't work

2009-03-17 Thread Jushin
I did further investigation and found the reason.
It was because the problem of regsterForDraggedTypes
I just wanted to filter out images, so I used following to define types:

NSArray* types = (NSArray*)CGImageSourceCopyTypeIdentifiers();

and then set it as,

[tableView registerForDraggedTypes:types];

It didn't work. I only could make it work after I changed this to:

[tableView registerForDraggedTypes:[NSArray
arrayWithObjects:NSFilenamesPboardType,nil]];

So, how can I filter image files for drag and drop?
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Working with weekdays on NSDate, NSDateComponents, NSCalendar and NSValueTransformer

2009-03-17 Thread Roland King
I assumed that -Wall meant .. all. What does Wextra, Winit-self,  
Wundeclared-selector add? And why aren't they part of all?



On Mar 17, 2009, at 11:16 PM, Joar Wingfors wrote:



On 17 mar 2009, at 06.32, Michele Barboni wrote:


if(value = nil) return nil;


missed a =.. sorry..



...and that's why it's great to re-train yourself to type it the  
other way around:


if (nil == value)

A stricter set of compiler warnings helps too, of course:

-Wall -Wextra -Winit-self -Wundeclared-selector

(At least when compiling your Release configuration)

Cheers,

j o a r


___

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

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

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

This email sent to r...@rols.org


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Working with weekdays on NSDate, NSDateComponents, NSCalendar and NSValueTransformer

2009-03-17 Thread Joar Wingfors


On 17 mar 2009, at 08.44, Roland King wrote:

I assumed that -Wall meant .. all. What does Wextra, Winit-self,  
Wundeclared-selector add? And why aren't they part of all?



-Wall can't very well include everything, since a lot of the available  
warnings are very special in purpose and not generally useful. The  
name is a bit misleading, I would agree.


See man gcc for the details.

j o a r


___

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

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

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

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


Re: NSTableView Drag and Drop doesn't work

2009-03-17 Thread Nick Zitzmann


On Mar 17, 2009, at 9:41 AM, Jushin wrote:


It didn't work. I only could make it work after I changed this to:

[tableView registerForDraggedTypes:[NSArray
arrayWithObjects:NSFilenamesPboardType,nil]];

So, how can I filter image files for drag and drop?



You have to do that manually in your validate method, since filename  
pasteboards don't contain file data for obvious reasons.


Nick Zitzmann
http://www.chronosnet.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: NSTableView Drag and Drop doesn't work

2009-03-17 Thread Corbin Dunn


On Mar 17, 2009, at 8:41 AM, Jushin wrote:


I did further investigation and found the reason.
It was because the problem of regsterForDraggedTypes
I just wanted to filter out images, so I used following to define  
types:


NSArray* types = (NSArray*)CGImageSourceCopyTypeIdentifiers();

and then set it as,

[tableView registerForDraggedTypes:types];

It didn't work. I only could make it work after I changed this to:

[tableView registerForDraggedTypes:[NSArray
arrayWithObjects:NSFilenamesPboardType,nil]];

So, how can I filter image files for drag and drop?


You will have to do some sort of validation in -validateDrop -- ie,  
grab the filename(s), and make sure they have an extension or UTI that  
matches what you want.


corbin



___

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

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

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

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


[Moderator] REMINDER - PRE-RELEASE AND BETA SOFTWARE NOT TO BE DISCUSSED HERE

2009-03-17 Thread Scott Anguish
for example unreleased iPHone OS and Mac OS X operating systems such  
as Snow Leopard.


Doing so will result in moderation.

see Apple's http://devforums.apple.com for more options.
___

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

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

2009-03-17 Thread David Casseres

Тимофей,

I am wondering what you consider irrelevant, if it is not simply a low  
relevance score returned by SearchKit.  If you have additional  
criteria such that you need to make your own comparisons between the  
query and the strings returned from SearchKit, then SearchKit may be a  
waste of time for you.

David


On Mar 16, 2009, at 8:31 AM, Тимофей Даньшин wrote:


Hi all.

In my application I have to search for strings closest matching a  
given string. So, for example, if the given string is Hello.  
Would you like some oranges, I need to find  Hello. Would you like  
some lemons or Hello. Would you want some oranges (if they are in  
the database), and not just any phrase that contains the word  
oranges or would or hello, etc.


For this purpose I tried to use the SearchKit, and tried to filter  
out the strings that were below a certain relevancy threshold and  
compare the remaining ones to the given string using some other  
methods. However, it turns out, that the bigger the database with  
the strings gets, the more irrelevant strings i receive, and the  
whole search process becomes quite slow.


And my question is, am I right in thinking that the SearchKit may  
not be the solution that I want and I will have to write my own  
indexing engine, or is it just that I am not using it right?


Here is how I create the index (the code was almost entirely taken  
from a code example):


- (void) newIndexInFile  {
NSURL * url = [NSURL fileURLWithPath: path];
NSString * name = @SomeName;
if ([name length] == 0) name = nil;
SKIndexType type = kSKIndexInvertedVector;
NSNumber * minTermLength = [NSNumber numberWithInt: (int) 3];
NSSet * stopwords = [NSSet setWithObjects:
 @all,
 @and,
 @its,
 @it's,
 @the,
 nil
 ];
NSDictionary * properties =
[NSDictionary dictionaryWithObjectsAndKeys:
 @, @kSKStartTermChars,
 @-...@.', @kSKTermChars,
 @, @kSKEndTermChars,
 minTermLength, @kSKMinTermLength,
 stopwords, @kSKStopWords,
 nil
 ];
skIndex = SKIndexCreateWithURL(
   (CFURLRef) 
url,
   
(CFStringRef) name,
   
(SKIndexType) type,
   
(CFDictionaryRef) properties
   );
if (!skIndex) {
NSLog(@SKIndex doesnt exist right after the creation);
}
}
Thank you for your attention.
Timofey.
___

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

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

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

This email sent to casse...@mac.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: Automatically replacing part of text in a text label

2009-03-17 Thread Michael Ash
On Mon, Mar 16, 2009 at 2:20 AM, Peter Zegelin
pe...@fracturedsoftware.com wrote:
 I have some text labels in a registration dialog that contain the
 application name eg

 xxx Demonstration
 Thank you for purchasing xxx

 and so on.

 I would like this registration dialog to be general enough that I can use it
 in multiple applications. Is there a simple way to replace the xxx with the
 actual application name at runtime? At the moment I'm thinking I'll have to
 wire every label up to my registration controller and do it in awakeFromNib,
 but I was hoping for something easier.

One approach you can take is to simply enumerate all views in your
window, by walking each view's -subviews method and looking for
views/controls which have the attributes you're looking for.

Mike
___

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

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

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

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


Bindings: which object+property is being edited?

2009-03-17 Thread Jim Correia
Given an NSObjectController subclass, or an NSManagedObjectContext  
(with chained controllers), is it possible to determine the set of  
objects + properties currently being edited?


The NSEditorRegistration protocol is untyped:

- (void)objectDidBeginEditing:(id)editor;
- (void)objectDidEndEditing:(id)editor;


and the editor is often an instance of a private class.

- Jim
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Automatically replacing part of text in a text label

2009-03-17 Thread Ricky Sharp


On Mar 17, 2009, at 3:33 PM, Peter Ammon wrote:



On Mar 15, 2009, at 11:20 PM, Peter Zegelin wrote:

I have some text labels in a registration dialog that contain the  
application name eg


xxx Demonstration
Thank you for purchasing xxx

and so on.

I would like this registration dialog to be general enough that I  
can use it in multiple applications. Is there a simple way to  
replace the xxx with the actual application name at runtime? At the  
moment I'm thinking I'll have to wire every label up to my  
registration controller and do it in awakeFromNib, but I was hoping  
for something easier.


Thanks!

Peter


You could create a subclass of NSTextField that does its own  
replacement.  That would save you from having to create outlets.



What I've been doing (in Mac OS X as well as iPhone OS) is to store a  
string template in my localized strings file.  Then, use NSBundle APIs  
to fill in the app name at runtime.


For example:

[NSString stringWithFormat:NSLocalizedString (@Welcome to %@, @some  
comment),
[[NSBundle mainBundle]  
objectForInfoDictionaryKey:@CFBundleName]];


___
Ricky A. Sharp mailto:rsh...@instantinteractive.com
Instant Interactive(tm)   http://www.instantinteractive.com



___

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

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

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

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


Re: Automatically replacing part of text in a text label

2009-03-17 Thread Rich Collyer

You might try just getting the name as an NSString with:

NSString applicationName = [[[NSBundle mainBundle] infoDictionary]  
objectForKey: CFBundleExecutable];


Than populate the dialog with that string (using the technique shown  
by Mark.


+++
Rich Collyer - Senior Software Engineer
rcoll...@ironkey.com

IronKey - The World's Most Secure Flash Drive
2008 SC Magazine Readers Choice Award Winner
2008 FOSE Best of Show Winner
2007 GCN Labs Reviewers Choice Winner
+++




On Mar 17, 2009, at 1:33 PM, Peter Ammon wrote:



On Mar 15, 2009, at 11:20 PM, Peter Zegelin wrote:

I have some text labels in a registration dialog that contain the  
application name eg


xxx Demonstration
Thank you for purchasing xxx

and so on.

I would like this registration dialog to be general enough that I  
can use it in multiple applications. Is there a simple way to  
replace the xxx with the actual application name at runtime? At the  
moment I'm thinking I'll have to wire every label up to my  
registration controller and do it in awakeFromNib, but I was hoping  
for something easier.


Thanks!

Peter


You could create a subclass of NSTextField that does its own  
replacement.  That would save you from having to create outlets.


-Peter

___

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

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

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


This email sent to rcoll...@ironkey.com




smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

Re: Double Initialize - is that how it should be?

2009-03-17 Thread Dave Keck
This is expected behavior; from the docs:

The runtime sends initialize to each class in a program exactly one
time just before the class, or any class that inherits from it, is
sent its first message from within the program. (Thus the method may
never be invoked if the class is not used.) The runtime sends the
initialize message to classes in a thread-safe manner. Superclasses
receive this message before their subclasses.

...

If a particular class does not implement initialize, the initialize
method of its superclass is invoked twice, once for the superclass and
once for the non-implementing subclass. If you want to make sure that
your class performs class-specific initializations only once,
implement initialize as in the following example:

@implementation MyClass
+ (void)initialize
{
if ( self == [MyClass class] ) {
/* put initialization code here */
}
}
___

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

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

2009-03-17 Thread Li Fumin
Hi,all.I am new to cocoa. I am reading Aaron Hillegass's Book Cocoa  
Programming for Mac OS X.


I have got some problems with challenge 2 of Chapter 20.I have a  
custom NSView called BigLetterView, and then it show the input letter  
on the view.Now I want to make the letter which I just inputted  
appears in italics. So, I define this method:


- (IBAction) isItalic: (id) sender
{
if ([italicBox state])
{
NSFontManager *fontManager = [NSFontManager 
sharedFontManager];
[fontManager convertFont: [NSFont fontWithName: @Helvetica 
size: 75]
  toHaveTrait:  
NSItalicFontMask];

}else {
NSFontManager *fontManager = [NSFontManager 
sharedFontManager];
[fontManager convertFont: [NSFont fontWithName: @Helvetica 
size: 75]
  toHaveTrait:  
NSUnitalicFontMask];

}

[self setNeedsDisplay: YES];
}

When I click the italics check button. Nothing happens. How do I  
suppose to make this wok?

How can I get the font the letter is using?

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


Drawing background windows during window move.

2009-03-17 Thread Garrett Moon
I have two windows in an application, a GuideWindow and a  
RegularWindow. The GuideWindow covers all screens and displays guide  
lines that match up with the edges of the contentView in  
RegularWindow. When RegularWindow is moved or resized, GuideWindow  
updates its display to move the guide lines with it. This is achieved  
through windowDidResize notifications and windowDidMove notifications.  
when doing a resize, everything works perfectly with the guide lines  
updating as the RegularWindow is resized.


However, windowDidMove is only called when the user pauses while  
moving RegularWindow. So I subclassed RegularWindow and made  
windowDragged send an NSWindowDidMoveNotification (sloppy, I know).  
This calls the update method of GuideWindow properly, but it still  
doesn't draw until the user pauses.


I've got some NSLogs in the guide update function, so I know it's  
being called, but no drawing. I've tried sending the display method to  
all of the GuideWindow views and to the GuideWindow itself with no  
avail. I've also tried updating and flushing the window.


Am I missing something? Are only certain drawing events called in the  
event loop when a window is being dragged? Could this have to do with  
window backing? Thanks in advance,


-Garrett
___

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

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

2009-03-17 Thread Jim Correia

On Mar 17, 2009, at 10:14 AM, Li Fumin wrote:

Hi,all.I am new to cocoa. I am reading Aaron Hillegass's Book Cocoa  
Programming for Mac OS X.


I have got some problems with challenge 2 of Chapter 20.I have a  
custom NSView called BigLetterView, and then it show the input  
letter on the view.Now I want to make the letter which I just  
inputted appears in italics. So, I define this method:


- (IBAction) isItalic: (id) sender
{
if ([italicBox state])
{
NSFontManager *fontManager = [NSFontManager 
sharedFontManager];
		[fontManager convertFont: [NSFont fontWithName: @Helvetica size:  
75]
 toHaveTrait:  
NSItalicFontMask];

}else {
NSFontManager *fontManager = [NSFontManager 
sharedFontManager];
		[fontManager convertFont: [NSFont fontWithName: @Helvetica size:  
75]
 toHaveTrait:  
NSUnitalicFontMask];

}

[self setNeedsDisplay: YES];
}

When I click the italics check button. Nothing happens. How do I  
suppose to make this wok?

How can I get the font the letter is using?


Look at the API doc and method prototype for -convertFont:toHaveTrait:.

It returns a new font. You discard the return value, and don't update  
any of your own state, so I'm not sure how you envisioned this to work.


In the case where you want to remove the italic attribute, you should  
be using -convertFont:toNotHaveTrait:.


- Jim
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Garbage Collection, Core Foundation, and the -finalize problem

2009-03-17 Thread Sean McBride
On 3/17/09 5:35 AM, Bill Cheeseman said:

 I am looking for a strategy to avoid implementing a -finalize
 method in a garbage-collected Objective-C class that declares a
 CFTypeRef-style Core Foundation instance variable. I believe this
 is a fairly common problem, because any Cocoa wrapper class for a
 Core Foundation API would have to do it, but I haven't seen a
 usable solution. Apple's GC documentation stops just short of
 suggesting an answer.


 I believe you're supposed to declare your CFTypeRef ivar as __strong
 and call CFMakeCollectable so that the garbage collector will be
 responsible for releasing it. You can still use CFRelease in -
 dealloc for when you aren't running under garbage collection.

After thinking on this overnight, I have concluded that in a mixed-
mode framework the best practice is indeed to call CFMakeCollectable
as soon as the CFTypeRef ivar is created so that garbage-collected
clients can ignore memory management issues.

I agree.  Using NSMakeCollectable() combined with autorelease makes your
code safe in both RR and GC.  For example:

CFURLRef theURL = CFURLCreateFromFSRef(
kCFAllocatorDefault, fsRef );
[NSMakeCollectable(theURL) autorelease];

BTW, NSMakeCollectable() is nicer since it avoids a cast.

As a corollary, when the problem domain served by the framework is
such that there is no convenient way to know when to call an -
invalidate method, simply put all the cleanup code in -finalize and be
done with it.

Pretty much.

Another reason to avoid finalize is that it is not run on the main
thread!  Thus your finalizers must be thread-safe.  You can safely call
free(), CFRelease(), DisposeHandle(), and DisposePtr() for example.


On 3/16/09 2:08 PM, Bill Cheeseman said:

Leopard, NSEvent includes methods to return the associated CGEventRef,
which is a CFTypeRef-style ivar (but declared as void* for reasons
that have so far escaped me).

In my 10.5 SDK it is declared as:

- (CGEventRef)CGEvent;

You probably mean this one:

- (const void * /* EventRef */)eventRef;

I suspect it's because they don't want to pull in headers from another
framework.  Especially the pariah Carbon.h. :)

--

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


Re: Bindings: which object+property is being edited?

2009-03-17 Thread Keary Suska


On Mar 17, 2009, at 2:18 PM, Jim Correia wrote:

Given an NSObjectController subclass, or an NSManagedObjectContext  
(with chained controllers), is it possible to determine the set of  
objects + properties currently being edited?


The NSEditorRegistration protocol is untyped:

- (void)objectDidBeginEditing:(id)editor;
- (void)objectDidEndEditing:(id)editor;


and the editor is often an instance of a private class.



IIRC you can determine which view is being edited (i.e. what view an  
editor is associated with), but I don't believe Cocoa has any concept  
of properties being edited. If you can get the view, you can inspect  
its bindings, but that seems a rather roundabout way to do something  
that might have a smarter approach.


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


UIView hidden - still drawing the subviews? [SOLVED]

2009-03-17 Thread Jelle De Laender
It seems that the new Interface Builder react very strange on my  
commands...


I've retry it and it works now, just like I expected and just like it  
should be.


So this 'problem' is solved.


Begin forwarded message:


From: Jelle De Laender maill...@codingmammoth.com
Date: Tue 17 Mar 2009 22:32:09 GMT+01:00
To: Cocoa Developers cocoa-dev@lists.apple.com
Subject: UIView hidden - still drawing the subviews?

Hi

I've a UIView with some subviews (most of them are UIButtons).

When I hide an UIView  (setHidden:YES), I expect that the subviews  
are also hidden (not drawed)... but the subviews are still visible  
when I run my code.


How can I hide the subviews when I hide a UIView? Should I create a  
subclass and overwrite the setHidden: method (and recall setHidden  
on every subview) or is there a better way to do this?


Kind regards
Jelle


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: [NSTableView] How should a grid be drawn?

2009-03-17 Thread Iceberg-Dev


On Mar 17, 2009, at 12:45 AM, Corbin Dunn wrote:



On Mar 16, 2009, at 4:06 PM, Iceberg-Dev wrote:


I'm trying to draw a custom grid for a table view.

I' using the code at the end of this post.

The problem is that when I scroll the tableview, some of the  
horizontal lines are not drawn.


I looked at different sample code on the net including the GNUStep  
source code and found none that was working correctly.


I displayed the clipRect to check out which parts were being  
refreshed. Still some of the lines are not drawn.


I also tried doing the drawing in highlightSelectionInClipRect:  
without better results.


What's wrong with the code?


Draw your grid based on the [self bounds], not [self visibleRect].  
Don't use the clipRect either, just use [self visibleRect] (I think  
you are using the clip rect like the visible bounds, which isn't  
wrong -- it isn't the part you see, but it is the dirty part).


Works fine after applying your suggestions.

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: UIView hidden - still drawing the subviews?

2009-03-17 Thread Ricky Sharp


On Mar 17, 2009, at 4:32 PM, Jelle De Laender wrote:


I've a UIView with some subviews (most of them are UIButtons).

When I hide an UIView  (setHidden:YES), I expect that the subviews  
are also hidden (not drawed)... but the subviews are still visible  
when I run my code.


How can I hide the subviews when I hide a UIView? Should I create a  
subclass and overwrite the setHidden: method (and recall setHidden  
on every subview) or is there a better way to do this?



Are you positive that your buttons are really subviews of your main  
view?  Sounds like they are simply siblings of your view instead.


A hidden view (UIView/NSView) will always hide all its subviews; no  
extra coding needed.


___
Ricky A. Sharp mailto:rsh...@instantinteractive.com
Instant Interactive(tm)   http://www.instantinteractive.com



___

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

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

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

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


Incomprehensible KVC Failure!

2009-03-17 Thread Seth Willits


I have a property in one of my classes:

NSString * suggestedDiskImageName;
@property (retain, readwrite) NSString * suggestedDiskImageName;
@synthesize suggestedDiskImageName;

Which is just like a dozen others that I declare, except for some  
reason that is beyond comprehension after my HOUR LONG investigation,  
when I do:


1) nonNilInstance.suggestedDiskImageName = someValue;
2) [nonNilInstance setSuggestedDiskImageName:someValue];
3) [nonNilInstance setValue:someValue forKey:@suggestedDiskImageName];


All of them fail to trigger will/didChangeValueForKey (which I'm  
overriding to see changes to all properties in my class). It actually  
changes the value, but it doesn't send the KVC methods. Every other  
single property works, but this one does not. I've tried multiple  
values, I've tried renaming the property, I've tried using a different  
instance variable, I've tried reordering the instance variables,  
property declarations, and synthesize declarations just incase it was  
some stupid thing like that, I've even tried calling the code from  
different locations in my project.. it always fails!


It's completely boggling my mind.


The only thing that worked was to create an implementation of  
setSuggestedDiskImageName: and manually call will/didChangeValueForKey.





What on Earth can I do?


--
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: [iPhone] NumberPad with the dot

2009-03-17 Thread Jelle De Laender

Hi

I've create a UIView with some UIButtons for a custom keypad.
Now I've a problem to 'hide' the numberpad of Apple.

When a user 'clicks/touches' the editfield, my UIView should be showed  
(setHidden:NO) and the textField should go in editing-modus, but  
without the numberPad of Apple.


How can you disable the numberPad of Apple and still having an  
editable textfield?


Kind regards

On 17 Mar 2009, at 01:11, Layton Duncan wrote:


We ran into this same problem when creating 'Convert'

I didn't want to hack around with the existing keyboard, so we ended  
up implementing our own: http://www.polarbearfarm.com/convert/index.html


Layton Duncan
Polar Bear Farm
http://www.polarbearfarm.com

On 17/03/2009, at 11:57 AM, Jelle De Laender wrote:


Hi,

I was a little bit surprised because the default number pad doesn't  
contains a dot.
I've created an application and the user need to enter decimal  
numbers.


The default number pad is: http://h4xr.org/ifm4 (see  
UITextInputTraits Protocol Reference)


There is an empty space at the left-bottom but I can't find  
anywhere how I can get a number pad that contains a dot. I can't  
believe that Apple hasn't a number pad that support decimal  
numbers. This is something basic, isn't?


What is the best way to get a dot on the number pad?

Jelle,


___

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

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

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

This email sent to lay...@qcosystems.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/maillist%40codingmammoth.com

This email sent to maill...@codingmammoth.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: [iPhone] NumberPad with the dot

2009-03-17 Thread Dave DeLong
You fake it.  Have a non-editable textfield with a custom UILabel  
subclass on top of it.  When the UILabel gets tapped, bring up your  
custom keyboard and put the typed text into the UILabel.


Dave

On Mar 17, 2009, at 4:19 PM, Jelle De Laender wrote:


Hi

I've create a UIView with some UIButtons for a custom keypad.
Now I've a problem to 'hide' the numberpad of Apple.

When a user 'clicks/touches' the editfield, my UIView should be  
showed (setHidden:NO) and the textField should go in editing-modus,  
but without the numberPad of Apple.


How can you disable the numberPad of Apple and still having an  
editable textfield?


Kind regards

___

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

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


Model Table Cell Updating Issues

2009-03-17 Thread Walker Argendeli
I'm fairly new to Core Data, so I'm sure there's a simple answer to my  
question, but here goes.  I have an NSStepper, NSLevelIndicator, and  
an NSTableView with a column containing an NSImageCell.  When the  
priority is changed through the slider or level indicator, I want to  
update the other control, update the model, and change to a custom  
image in the table view.  Obviously, I only want to update the row  
where the priority was changed.  My first thought was this, but the  
last two sections of code have me stumped.  Updating the controls  
works fine, but when it comes to updating the model and setting the  
image, I'm not sure what to do.  There are 4 priorities: 0, 1, 2, and  
3, and in the resources folder are 4 images: priority0.tiff,  
priority1.tiff, priority2.tiff, and priority3.tiff.  I realize that I  
am trying to set the image to the wrong view, I'm just not sure which  
one to use.  Also, I know things would be much easier with bindings,  
but I'm not sure which to set.  Lastly, since I wasn't sure which  
bindings to use, I wanted to programmatically update the model, by  
updating the array controller corresponding the entity I was using.   
The attribute for the entity is priority.  I'm not sure what to do  
here, either.  Also, the last line tells me that arguments 1 and 2 of  
setValue:forKey: make a pointer from and integer without a cast.  How  
do we make a cast in objective-c?


Miscellaneous:
- Is there a simple way to programmatically create a blank NSImage ?

To sum up:
- What view to set, so that only the right row is updated with the  
appropriate image?

- What bindings should be used, and what code would they replace?
- How do I programmatically update the right attribute of the right  
entity of the model?

- How do I use bindings to do this?
- How do I typecast in objective-c?
- How do I create a blank NSImage?

- (IBAction)setPriority:(id)sender
{   
	// Check to see which control modified priority and set other view to  
new value...

int priority;
	if ([[NSString stringWithFormat:@%@, [sender class]]  
isEqual:@NSStepper]) {

priority = [priorityStepper intValue];
[priorityLevelIndicator setIntValue:priority];
}
	else if ([[NSString stringWithFormat:@%@, [sender class]]  
isEqual:@NSLevelIndicator]) {

priority = [priorityLevelIndicator intValue];
[priorityStepper setIntValue:priority];
}

// ... update priority image cell.
	[priorityCell setImage:[NSImage imageNamed:[NSString  
stringWithFormat:@priority%i, priority]]];


// ... and update model.
[[iItemController selectedObjects] setValue:priority forKey:priority];
}

Thanks for the help, and I apologize for all the questions.

- Walker Argendeli

___

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

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

2009-03-17 Thread Jelle De Laender
Okay but then you haven't the possibility to show the marker? So the  
user cannot insert text? He can only remove the numbers from right to  
left and add numbers at the right side

Not very comfortable... not other solution?

edit: Now you said this, I saw the same behaviour in other  
applications (no marker), so this is the best way to implement a own  
keyboard?


CodingMammoth.com
Jelle De Laender
i...@codingmammoth.com



On 17 Mar 2009, at 23:22, Dave DeLong wrote:

You fake it.  Have a non-editable textfield with a custom UILabel  
subclass on top of it.  When the UILabel gets tapped, bring up your  
custom keyboard and put the typed text into the UILabel.


Dave

On Mar 17, 2009, at 4:19 PM, Jelle De Laender wrote:


Hi

I've create a UIView with some UIButtons for a custom keypad.
Now I've a problem to 'hide' the numberpad of Apple.

When a user 'clicks/touches' the editfield, my UIView should be  
showed (setHidden:NO) and the textField should go in editing-modus,  
but without the numberPad of Apple.


How can you disable the numberPad of Apple and still having an  
editable textfield?


Kind regards

___

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

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

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

This email sent to maill...@codingmammoth.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: Incomprehensible KVC Failure!

2009-03-17 Thread Markus Spoettl

On Mar 17, 2009, at 11:10 PM, Seth Willits wrote:

It's completely boggling my mind.



When this happens to me (and it does occasionally) it usually is a  
tiny spelling error in the observation registration code, something my  
dyslexic brain can't spot even if it stares at it for hours. Not  
saying that you're like that obviously, it's just on way to explain  
what you are seeing.


Markus
--
__
Markus Spoettl



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

Re: -stringByEvaluatingJavaScriptFromString: return value iphone

2009-03-17 Thread Brent Fulgham
On Sat, Jan 31, 2009 at 9:10 AM, Marco Cassinerio
marco.cassine...@gmail.com wrote:
 Hi,

 i'm trying to execute a javascript function on the iPhone and get the return
 value.

 The function is simple:
 return hello;


The iPhone uses a new version of WebKit than ships on the Mac (unless
you install a WebKit nightly, or are using the Safari 4.0 beta).

You can confirm this using the jsc command-line program (built with
WebKit).  In earlier versions, it would support the 'return hello;'
example as expected, but the new Squirrelfish (or whatever it's
advertising name is nowadays) will not.

If you just change to Peter's formulation:
(function () {return hello;}) ();

... everything should work as you expect.

Think of it as future-proofing your code for Safari 4.0!  :-)

-Brent
___

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

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

2009-03-17 Thread Quincey Morris

On Mar 17, 2009, at 15:10, Seth Willits wrote:


I have a property in one of my classes:

NSString * suggestedDiskImageName;
@property (retain, readwrite) NSString * suggestedDiskImageName;
@synthesize suggestedDiskImageName;

Which is just like a dozen others that I declare, except for some  
reason that is beyond comprehension after my HOUR LONG  
investigation, when I do:


1) nonNilInstance.suggestedDiskImageName = someValue;
2) [nonNilInstance setSuggestedDiskImageName:someValue];
3) [nonNilInstance setValue:someValue  
forKey:@suggestedDiskImageName];



All of them fail to trigger will/didChangeValueForKey (which I'm  
overriding to see changes to all properties in my class). It  
actually changes the value, but it doesn't send the KVC methods.  
Every other single property works, but this one does not. I've tried  
multiple values, I've tried renaming the property, I've tried using  
a different instance variable, I've tried reordering the instance  
variables, property declarations, and synthesize declarations just  
incase it was some stupid thing like that, I've even tried calling  
the code from different locations in my project.. it always  
fails!


It's completely boggling my mind.


The only thing that worked was to create an implementation of  
setSuggestedDiskImageName: and manually call will/ 
didChangeValueForKey.


Excuse me for starting with the obvious question, but is there  
something actually KVO-observing nonNilInstance? Without an observer,  
the notifications aren't sent, and your setter is just a method.


If there's an observer, is it observing the suggestedDiskImageName  
property? It's possible the notifications are optimized away for  
properties with no observers, too.





___

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

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


[ANN] KSOutlineView Framework/Interface Builder Plugin

2009-03-17 Thread Kyle Sluder
Hi everybody,

In the course of developing the application I'm working on, I got
frustrated with having to create dummy data sources for my static
source list outline views.  They result in quite a bit of code that
can be a mess to alter when you want to later add an item to the
source list, they make localization difficult, and illogically put
static interface-related data in code.

Combine this with the other annoying source list nits (overriding
NSOutlineView just to implement -frameOfOutlineCellAtRow:, for
example, when it should be a delegate method) and I decided to fight
back with a framework and Interface Builder plugin I'm calling
KSOutlineView.

Right now it contains two classes: KSStaticTreeController, which when
used in IB presents an interface for editing a static tree of data,
and KSOutlineView, which doesn't do all that much differently from
NSOutlineView.  Right now the best immediate benefit is that binding a
plain-vanilla NSOutlineView to a KSStaticTreeController results in a
fully-usable outline view in the simulator.  Ideally, I'd like
KSOutlineView to present an interface for editing items directly in
design mode and a mechanism for pulling data from multiple
NSTreeControllers, so that you may for example have a static overall
source list structure with certain subtrees fed by bindings.

There are also a few issues, not the least of which is that Interface
Builder doesn't recognize changes to a KSStaticTreeController's
content, and thus does not mark the document as dirty.  This code is
very untested, since I wrote it today.

If you'd like to take a gander at it, and maybe help me improve it,
check it out at http://ksoutlineview.googlecode.com .

Thanks!
--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


cast to pointer from int of diff size IODisplayCreateInfoDictionary

2009-03-17 Thread Trygve Inda
io_service_tservice;
CFDictionaryRef dict;

dict = (CFDictionaryRef) IODisplayCreateInfoDictionary (service,
kNilOptions);

No matter what I do I get:

warning: cast to pointer from integer of different size

I am compiling 32/64bit and this is defined as:

CFDictionaryRef IODisplayCreateInfoDictionary(
io_service_t framebuffer,
IOOptionBits options );

Thaoughts?


___

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

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

2009-03-17 Thread Martin Wierschin

On Mar 17, 2009, at 2:16 PM, Jim Correia wrote:
In the case where you want to remove the italic attribute, you  
should be using -convertFont:toNotHaveTrait:.


It actually doesn't matter, you can use the unitalic/unbold masks  
with -convertFont:toHaveTrait:



On Mar 17, 2009, at 2:26 PM, Iceberg-Dev wrote:

NSFontManager *fontManager = [NSFontManager sharedFontManager];
[fontManager convertFont: [NSFont fontWithName: @Helvetica size:  
75] toHaveTrait: NSItalicFontMask];




Does one get the same results (Italic) when you use the  
NSObliquenessAttributeName attribute? Or are these totally different?


They are totally different.

NSItalicFontMask is a flag to be used with NSFontManager/NSFont. The  
flag can provide a font object which generates glyphs specifically  
designed by the font author to appear italic. If the font doesn't  
have a proper italic face, then the original font object will be  
returned.


On the other hand, NSObliquenessAttributeName is applied directly to  
NSAttributedString. The value of the attribute is an actual skew  
amount that affects the slant of all glyphs it is applied to, and  
doesn't depend on the font. The obliqueness attribute can be used to  
simulate italics for fonts that do not have such a typeface.


~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: [iPhone] NumberPad with the dot

2009-03-17 Thread Brian Slick
In searching for a similar solution myself, I've come across three  
possibilities:


1) Roll your own keyboard, as others have mentioned.

2) Overlay a decimal button onto the keyboard, like this:
http://billabonger.net/blog/2009/01/add-a-decimal-to-uitextfield-number-pad-keyboard/
* - I have no idea if this uses legal methods

3) For currency, you can make your text field add the decimal for the  
user automatically, like this:

http://davidjhinson.wordpress.com/2008/12/22/simple-formatting-in-a-cocoa-touch-text-edit-field-uitextfield/

#3 is covering my needs at the moment, and I believe is the easiest of  
the three options, provided it can be used for your situation.


I'm hoping that OS 3.0 adds a new built-in keyboard option.

Brian


On Mar 16, 2009, at 6:57 PM, Jelle De Laender wrote:


Hi,

I was a little bit surprised because the default number pad doesn't  
contains a dot.
I've created an application and the user need to enter decimal  
numbers.


The default number pad is: http://h4xr.org/ifm4 (see  
UITextInputTraits Protocol Reference)


There is an empty space at the left-bottom but I can't find anywhere  
how I can get a number pad that contains a dot. I can't believe that  
Apple hasn't a number pad that support decimal numbers. This is  
something basic, isn't?


What is the best way to get a dot on the number pad?

Jelle,


___

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

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

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

This email sent to briansl...@mac.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: selector ... is passed a return code and caller specified in contextInfo ?!?!

2009-03-17 Thread Andy Lee
Under See Also is endSheet:returnCode:, the docs for which do  
explain the returnCode, which presumably has the same meaning.  Yeah,  
this fact is discoverable, but it couldn't hurt to submit feedback  
saying it wasn't obvious.


--Andy

On Mar 17, 2009, at 7:41 PM, Jerry Krinock wrote:


In documentation for method

-[NSApplication  
beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:]


I read:

The didEndSelector ... is invoked after the modal session has ended  
and is passed a return code and caller specified in contextInfo.
didEndSelectorshould have the following signature:


  - (void)sheetDidEnd:(NSWindow *)sheet
   returnCode:(int)returnCode
  contextInfo:(void *)contextInfo ;

Well, as it says in the feedback form, This document is missing  
information.  I guess that contextInfo is a pass-thru.  But what in  
the world is the returnCode?  My didEndSelector always seem to get  
-1000.


Someone tell me please the missing information and I'll submit the  
feedback.


Sincerely,

Jerry Krinock


___

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

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

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

This email sent to ag...@mac.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: selector ... is passed a return code and caller specified in contextInfo ?!?!

2009-03-17 Thread Alexander Spohr


Am 18.03.2009 um 00:41 schrieb Jerry Krinock:

The didEndSelector ... is invoked after the modal session has ended  
and is passed a return code and caller specified in contextInfo.
didEndSelectorshould have the following signature:


  - (void)sheetDidEnd:(NSWindow *)sheet
   returnCode:(int)returnCode
  contextInfo:(void *)contextInfo ;

Well, as it says in the feedback form, This document is missing  
information.  I guess that contextInfo is a pass-thru.  But what in  
the world is the returnCode?  My didEndSelector always seem to get  
-1000.


Someone tell me please the missing information and I'll submit the  
feedback.



You need some methods to either accept or decline the sheets result.  
These methods tell the NSApp what should be returned. You could even  
return your own codes:


- (IBAction)cancelSetup:sender
{
	[[NSApplication sharedApplication] endSheet:setupWindow  
returnCode:NSRunAbortedResponse];

}
- (IBAction)acceptSetup:sender
{
	[[NSApplication sharedApplication] endSheet:setupWindow  
returnCode:NSRunStoppedResponse];

}


___

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

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

2009-03-17 Thread Harry Plate
Graham,

Finally getting back to this problem.

2) I would like my user to be able to select a table entry, and
 be able
 to respond to the 'delete' key - by discarding the selected entry.
 Currently
 that does not work at all.
 
 You have to make this happen yourself. The controller that is handling
 the tableview will need to respond to the delete key by finding the
 current selection (i.e. calling -selectedRowIndexes on the tableview),
 deleting the corresponding items from the data model and reloading the
 table view.
 
 To respond to the delete key, the controller will need to subclass
 NSResponder and insert itself as the next responder to the table view
 by calling [tableView setNextResponder:self]; . It then needs to
 override -deleteBackward: or whatever.

So far I have tried to accomplish this without success.

1) I defined my controller class:
@interface MCController : NSResponder

2) I then defined (void)deleteBackward:(id)

3) in -awakeFromNib, I set my controller as 1st responder:

[sourceTableView setNextResponder:self]


Sadly,  I do not get to the -deleteBackward: method (Xcode bkpnt).
The ui merely beeps when I hit the 'delete' (backward) key.

Currently the table column are not editable; I tried to make editable, but
that had no effect on the behavior.

I also implemented -acceptsFirstResponder (returning YES); that too did not
change the behavior.

I am obviously barking up the wrong tree. Should I subclass NSTableView, and
intercept keys (keyDown)? I am seeing some list topics where folks have done
that.  

Comments welcome,


-harry


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: selector ... is passed a return code and caller specified in contextInfo ?!?!

2009-03-17 Thread Graham Cox


On 18/03/2009, at 10:41 AM, Jerry Krinock wrote:

Well, as it says in the feedback form, This document is missing  
information.  I guess that contextInfo is a pass-thru.  But what in  
the world is the returnCode?  My didEndSelector always seem to get  
-1000.


Someone tell me please the missing information and I'll submit the  
feedback.



returnCode is whatever got passed to [NSApp endSheet:returnCode:]

For most typical dialogs, it's usually NSCancelButton or NSOKButton.

--Graham


___

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

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

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

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


Re: How to make letters appear in italics?

2009-03-17 Thread Li Fumin

It works now. And NSUnitalicFontMask works too. Thanks, all of you.
___

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

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

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

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


Re: selector ... is passed a return code and caller specified in contextInfo ?!?!

2009-03-17 Thread Sean McBride
Jerry Krinock (je...@ieee.org) on 2009-03-17 7:41 PM said:

The didEndSelector ... is invoked after the modal session has ended
and is passed a return code and caller specified in contextInfo.
didEndSelectorshould have the following signature:

- (void)sheetDidEnd:(NSWindow *)sheet
 returnCode:(int)returnCode
contextInfo:(void *)contextInfo ;

This is wrong.  The int should be NSInteger.

Sean


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: selector ... is passed a return code and caller specified in contextInfo ?!?!

2009-03-17 Thread Jerry Krinock
Thank you, guys.  So, saying that the return code is specified in  
contextInfo is not just missing information, it's just plain wrong,  
or as they say inaccurate ;)


Document feedback has been submitted for this and for Sean's int -  
NSInteger.


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Automatically replacing part of text in a text label

2009-03-17 Thread Peter Zegelin


On 16/03/2009, at 5:20 PM, Peter Zegelin wrote:

OK - thanks everyone.

Just as I was about to wire things up in IB I realised that a subclass  
of NSTextField would be the best way. Turns out its a one liner in  
awakeFromNib.


- (void)awakeFromNib {

	[self setStringValue:[[self stringValue]  
stringByReplacingOccurrencesOfString:@ApplicationName withString: 
[[NSBundle mainBundle] objectForInfoDictionaryKey:@CFBundleName]]];

}


In the same vein I have two other bits where I would like to  
automatically replace text. The first is my 'Warranty Panel'. I am  
currently loading it into an NSTextView like so:


[warrantyTextField readRTFDFromFile:[[NSBundle mainBundle]  
pathForResource:@LicenseAgreement ofType:@rtf]];


Because it is rtf, I understand it is much more involved to change all  
occurrences of ApplicationName. Does anyone know of an example how  
this is done? I found a few things like OmniAppkit that have a Find  
and Replace Panel but they seem way too complicated for this.




The second area is some menus under the application menu -  
specifically About... Hide and Quit. The top level Menu seems to  
reflect the application name but the rest just show About  
NewApplication etc. Would the best way to change these automatically  
be to:


wire up the first menu to my app delegate
get all the items with - (NSArray *)itemArray on awakeFromNib
iterate over all items in this array replacing the string like with my  
NSTextField subclass above?


Thanks!

Peter



I have some text labels in a registration dialog that contain the  
application name eg


xxx Demonstration
Thank you for purchasing xxx

and so on.

I would like this registration dialog to be general enough that I  
can use it in multiple applications. Is there a simple way to  
replace the xxx with the actual application name at runtime? At the  
moment I'm thinking I'll have to wire every label up to my  
registration controller and do it in awakeFromNib, but I was hoping  
for something easier.





___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: cast to pointer from int of diff size IODisplayCreateInfoDictionary

2009-03-17 Thread Clark Cox
2009/3/17 Trygve Inda cocoa...@xericdesign.com:
 io_service_t        service;
 CFDictionaryRef     dict;

 dict = (CFDictionaryRef) IODisplayCreateInfoDictionary (service,
 kNilOptions);

The fact that you have to cast the result at all is a pretty big
indicator. I'd bet you've forgotten to include whatever header
IODisplayCreateInfoDictionary is defined in. (You're probably also
seeing warnings about the implicit declaration of
IODisplayCreateInfoDictionary).

 No matter what I do I get:

 warning: cast to pointer from integer of different size

 I am compiling 32/64bit and this is defined as:

 CFDictionaryRef IODisplayCreateInfoDictionary(
    io_service_t framebuffer,
    IOOptionBits options );

 Thaoughts?


 ___

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

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

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

 This email sent to clarkc...@gmail.com




-- 
Clark S. Cox III
clarkc...@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: Drawing background windows during window move.

2009-03-17 Thread Michael Ash
On Tue, Mar 17, 2009 at 1:38 PM, Garrett Moon garr...@pondry.com wrote:
 I have two windows in an application, a GuideWindow and a RegularWindow. The
 GuideWindow covers all screens and displays guide lines that match up with
 the edges of the contentView in RegularWindow. When RegularWindow is moved
 or resized, GuideWindow updates its display to move the guide lines with it.
 This is achieved through windowDidResize notifications and windowDidMove
 notifications. when doing a resize, everything works perfectly with the
 guide lines updating as the RegularWindow is resized.

 However, windowDidMove is only called when the user pauses while moving
 RegularWindow. So I subclassed RegularWindow and made windowDragged send an
 NSWindowDidMoveNotification (sloppy, I know). This calls the update method
 of GuideWindow properly, but it still doesn't draw until the user pauses.

 I've got some NSLogs in the guide update function, so I know it's being
 called, but no drawing. I've tried sending the display method to all of the
 GuideWindow views and to the GuideWindow itself with no avail. I've also
 tried updating and flushing the window.

 Am I missing something? Are only certain drawing events called in the event
 loop when a window is being dragged? Could this have to do with window
 backing? Thanks in advance,

Window movement in Cocoa is done asynchronously by the window server.
This is what lets you smoothly move windows in apps that are heavily
using their main runloop, and what lets you move windows at all in
apps that are hung. Generally it's a useful thing. But the trouble is
that it's inherently asynchronous, so the sort of thing you're trying
to do simply cannot work.

You have a couple of options here:

1) Make the window that draws your background grid a child of the
window that can move around. This will cause the window server to move
it along with the main window. Obviously for this to work in this
scenario, the window will have to be large enough that the user can't
expose the edges of it no matter how far they move.

2) Somehow disable the default window moving behavior and reimplement
it yourself to work in a synchronous, controlled manner.

Personally I'd recommend option #1, as #2 is likely to be difficult,
fragile, and produce dragging that's not very smooth, but obviously
the choice is yours.

Mike
___

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

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

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

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


Re: selector ... is passed a return code and caller specified in contextInfo ?!?!

2009-03-17 Thread Michael Ash
On Tue, Mar 17, 2009 at 7:41 PM, Jerry Krinock je...@ieee.org wrote:
 In documentation for method

  -[NSApplication
 beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:]

 I read:

 The didEndSelector ... is invoked after the modal session has ended and is
 passed a return code and caller specified in contextInfo.
 didEndSelectorshould have the following signature:

   - (void)sheetDidEnd:(NSWindow *)sheet
            returnCode:(int)returnCode
           contextInfo:(void *)contextInfo ;

 Well, as it says in the feedback form, This document is missing
 information.  I guess that contextInfo is a pass-thru.  But what in the
 world is the returnCode?  My didEndSelector always seem to get -1000.

 Someone tell me please the missing information and I'll submit the feedback.

What documentation are you looking at? In the NSApplication
documentation both on my hard drive and on apple.com, it doesn't
contain the phrasing you mention, and is considerably more clear. Are
your docs out of date?

Mike
___

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

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

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

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


Re: Automatically replacing part of text in a text label

2009-03-17 Thread Michael Ash
On Tue, Mar 17, 2009 at 10:41 PM, Peter Zegelin
pe...@fracturedsoftware.com wrote:
 In the same vein I have two other bits where I would like to automatically
 replace text. The first is my 'Warranty Panel'. I am currently loading it
 into an NSTextView like so:

 [warrantyTextField readRTFDFromFile:[[NSBundle mainBundle]
 pathForResource:@LicenseAgreement ofType:@rtf]];

 Because it is rtf, I understand it is much more involved to change all
 occurrences of ApplicationName. Does anyone know of an example how this is
 done? I found a few things like OmniAppkit that have a Find and Replace
 Panel but they seem way too complicated for this.

It's actually quite straightforward. Assuming warrantyTextField is
actually an NSTextView (in which case you really ought to change the
name), [[warrantyTextField textStorage] mutableString] will give you
an instance of NSMutableString which reflects changes back to the text
view. Use your standard NSMutableString manipulations on that, and
that's all you have to do.

Mike
___

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

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

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

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


Re: cast to pointer from int of diff size IODisplayCreateInfoDictionary

2009-03-17 Thread Sean McBride
Trygve Inda (cocoa...@xericdesign.com) on 2009-03-17 7:36 PM said:

io_service_tservice;
CFDictionaryRef dict;

dict = (CFDictionaryRef) IODisplayCreateInfoDictionary (service,
kNilOptions);

Why the cast?

No matter what I do I get:

warning: cast to pointer from integer of different size

Which warning flag generates this?  I can't repro with -Wall -Wextra.
Try adding -fdiagnostics-show-option.

Sean


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: GUI Calls in Tool Executable seem to be No-Op. Nice, but safe?

2009-03-17 Thread Jerry Krinock


On 2009 Mar 15, at 08:49, Michael Ash wrote:


For example, Apple could easily decide in 10.6 (or even 10.5.7) that
NSAlert really could do with an explicit call to NSApplicationLoad for
convenience. Now you are screwed.


Yes.

Do the right thing, and don't make GUI calls if you don't want GUI  
stuff.


OK, I'm working on it.


(Note that if your command-line tool is intended to be used from
anywhere, for example from an ssh session as a different user from the
one logged in to the GUI, then you shouldn't even *link* against
AppKit in the tool, much less call it.)


I believe it's OK for my tool to link against AppKit since, in the  
context of TN2083, it my tool is an agent and not a daemon, and also I  
intend for it to be launched only by launchd, or by another agent  
which is itself launched by launchd.


Thanks, 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


Re: Automatically replacing part of text in a text label

2009-03-17 Thread Peter Zegelin

Thanks Michael,

That works great. I changed the name of the variable as well:

	[warrantyTextView readRTFDFromFile:[[NSBundle mainBundle]  
pathForResource:@LicenseAgreement ofType:@rtf]];


	NSMutableString *warranty = [[warrantyTextView textStorage]  
mutableString];		
	[warranty replaceOccurrencesOfString:@ApplicationName withString: 
[[NSBundle mainBundle] objectForInfoDictionaryKey:@CFBundleName]  
options:NSLiteralSearch range:NSMakeRange(0, [warranty length])];


Peter

On 18/03/2009, at 2:17 PM, Michael Ash wrote:


On Tue, Mar 17, 2009 at 10:41 PM, Peter Zegelin
pe...@fracturedsoftware.com wrote:
In the same vein I have two other bits where I would like to  
automatically
replace text. The first is my 'Warranty Panel'. I am currently  
loading it

into an NSTextView like so:

[warrantyTextField readRTFDFromFile:[[NSBundle mainBundle]
pathForResource:@LicenseAgreement ofType:@rtf]];

Because it is rtf, I understand it is much more involved to change  
all
occurrences of ApplicationName. Does anyone know of an example  
how this is
done? I found a few things like OmniAppkit that have a Find and  
Replace

Panel but they seem way too complicated for this.


It's actually quite straightforward. Assuming warrantyTextField is
actually an NSTextView (in which case you really ought to change the
name), [[warrantyTextField textStorage] mutableString] will give you
an instance of NSMutableString which reflects changes back to the text
view. Use your standard NSMutableString manipulations on that, and
that's all you have to do.

Mike
___

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

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

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

This email sent to pe...@fracturedsoftware.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


Growl vs. CFUserNotification

2009-03-17 Thread Jerry Krinock


On 2009 Mar 15, at 09:03, Jean-Daniel Dupas wrote (in thread GUI  
Calls in Tool Executable...):


Just to complete the answer, the correct way to display alert from a  
background process is to use the CFUserNotification API.


Thanks, I wasn't even aware of that.  I was thinking of using Growl if  
my agent ever needed to speak with the user.  After a few minutes of  
reading, it appears that ...


Advantages of Growl:
   Probably looks nicer
   Configurable by user
   Objective-C -- API looks easier to use

Advantages of CFUserNotification
   No extra framework to package
   Not configurable by user (Good if you don't want this)
   No AppKit -- safe for use in daemons

Any other Growl vs. CFUserNotification considerations that one should  
be aware of?


Jerry Krinock


___

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

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

2009-03-17 Thread rethish
Hi,


When running an iphone application I can access files from the application¹s
folders (Document, Library, Temp).
Is that possible to access files from folders (like music folder ..)other
than the folder specified above?


Thankyou.

___

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

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