Getting rid of the field editor after editing

2010-06-26 Thread Graham Cox
Hi all, I have a custom subclass of NSCell which is used in a custom NSView (not a control) to draw an array of icons. The cell has an editable text label. I can set up and edit the label fine, but I'm having trouble cleaning up when the edit has finished. What I'm left with is an empty white b

Re: Getting rid of the field editor after editing

2010-06-26 Thread Ken Thomases
On Jun 26, 2010, at 2:27 AM, Graham Cox wrote: > What is the correct way to tear down or remove the field editor when editing > is complete? The field editor is intimately connected to the window, so it's often the window's responsibility to manage it. See the discussion of the -[NSWindow end

Re: Getting rid of the field editor after editing

2010-06-26 Thread Graham Cox
On 26/06/2010, at 6:16 PM, Ken Thomases wrote: > On Jun 26, 2010, at 2:27 AM, Graham Cox wrote: > >> What is the correct way to tear down or remove the field editor when editing >> is complete? > > The field editor is intimately connected to the window, so it's often the > window's responsibi

Re: Getting rid of the field editor after editing [SOLVED]

2010-06-26 Thread Graham Cox
The final piece of the problem was that the hosting custom view was directly calling -resetCursorRects, in violation of the documentation. Once I changed this to the recommended -invalidateCursorRectsForView:, everything was hunky-dory. --Graham On 26/06/2010, at 8:46 PM, Graham Cox wrote:

How tell tell if an NSNumber was initialized from a float or int?

2010-06-26 Thread Jaime Magiera
Hello, The list search keeps timing out for me, and web searches are not finding anything. I can see how to tell if an NSNumber was initialized with an int or boolean (NSCFNumber vs. NSCFBoolean). However, I can't figure out how to determine if the NSNumber was initialized with an int or float.

Re: How tell tell if an NSNumber was initialized from a float or int?

2010-06-26 Thread Dave DeLong
-[NSNumber objCType] Compare that against @encode(float), @encode(int), etc. Cheers, Dave On Jun 26, 2010, at 10:45 AM, Jaime Magiera wrote: > Hello, > > The list search keeps timing out for me, and web searches are not finding > anything. I can see how to tell if an NSNumber was initialized

Re: How tell tell if an NSNumber was initialized from a float or int?

2010-06-26 Thread Jaime Magiera
On Jun 26, 2010, at 12:46 PM, Dave DeLong wrote: > -[NSNumber objCType] > > Compare that against @encode(float), @encode(int), etc. That did the trick. Thanks! if((strcmp([aNumber objCType], @encode(int))) == 0) {

Re: How tell tell if an NSNumber was initialized from a float or int?

2010-06-26 Thread Kyle Sluder
On Jun 26, 2010, at 9:45 AM, Jaime Magiera wrote: > Hello, > > The list search keeps timing out for me, and web searches are not finding > anything. I can see how to tell if an NSNumber was initialized with an int or > boolean (NSCFNumber vs. NSCFBoolean). However, I can't figure out how to >

Re: How tell tell if an NSNumber was initialized from a float or int?

2010-06-26 Thread Quincey Morris
On Jun 26, 2010, at 10:52, Kyle Sluder wrote: > On Jun 26, 2010, at 9:45 AM, Jaime Magiera wrote: > >> Hello, >> >> The list search keeps timing out for me, and web searches are not finding >> anything. I can see how to tell if an NSNumber was initialized with an int >> or boolean (NSCFNumber

Toolbar Icon Workflow

2010-06-26 Thread Richard Somers
My current ad hoc work flow for toolbar icons which are geometric in nature. • Use "Inkscape". • Use a small canvas size of 28 points wide x 22 points high. • Try to make sure the ink is generally constrained with the individual point boundaries. • Save the "Inkscape" file as a pdf. • Op

Re: How tell tell if an NSNumber was initialized from a float or int?

2010-06-26 Thread jonat...@mugginsoft.com
On 26 Jun 2010, at 19:51, Quincey Morris wrote: > On Jun 26, 2010, at 10:52, Kyle Sluder wrote: > >> On Jun 26, 2010, at 9:45 AM, Jaime Magiera wrote: >> >>> Hello, >>> >>> The list search keeps timing out for me, and web searches are not finding >>> anything. I can see how to tell if an NSN

Add annotations to pdf on iPhone

2010-06-26 Thread Andrew
Hello, List I know that adding annotations to pdf is supported on Mac OS X, PDFAnnotations, but i can not find out such object for iOS, after googling, seems this functionality is supported on iPad now, but what about iPhone? Can anyone give me a hint? Thanks in advance. XiaoGang___

Re: How tell tell if an NSNumber was initialized from a float or int?

2010-06-26 Thread Michael Ash
On Sat, Jun 26, 2010 at 12:45 PM, Jaime Magiera wrote: > Hello, > > The list search keeps timing out for me, and web searches are not finding > anything. I can see how to tell if an NSNumber was initialized with an int or > boolean (NSCFNumber vs. NSCFBoolean). However, I can't figure out how to

Re: Toolbar Icon Workflow

2010-06-26 Thread Paul Sanders
I create my icons as vector graphics without worrying *at all* about pixel boundaries and then scale them to fit at display time. Life improved markedly when I went this route. Although they might not be as sharp as 'pixel-perfect' bitmapped images it means I don't have to worry too much about

CoreData and undo/redo : how to add a managed object with attributes already set in the undo/redo stack ?

2010-06-26 Thread Guillaume Laurent
Hi all, I'm having difficulties with the undo/redo mechanism and my Core Data objects. The problem is that I create a CoreData object (say a rectangle), then set some of its attributes according to some controls values (the position and size of a CALayer the user has just created in a view). Th

Re: Toolbar Icon Workflow

2010-06-26 Thread Gideon King
The two sizes of the icons when displayed as "normal" and "small" are 32x32 and 24x24. While the recommended way of handling this is to create a multi-image file as has been described previously, or to use a PDF, I find drawbacks in both approaches - multi-image files are normally just the two s

C arrays as __block variables

2010-06-26 Thread Matt Neuburg
The docs say: "There are two further restrictions on __block variables: they cannot be variable length arrays, and cannot be structures that contain C99 variable-length arrays." This would seem to imply that a __block variable *can* be a *fixed* length array. But when I try to write into such an a

Re: CoreData and undo/redo : how to add a managed object with attributes already set in the undo/redo stack ?

2010-06-26 Thread Jerry Krinock
On 2010 Jun 26, at 16:01, Guillaume Laurent wrote: > I'm having difficulties with the undo/redo mechanism and my Core Data objects. Uh-huh. > The problem is that I create a CoreData object (say a rectangle), then set > some of its attributes according to some controls values (the position and

Re: C arrays as __block variables

2010-06-26 Thread Bill Bumgarner
On Jun 26, 2010, at 6:38 PM, Matt Neuburg wrote: > The docs say: "There are two further restrictions on __block variables: they > cannot be variable length arrays, and cannot be structures that contain C99 > variable-length arrays." > > This would seem to imply that a __block variable *can* be a

Re: C arrays as __block variables

2010-06-26 Thread Tony Romano
hmmm. Your saying this doesn't work? NSBlockOperation * foo = [NSBlockOperation blockOperationWithBlock:^{ __block char array1[5]; array1[0] = 'T'; }]; It works fine for me. Are you saying something different? -

Re: C arrays as __block variables

2010-06-26 Thread Dave DeLong
That's going to create a new copy of the array every time the block is executed, and the array is not accessible outside of the scope of the block. Matt was asking about: __block char array1[5]; NSBlockOperation * foo = [NSBlockOperation blockOperationWithBlock:^{ array1[0] = 'T'; } Dave On

Re: How tell tell if an NSNumber was initialized from a float or int?

2010-06-26 Thread James W. Walker
On Jun 26, 2010, at 11:51 AM, Quincey Morris wrote: > 1. Unless this has changed recently, [NSNumber numberWithInt: 1] and > [NSNumber numberWithBool: YES] both return the same (singleton) object, as do > [NSNumber numberWithInt: 0] and [NSNumber numberWithBool: NO]. This is not true in Snow L

Re: C arrays as __block variables

2010-06-26 Thread Tony Romano
I understand all that. I was providing an example to seek clarity in his question. But I understand what he is asking now, thanks. -Tony On Jun 26, 2010, at 7:50 PM, Dave DeLong wrote: > That's going to create a new copy of the array every time the block is > executed, and the array is not a

Re: C arrays as __block variables

2010-06-26 Thread Bill Bumgarner
On Jun 26, 2010, at 7:48 PM, Tony Romano wrote: > hmmm. Your saying this doesn't work? > > NSBlockOperation * foo = [NSBlockOperation > blockOperationWithBlock:^{ > __block char array1[5]; > > array1[0] = 'T'; > }]; > >

Re: C arrays as __block variables

2010-06-26 Thread Tony Romano
Actually, I read this again. OP posted: "This would seem to imply that a __block variable *can* be a *fixed* length array. But when I try to write into such an array inside a block, I get a compile error, "cannot access __block variable of array type inside block." In the example I listed below,

Re: C arrays as __block variables

2010-06-26 Thread Kyle Sluder
On Sat, Jun 26, 2010 at 8:51 PM, Tony Romano wrote: > OP posted: "This would seem to imply that a __block variable *can* be a > *fixed* length > array. But when I try to write into such an array inside a block, I get a > compile error, "cannot access __block variable of array type inside block."

Re: C arrays as __block variables

2010-06-26 Thread Bill Bumgarner
On Jun 26, 2010, at 8:56 PM, Kyle Sluder wrote: > Putting __block variables inside of blocks is completely pointless. > The purpose of the __block qualifier is to mark variables in the > enclosing scope to be copied into the block. Unless you have a Block within the Block and you want to share a

Re: C arrays as __block variables

2010-06-26 Thread Tony Romano
That's why I asked for an example of what the op question is Sent from my phone, Thanks Tony On Jun 26, 2010, at 8:56 PM, Kyle Sluder wrote: > On Sat, Jun 26, 2010 at 8:51 PM, Tony Romano wrote: >> OP posted: "This would seem to imply that a __block variable *can* be a >> *fixed* length >> ar

Re: C arrays as __block variables

2010-06-26 Thread Bill Bumgarner
On Jun 26, 2010, at 9:14 PM, Tony Romano wrote: > That's why I asked for an example of what the op question is http://lists.apple.com/archives/cocoa-dev/2010/Jun/msg01040.html > This would seem to imply that a __block variable *can* be a *fixed* length > array. But when I try to write into such

Re: C arrays as __block variables

2010-06-26 Thread Tony Romano
- (void)_copyOrMoveURLs:(SEL) s opMove:(BOOL)op src:(NSDictionary *)URLs completionHandler:(void (^)(NSDictionary *newURLs, NSError *error))handler { __block char array1[5]; array1[0] = 'W'; NSBlockOperation * foo = [NSBlockOperation blo

Re: C arrays as __block variables

2010-06-26 Thread Tony Romano
The reason for the __block specifier is to allow the variable to be written to. If the variable remains a const, then the complier can optimize how the block is stored. If the data is changed, much of the optimization is lost. -Tony On Jun 26, 2010, at 8:56 PM, Kyle Sluder wrote: > On Sat, J

Re: Cocoa-dev Digest, Vol 7, Issue 684

2010-06-26 Thread Jim McGowan
On 27 Jun 2010, at 3:19, Richard Somers wrote: > With an NSButton the pdf file works great and looks great when scaling set to > none. When the pdf file is used as the image for the toolbar item, it gets > asymmetrically stretched and looks horrible. Thus the reason for converting > the pdf to