Re: Quickie about constraints

2014-08-16 Thread Charles Srstka
On Aug 16, 2014, at 1:10 AM, Kyle Sluder wrote: > On Aug 15, 2014, at 8:44 PM, Ben Kennedy wrote: >> >>> On 15 Aug 2014, at 8:17 pm, Graham Cox wrote: >>> >>> What I really want is that part of my view hierarchy to be free to use >>> -setFrame:, but other parts use the autolayout constraints

How to convert String.Index to UInt?

2014-08-16 Thread Gerriet M. Denkmann
import Cocoa let s = "hallo\there" let aas = NSMutableAttributedString( string: s, attributes: nil ) let rangeOfTab = s.rangeOfString( "\t" ) if rangeOfTab != nil { let colour = NSColor.grayColor() let locationOfTab = rangeOfTab!.startIndex let aRan

Re: How to convert String.Index to UInt?

2014-08-16 Thread Roland King
You can’t. let s : NSString = "hallo\there" let aas = NSMutableAttributedString( string: s, attributes: nil ) let rangeOfTab = s.rangeOfString( "\t" ) if rangeOfTab.location != NSNotFound {

Re: How to convert String.Index to UInt?

2014-08-16 Thread Stephen J. Butler
Try: import Cocoa let s = "hallo\there" let aas = NSMutableAttributedString(string: s, attributes: nil) if let rangeOfTab = s.rangeOfString( "\t" ) { let colour = NSColor.grayColor() let length = distance(s.startIndex, rangeOfTab.startIndex) let aRange = NSRange(location: 0, length:

Re: How to convert String.Index to UInt?

2014-08-16 Thread Gerriet M. Denkmann
On 16 Aug 2014, at 16:25, Stephen J. Butler wrote: > Try: > > import Cocoa > > let s = "hallo\there" > let aas = NSMutableAttributedString(string: s, attributes: nil) > > if let rangeOfTab = s.rangeOfString( "\t" ) { > let colour = NSColor.grayColor() > let length = distance(s.startIn

Re: How to convert String.Index to UInt?

2014-08-16 Thread Gerriet M. Denkmann
On 16 Aug 2014, at 16:04, Roland King wrote: > You can’t. > > let s : NSString = "hallo\there" > let aas = NSMutableAttributedString( string: s, attributes: nil > ) > > let rangeOfTab = s.rangeOfString( "\t" ) > if rangeOfTab.location

Creating pdf document

2014-08-16 Thread Jean Suisse
Dear All, I have a goods management cocoa application which needs to generate pdf documents. It isn’t a document-based app, it doesn’t use core data and the data that should be printed are not laid out in any of the views displayed to the user. In short, I would need to generate a pdf document

Re: How to convert String.Index to UInt?

2014-08-16 Thread Gerriet M. Denkmann
On 16 Aug 2014, at 16:25, Stephen J. Butler wrote: > Try: > > import Cocoa > > let s = "hallo\there" > let aas = NSMutableAttributedString(string: s, attributes: nil) > > if let rangeOfTab = s.rangeOfString( "\t" ) { > let colour = NSColor.grayColor() > let length = distance(s.startIn

Class in Swift

2014-08-16 Thread Gerriet M. Denkmann
How to translate into Swift: - (void)myFunctionWithClass: (Class)someClass { for(...) { p = ... if ( p is not special ) continue; id aClass = [[ someClass alloc] initWithParameter: p ]; ... do something with aClass

Re: How to convert String.Index to UInt?

2014-08-16 Thread Roland King
> Well... > > First: I think Swift is going to be the future, so I might as well start > learning it now. I thought that too, then dropped back a bit until the full spec for 1.0 is there at least so the moving target doesn’t move as fast. It’s the future absolutely, think it’s got a couple of

Re: Creating pdf document

2014-08-16 Thread Jonathan Mitchell
On 16 Aug 2014, at 11:18, Jean Suisse wrote: > Dear All, > > I have a goods management cocoa application which needs to generate pdf > documents. It isn’t a document-based app, it doesn’t use core data and the > data that should be printed are not laid out in any of the views displayed to >

Re: Creating pdf document

2014-08-16 Thread edward taffel
a cocoa solution may yet be forthcoming, but—if you enjoy pdf, qua pdf, i should investigate CGPDFContextCreate. regards, edaward On Aug 16, 2014, at 6:18 AM, Jean Suisse wrote: > Dear All, > > I have a goods management cocoa application which needs to generate pdf > documents. It isn’t a d

Re: NSTableRowView appearance when group rows float - SOLVED

2014-08-16 Thread Bill Cheeseman
On Aug 10, 2014, at 4:54 PM, Bill Cheeseman wrote: > My application has a source list using a view-based NSOutlineView. My code > does nothing to dictate the initial or subsequent appearance of the group > rows other than to implement the -outlineView:isGroupRow: delegate method to > identify

Re: Creating pdf document

2014-08-16 Thread Jean Suisse
Thank you Jonathan Mitchell, Edward Taffel, and Joel Norvell for your replies. I asked the question before catching a train, hoping to have some thoughts to read when arriving home. However, during the 3.5 hour-long journey, I had some time to think about it and found a simple solution: I reali

Re: Class in Swift

2014-08-16 Thread Charles Srstka
On Aug 16, 2014, at 6:32 AM, Gerriet M. Denkmann wrote: > How to translate into Swift: > > - (void)myFunctionWithClass: (Class)someClass > { > for(...) > { > p = ... > if ( p is not special ) continue; > > id aClass = [[ someClass alloc] in

Re: Class in Swift

2014-08-16 Thread Stephen J. Butler
I'm still learning Swift, but extrapolating from what I might do in Python or Ruby... protocol MyProtocol { ... } func myFunction(generator: (MyParameterType) -> MyProtocol) { for ... { let p : MyParameterType = ... if not p special { continue } let obj = generator(p) ... } }

Re: Class in Swift

2014-08-16 Thread Quincey Morris
On Aug 16, 2014, at 13:53 , Charles Srstka wrote: > You can't. Er, am I missing something, or is this not a case that generic functions handle quite easily? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or

Re: Class in Swift

2014-08-16 Thread Marco S Hyman
On Aug 16, 2014, at 2:13 PM, Quincey Morris wrote: > Er, am I missing something, or is this not a case that generic functions > handle quite easily? That's what I thought, too. protocol MyProtocol { init() // ... } func myFunction() { // for(...) { // p = ... //

Preventing textfield in table from clicking default button

2014-08-16 Thread Seth Willits
When editing in a NSTextField and return is pressed, it fires the text field's action and also sends performKeyEquivalent: to the window, which clicks the default button. Usually that's just fine, but in the case where a view-based table view has editable NSTextFields in it, this makes no sens

Re: Preventing textfield in table from clicking default button

2014-08-16 Thread Seth Willits
On Aug 16, 2014, at 7:53 PM, Seth Willits wrote: > This is leaving me little choice but to do something very specialized and > ugly. Well… the simplest solution is to just disable the key equivalent myself instead of using NSWindow's methods. I don't like it, but it does work in my case...

Re: Preventing textfield in table from clicking default button

2014-08-16 Thread Ken Thomases
On Aug 16, 2014, at 9:53 PM, Seth Willits wrote: > When editing in a NSTextField and return is pressed, it fires the text > field's action and also sends performKeyEquivalent: to the window, which > clicks the default button. Usually that's just fine, but in the case where a > view-based table