Re: NSAttributedString in table data cells
--- Fred Kiefer <[EMAIL PROTECTED]> wrote: > Sao Kiselkov wrote: > > Quoting Fred Kiefer <[EMAIL PROTECTED]>: > > > >> > >>Sa?o Kiselkov wrote: > >>>I found that when my code returns an > NSAttributedString as the value for a > >>table > >>>data cell it doesn't display it as an attributed > string, but instead by > >>sending > >>>it "description" (which obviously isn't right, is > it?). The problem is in > >>the > >>>code of NSCell's "-setObjectValue:" which doesn't > know about attributed > >>>strings. I'd recommend adding a test case there > which, if passed an > >>>NSAttributedString, invokes [self > setAttributedStringValue: object];. > >>> > >>is this the behaviour on Cocoa? The change you > suggest seems sensible to > >>me (and rather simple to implement), but I would > like to be sure we do > >>the same as Apple here. > >> > > > > Even if it didn't exist in Cocoa, it isn't an > incompatible change where we would > > solve a particular problem in an incompatible way > - we'd simply extend the basic > > concept to be more intelligent and behave more as > people would expect it - to be > > able to use attributed and nonattributed strings > interchangeably in controls. > > The only difference for an app programmer would > be: "this one's a plain string > > and this one's a fancy string". > > > Not sure, if I agree to that. The new behaviour may > seem sensible to you > and me, but others may rely on the Cocoa behaviour. > As soon as I can get > hold of Mac, I will try to found out, how it behaves > here. i believe this has been discussed multiple times in the past.. GNUstep complies with the documented behaviour it seems that while mac osx may comply with the documented behaviour, it has some sort of magic default formatters to format everything (i don't quite understand this since formatters work with strings and not objects)... anyhow IMHO the documentation of the implementation isn't as important what the developer can expect to happen/be returned when calling a method, and in that regard their documentation *was* broken last time i looked at it at least. i can't actually figure out how to make -hasValidObjectValue return NO on a mac :) so this issue doesn't seem to be limited to attributed strings... attached test program, and below is output... matt (make -f Makefile on a mac) GNUstep: 2005-07-21 18:37:02.000 cellTest[11056] -objectValue=(nil) KindOf=(nil) formatter=(nil) hasValidObjectValue=NO 2005-07-21 18:37:02.000 cellTest[11056] NSAnyType 2005-07-21 18:37:02.000 cellTest[11056] -objectValue=(nil) KindOf=(nil) formatter=(nil) hasValidObjectValue=NO 2005-07-21 18:37:02.000 cellTest[11056] NSAnyType 2005-07-21 18:37:02.000 cellTest[11056] -objectValue=(nil) KindOf=(nil) formatter=(nil) hasValidObjectValue=NO 2005-07-21 18:37:02.000 cellTest[11056] NSAnyType 2005-07-21 18:37:02.000 cellTest[11056] 23 23.50 23.50 2005-07-21 18:37:02.000 cellTest[11056] -objectValue=(nil) KindOf=(nil) formatter=(nil) hasValidObjectValue=NO 2005-07-21 18:37:02.000 cellTest[11056] NSAnyType 2005-07-21 18:37:02.000 cellTest[11056] -objectValue=(nil) KindOf=(nil) formatter=(nil) hasValidObjectValue=NO 2005-07-21 18:37:02.000 cellTest[11056] NSAnyType Mac: 2005-07-21 18:21:35.390 cellTest[4791] -objectValue=55 KindOf=NSCFNumber formatter=(null) hasValidObjectValue=YES 2005-07-21 18:21:35.391 cellTest[4791] NSAnyType 2005-07-21 18:21:35.392 cellTest[4791] -objectValue= KindOf=Foo formatter=(null) hasValidObjectValue=YES 2005-07-21 18:21:35.393 cellTest[4791] NSAnyType 2005-07-21 18:21:35.394 cellTest[4791] -objectValue=23.5 KindOf=NSCFNumber formatter=(null) hasValidObjectValue=YES 2005-07-21 18:21:35.395 cellTest[4791] NSAnyType 2005-07-21 18:21:35.396 cellTest[4791] 23 23.50 23.50 2005-07-21 18:21:35.398 cellTest[4791] -objectValue=zxcv{} KindOf=NSConcreteAttributedString formatter=(null) hasValidObjectValue=YES 2005-07-21 18:21:35.399 cellTest[4791] NSAnyType 2005-07-21 18:21:35.400 cellTest[4791] -objectValue=(null) KindOf=(null) formatter=(null) hasValidObjectValue=YES Start your day with Yahoo! - make it your home page http://www.yahoo.com/r/hs cellTest.tar.gz Description: 2877085026-cellTest.tar.gz ___ Bug-gnustep mailing list Bug-gnustep@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnustep
Re: NSAttributedString in table data cells
Sašo Kiselkov wrote: > Quoting Fred Kiefer <[EMAIL PROTECTED]>: > >> >>Sa�o Kiselkov wrote: >>>I found that when my code returns an NSAttributedString as the value for a >>table >>>data cell it doesn't display it as an attributed string, but instead by >>sending >>>it "description" (which obviously isn't right, is it?). The problem is in >>the >>>code of NSCell's "-setObjectValue:" which doesn't know about attributed >>>strings. I'd recommend adding a test case there which, if passed an >>>NSAttributedString, invokes [self setAttributedStringValue: object];. >>> >>is this the behaviour on Cocoa? The change you suggest seems sensible to >>me (and rather simple to implement), but I would like to be sure we do >>the same as Apple here. >> > > Even if it didn't exist in Cocoa, it isn't an incompatible change where we > would > solve a particular problem in an incompatible way - we'd simply extend the > basic > concept to be more intelligent and behave more as people would expect it - to > be > able to use attributed and nonattributed strings interchangeably in controls. > The only difference for an app programmer would be: "this one's a plain string > and this one's a fancy string". > Not sure, if I agree to that. The new behaviour may seem sensible to you and me, but others may rely on the Cocoa behaviour. As soon as I can get hold of Mac, I will try to found out, how it behaves here. Fred ___ Bug-gnustep mailing list Bug-gnustep@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnustep
Re: NSAttributedString in table data cells
Quoting Fred Kiefer <[EMAIL PROTECTED]>: > Hi Saso, > > Sa�o Kiselkov wrote: > > I found that when my code returns an NSAttributedString as the value for a > table > > data cell it doesn't display it as an attributed string, but instead by > sending > > it "description" (which obviously isn't right, is it?). The problem is in > the > > code of NSCell's "-setObjectValue:" which doesn't know about attributed > > strings. I'd recommend adding a test case there which, if passed an > > NSAttributedString, invokes [self setAttributedStringValue: object];. > > > > is this the behaviour on Cocoa? The change you suggest seems sensible to > me (and rather simple to implement), but I would like to be sure we do > the same as Apple here. > > Fred > Even if it didn't exist in Cocoa, it isn't an incompatible change where we would solve a particular problem in an incompatible way - we'd simply extend the basic concept to be more intelligent and behave more as people would expect it - to be able to use attributed and nonattributed strings interchangeably in controls. The only difference for an app programmer would be: "this one's a plain string and this one's a fancy string". I've attached a patch to NSCell.m (diff'ed against the latest CVS version) which should do it. Regards Saso NSCell.patch Description: Binary data ___ Bug-gnustep mailing list Bug-gnustep@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnustep
Re: NSAttributedString in table data cells
Hi Saso, Sašo Kiselkov wrote: > I found that when my code returns an NSAttributedString as the value for a > table > data cell it doesn't display it as an attributed string, but instead by > sending > it "description" (which obviously isn't right, is it?). The problem is in the > code of NSCell's "-setObjectValue:" which doesn't know about attributed > strings. I'd recommend adding a test case there which, if passed an > NSAttributedString, invokes [self setAttributedStringValue: object];. > is this the behaviour on Cocoa? The change you suggest seems sensible to me (and rather simple to implement), but I would like to be sure we do the same as Apple here. Fred ___ Bug-gnustep mailing list Bug-gnustep@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnustep
NSAttributedString in table data cells
I found that when my code returns an NSAttributedString as the value for a table data cell it doesn't display it as an attributed string, but instead by sending it "description" (which obviously isn't right, is it?). The problem is in the code of NSCell's "-setObjectValue:" which doesn't know about attributed strings. I'd recommend adding a test case there which, if passed an NSAttributedString, invokes [self setAttributedStringValue: object];. Regards Saso ___ Bug-gnustep mailing list Bug-gnustep@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnustep