NSScrollView does not honor system preferences for scroll bars ("when scrolling"), when I override the -tile method.

2012-07-04 Thread Sanjay Arora
Below is my code that overlays a control on the horizontal scrollbar. (void)tile { [super tile]; if (subControl) { NSRect subControlFrame = [subControl frame]; NSScroller *horizontalScroller = [self horizontalScroller]; NSRect scro

Re: CheckEventQueueForUserCancel() equivalent in Cocoa ?

2012-07-04 Thread Eric Matecki
On 03/07/12 22:23, Charles Srstka wrote: > On Jul 3, 2012, at 10:16 AM, Eric Matecki wrote: > >> everything is in the subject, what's the equivalent for CheckEventQueueForUserCancel() in Cocoa ? > > There are multiple ways to implement a user cancel operation, depending on your design. Probably

Re: Equation style display

2012-07-04 Thread Jean Suisse
Dave, Chris, Thank you so much for your reply. I did check the library at https://github.com/davedelong/DDMathParser/. It incredibly nice. I am grateful to Dave for developing & sharing it. Il will now investigate the parsing + mathML conversion combined with rendering possibility. Thanks all

Re: Stupid block syntax!

2012-07-04 Thread Graham Cox
On 04/07/2012, at 3:50 PM, Roland King wrote: > Put 'NSComparisonResult' after = and before ^ to declare the return value of > the block in the code below. That didn't work, but after a few more wild guesses, I stumbled on the correct form: NSComparisonResult (^comp)( id, id ) = ^N

Re: Stupid block syntax!

2012-07-04 Thread Graham Cox
On 04/07/2012, at 4:19 PM, Quincey Morris wrote: > Actually, for a block literal, it's: > > … = ^NSComparisonResult ( id a, id > b ) { … } > > The literal syntax puts the return type after the [unparenthesized] "^", > unlike the pointer syntax which puts the return type before the > [p

Re: Stupid block syntax!

2012-07-04 Thread Roland King
On Jul 4, 2012, at 8:13 PM, Graham Cox wrote: > > On 04/07/2012, at 3:50 PM, Roland King wrote: > >> Put 'NSComparisonResult' after = and before ^ to declare the return value of >> the block in the code below. > > > That didn't work, but after a few more wild guesses, I stumbled on the > c

Dynamic modification of text search results

2012-07-04 Thread Martin Hewitson
Dear List, I asked this question in January but didn't get a reply. Since I haven't come up with any good/solid ideas myself, I thought I'd ask again, in case this time it triggers some thought. I have an app which managed a bunch of files and presents these text files for viewing and editing

Re: Dynamic modification of text search results

2012-07-04 Thread Marco Tabini
> Does anyone have any good suggestions as to how to update my search results > when the underlying source text changes? Do I have to listen for all changes > from the underlying text objects and try to adapt, or is there a better > pattern for doing this? Xcode does this nicely: no matter what

Crash in System Prefs when installing PrefPane

2012-07-04 Thread Trygve Inda
I am getting a crash in SysPrefs: objc_msgSend() selector name: alloc com.xericdesign.earthdesk.prefPane v.821 (MyPrefPane) objc[7541]: garbage collection is ON Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libobjc.A.dylib 0x7fff9067404d objc_msgSend_vtable1 +

Re: Stupid block syntax!

2012-07-04 Thread Ken Thomases
On Jul 4, 2012, at 7:45 AM, Roland King wrote: > I sort of understand the explanation by Ken Thomas, although I never really > gelled with the C function pointer syntax and always had to look that up. Well, my suggestion was actually to think in terms of just C function syntax, not function poi

Property inheritance

2012-07-04 Thread William Squires
Here's my class graph: Shape (base class - inherits only from NSObject) LineShape : Shape RectangleShape : Shape SquareShape : RectangleShape In RectangleShape, I define: @property (nonatomic, assign) CGSize rectSize; @property (nonatomic, readonly) CGFloat area; @property (nonatomic, readonly)

Re: Dynamic modification of text search results

2012-07-04 Thread Martin Hewitson
On 4, Jul, 2012, at 03:22 PM, Marco Tabini wrote: >> Does anyone have any good suggestions as to how to update my search results >> when the underlying source text changes? Do I have to listen for all changes >> from the underlying text objects and try to adapt, or is there a better >> pattern

Re: Property inheritance

2012-07-04 Thread Ken Thomases
On Jul 4, 2012, at 9:32 AM, William Squires wrote: > Here's my class graph: > > Shape (base class - inherits only from NSObject) > LineShape : Shape > RectangleShape : Shape > SquareShape : RectangleShape Just so you know, this is the archetypal example of a violation of the Liskov substitution

Re: Prevent Quarantine message on helper app

2012-07-04 Thread Trygve Inda
> On Jul 2, 2012, at 5:10 PM, Trygve Inda wrote: > >> When users open my prefpane for the first time they get the OS quarantine >> message. Then my prefpane has to open a helper app and it pauses for about >> 30 seconds and then throws up another quarantine message... This time for >> the helper.

Re: Dynamic modification of text search results

2012-07-04 Thread Martin Hewitson
On 4, Jul, 2012, at 03:22 PM, Marco Tabini wrote: >> Does anyone have any good suggestions as to how to update my search results >> when the underlying source text changes? Do I have to listen for all changes >> from the underlying text objects and try to adapt, or is there a better >> pattern

Re: Prevent Quarantine message on helper app

2012-07-04 Thread Ken Thomases
On Jul 4, 2012, at 11:18 AM, Trygve Inda wrote: >> On Jul 2, 2012, at 5:10 PM, Trygve Inda wrote: >> >>> When users open my prefpane for the first time they get the OS quarantine >>> message. Then my prefpane has to open a helper app and it pauses for about >>> 30 seconds and then throws up anoth

Re: Dynamic modification of text search results

2012-07-04 Thread Marco Tabini
On 2012-07-04, at 1:01 PM, Martin Hewitson wrote: > > On 4, Jul, 2012, at 03:22 PM, Marco Tabini wrote: > >>> Does anyone have any good suggestions as to how to update my search results >>> when the underlying source text changes? Do I have to listen for all >>> changes from the underlying t

Binding NSTableView to NSSet

2012-07-04 Thread Koen van der Drift
Hi, I am trying to hookup a view based NSTableView to my CoreData model using bindings. The table should display various attributes of the entity 'Tags', which has a many-to-one relationship with my main entity. In my code I can see that the Tags entities are valid using NSLog statements, howe

Re: Dynamic modification of text search results

2012-07-04 Thread Martin Hewitson
On 4, Jul, 2012, at 07:32 PM, Marco Tabini wrote: > > On 2012-07-04, at 1:01 PM, Martin Hewitson wrote: > >> >> On 4, Jul, 2012, at 03:22 PM, Marco Tabini wrote: >> Does anyone have any good suggestions as to how to update my search results when the underlying source text changes?

Re: NSScrollView does not honor system preferences for scroll bars ("when scrolling"), when I override the -tile method.

2012-07-04 Thread Lee Ann Rucker
There's some complicated behind-the-scenes stuff in NSScrollView et al to avoid breaking apps that put extra stuff in the horizontal scroll zone because with some of the new style settings the scroll zone size is highly variable in both dimensions. Wouldn't surprise me if there's code to detect

Toggle row selection using checkbox

2012-07-04 Thread Heizer, Charles
Hello, I'm using a NSArrayController as the delegate and datasource for aNSTableView. In my table view I would like to use a checkbox in my first column to toggle the row selection. I have been searching thought the docs and I must be using the wrong terminology or something. Does anyone have a

Re: Toggle row selection using checkbox

2012-07-04 Thread Gary L. Wade
You would just have another column with another property to bind or set to if you want to use a check box. The selection provided by NSTableView is different, and you'd ignore the other methods of marking a selection. -- Gary L. Wade http://www.garywade.com/ On 7/4/2012 11:47 AM, "Heizer, Charle

Table view missing row separator after add 1st row.

2012-07-04 Thread Steve Fogel
Hi, all… My app starts by showing a table view with no rows. The user taps + to add the first entry. A modal view controller is presented to get input data and then it is dismissed to reveal the original table view, where the new entry is show. See the screenshot. In recent versions of iOS, whe

Re: opening file without an extension

2012-07-04 Thread Sean McBride
On Sun, 1 Jul 2012 20:21:39 -0700, Todd Heberlein said: >> Does putting an asterisk (*) in the Extensions field for your document >type not work in the sandbox? > >Excellent! Yes it did. Umm, why not just use the documented technique? setAllowedFileTypes: "A nil value indicates that all files s

Re: opening file without an extension

2012-07-04 Thread Charles Srstka
On Jul 4, 2012, at 2:40 PM, Sean McBride wrote: > On Sun, 1 Jul 2012 20:21:39 -0700, Todd Heberlein said: > >>> Does putting an asterisk (*) in the Extensions field for your document >> type not work in the sandbox? >> >> Excellent! Yes it did. > > Umm, why not just use the documented techniqu

Re: opening file without an extension

2012-07-04 Thread Kyle Sluder
On Jul 4, 2012, at 12:54 PM, Charles Srstka wrote: > On Jul 4, 2012, at 2:40 PM, Sean McBride wrote: > >> On Sun, 1 Jul 2012 20:21:39 -0700, Todd Heberlein said: >> Does putting an asterisk (*) in the Extensions field for your document >>> type not work in the sandbox? >>> >>> Excellent!

Re: opening file without an extension

2012-07-04 Thread Sean McBride
On Wed, 4 Jul 2012 14:54:54 -0500, Charles Srstka said: >> Umm, why not just use the documented technique? > >Because that’s exactly what this is? > >http://developer.apple.com/library/mac/#documentation/general/Reference/ >InfoPlistKeyReference/Articles/CoreFoundationKeys.html%23//apple_ref/doc/

Re: opening file without an extension

2012-07-04 Thread Charles Srstka
On Jul 4, 2012, at 3:03 PM, Kyle Sluder wrote: > On Jul 4, 2012, at 12:54 PM, Charles Srstka wrote: > >> On Jul 4, 2012, at 2:40 PM, Sean McBride wrote: >> >>> On Sun, 1 Jul 2012 20:21:39 -0700, Todd Heberlein said: >>> > Does putting an asterisk (*) in the Extensions field for your documen

Re: Adding Properties to NKIssue?

2012-07-04 Thread Dave
On 2 Jul 2012, at 22:27, Nick Zitzmann wrote: On Jul 2, 2012, at 12:31 PM, Dave wrote: Hi, It is possible to add my own properties to the NKIssue Class? I know it's possible in Objective-C but is it advisable? I was thinking of something like this: Yes and It Depends. You can't use @sy

Re: Adding Properties to NKIssue?

2012-07-04 Thread Fritz Anderson
On 4 Jul 2012, at 3:31 PM, Dave wrote: > But where do I store the Dictionary? I can't add an iVar to the NKIssue as > this is not possible in Objective-C AFAIK. Do you really need to extend NKIssue instead of making a class of your own that has an NKIssue and an NSMutableDictionary? —

Re: Stupid block syntax!

2012-07-04 Thread Sean McBride
On Wed, 4 Jul 2012 01:12:12 -0500, Ken Thomases said: >Right, but the elements of the enum are not of type NSComparisonResult. >In traditional C, there's no way to declare the type of elements of an >enum. There's a coming extension to the language in clang that >addresses this.

Re: Adding Properties to NKIssue?

2012-07-04 Thread Dave
Hi, That's more or less what we have at the moment and I think it's just fine and probably better in the long run. However someone else thinks it would be a better idea to do it my extending NKIssue if it is possible, but it seems it's not, since there is no way I can see of actually stor

Re: Stupid block syntax!

2012-07-04 Thread Dave
On 4 Jul 2012, at 07:19, Quincey Morris wrote: On Jul 3, 2012, at 22:40 , Graham Cox wrote: NSComparisonResult (^comp)( id, id ) = ^( id a, id b ) Actually, for a block literal, it's: … = ^NSComparisonResult ( id a, id b ) { … } The literal syntax puts the return type after the [u

Re: Dynamic modification of text search results

2012-07-04 Thread Martin Wierschin
> It turns out to be pretty easy for me to add my 'match' objects to the the > text storages. I just needed to make the match class (TPDocumentMatch) a > subclass of NSTextAttachment. Then once I've collected all my matches for a > given file, I do > > [storage beginEditing]; > for (TPDocumen

Re: Stupid block syntax!

2012-07-04 Thread Charles Srstka
On Jul 4, 2012, at 4:37 PM, Dave wrote: > On 4 Jul 2012, at 07:19, Quincey Morris wrote: > >> On Jul 3, 2012, at 22:40 , Graham Cox wrote: >> >>> NSComparisonResult (^comp)( id, id >>> ) = ^( id a, id b ) >> >> Actually, for a block literal, it's: >> >> … = ^NSComparisonResult ( id a

Re: Binding NSTableView to NSSet

2012-07-04 Thread Koen van der Drift
Ok, I found the solution. I added an NSArrayController to the nib, of which I bound the content set to the NSSet of my model. Then I bound the NSTableView to the NSArrayController, and the views to the various attributes through the objectVAlue. - Koen. On Jul 4, 2012, at 1:46 PM, Koen van d

Crash when calling va_arg()

2012-07-04 Thread Tito Ciuro
Hello, I've hit a wall while experimenting with variadic functions and blocks. The code works pretty well until the second block is executed. After that, it crashes the next time va_arg() gets called. Here's the code: #import typedef id (^fooBlock)(id result, NSError **error); void blockStep(

Re: Crash when calling va_arg()

2012-07-04 Thread Jens Alfke
On Jul 4, 2012, at 4:30 PM, Tito Ciuro wrote: > This allows it to work without crashing, but I'd like if possible to avoid > having to place the sentinel. Any ideas? There's no way around this, other than perhaps passing in the number of variable arguments as an explicit parameter. The C calli

Re: Crash when calling va_arg()

2012-07-04 Thread Fritz Anderson
On 4 Jul 2012, at 6:30 PM, Tito Ciuro wrote: > void blockStep(fooBlock firstBlock, ...) > { >va_list args; >va_start(args, firstBlock); >id result = nil; > >do { >result = firstBlock(result, nil); >NSLog(@"%@", result); >} while (nil != (firstBlock = va_arg(arg

Re: Crash when calling va_arg()

2012-07-04 Thread Tito Ciuro
Hi Fritz and Jens, It makes total sense now. Out of the two options (NULL sentinel vs a number to indicate the number of args), I would choose NULL because out of the two, it's more foolproof. Is there a consensus about which option is considered best practice? Thanks again, -- Tito On Jul 4

Re: Crash when calling va_arg()

2012-07-04 Thread Fritz Anderson
Trust your judgment. It is sound in that sending an explicit parameter count is error-prone, as witness the thousands of crashes that occur every day when developers underrun their format strings. — F On 4 Jul 2012, at 7:34 PM, Tito Ciuro wrote: > It makes total sense now. Out of the t

Re: Crash when calling va_arg()

2012-07-04 Thread Charles Srstka
On Jul 4, 2012, at 7:34 PM, Tito Ciuro wrote: > It makes total sense now. Out of the two options (NULL sentinel vs a number > to indicate the number of args), I would choose NULL because out of the two, > it's more foolproof. Is there a consensus about which option is considered > best practice

Re: Crash when calling va_arg()

2012-07-04 Thread Fritz Anderson
On 4 Jul 2012, at 7:40 PM, Charles Srstka wrote: > Neither method is much foolproof at all — both of them can easily be > undermined by even low-level fools. … as witness the dozens of times a year I crash because I forgot to terminate an +arrayWithObjects: call, or the like. — F

Re: Dynamic modification of text search results

2012-07-04 Thread Ross Carter
On Jul 4, 2012, at 5:43 PM, Martin Wierschin wrote: > > Instead, you'll want to use a custom attribute/name, eg: > >NSString* TPDocumentMatchAttributeName = @"TPDocumentMatchAttribute"; >... >[storage addAttribute:TPDocumentMatchAttributeName value:match > range:match.range]; > R

Re: Stupid block syntax!

2012-07-04 Thread Graham Cox
On 05/07/2012, at 7:53 AM, Charles Srstka wrote: > They did it that way because they were following the C function pointer > syntax, just replacing the * with a ^. Really, the blame for this lies with > Kernighan and Ritchie more than anyone else. I think Apple followed the C > syntax because

Re: Crash when calling va_arg()

2012-07-04 Thread Tito Ciuro
I think it's easier to place a NULL than having to keep track of the number of args. None of them is foolproof, but placing NULL is all it takes to make it work. One could plug the wrong number of args and boum! Forcing to keep the number in sync is an extra step. -- Tito On Jul 4, 2012, at 5:

Re: Crash when calling va_arg()

2012-07-04 Thread rols
I prefer the NULL sentinel too. You might like to check if __attribute__((sentinel(0,1))) added to your function header gets the compiler to warn you if you forget it, very useful that. > Hi Fritz and Jens, > > It makes total sense now. Out of the two options (NULL sentinel vs a > number to indica

Re: Adding Properties to NKIssue?

2012-07-04 Thread Conrad Shultz
On 7/4/12 2:27 PM, Dave wrote: > Hi, > > That's more or less what we have at the moment and I think it's just > fine and probably better in the long run. However someone else thinks it > would be a better idea to do it my extending NKIssue if it is possible, > but it seems it's not, since there is

Re: Adding Properties to NKIssue?

2012-07-04 Thread Charles Srstka
On Jul 4, 2012, at 8:30 PM, Conrad Shultz wrote: > On 7/4/12 2:27 PM, Dave wrote: >> Hi, >> >> That's more or less what we have at the moment and I think it's just >> fine and probably better in the long run. However someone else thinks it >> would be a better idea to do it my extending NKIssue i

Re: Crash when calling va_arg()

2012-07-04 Thread Nathan Day
For function you can write a macro version of your function which calls, you function and appends a NULL to the VA_ARG macro. I don't normally do this but I have done something similar where I wanted macros to add meta data to a class, that expanded out into compete class method implementations.

Re: NSInteger vs int vs int32_t

2012-07-04 Thread Scott Ribe
On Jul 4, 2012, at 9:36 PM, Nathan Day wrote: > If you have an array of 32bit ints on a 64bit machine, are the 32bit ints > expanded into 64bit ints when copied into the cache... No, absolutely not. A cache line maps to a contiguous section of RAM of the same size. To do otherwise would add hug

Re: NSInteger vs int vs int32_t

2012-07-04 Thread Nathan Day
You are saying that the CPU read two 32bit int from the cache at the same time, and then does some bit manipulation to get the high or low 32bit word into a 64bit register. On 03/07/2012, at 11:00 AM, Scott Ribe wrote: > On Jul 2, 2012, at 5:42 PM, David Duncan wrote: > >> I suspect you are b

Re: NSInteger vs int vs int32_t

2012-07-04 Thread Scott Ribe
On Jul 4, 2012, at 11:28 PM, Nathan Day wrote: > You are saying that the CPU read two 32bit int from the cache at the same > time, and then does some bit manipulation to get the high or low 32bit word > into a 64bit register. No, I'm not saying that at all. -- Scott Ribe scott_r...@elevated-d

Re: NSInteger vs int vs int32_t

2012-07-04 Thread Nathan Day
It must if 64bits is read in that mean you have just read in two 32bit words. So to put a 32bit word in a 64bit register some bit must be ditched, in some way, and if the CPU is optimise to only work with 64bit word alignment (don't know how intel does it), then to get 32 bit aligned words it mu