From: Satoshi N. <sna...@in...> - 2008-01-10 18:47:36
|
Hi, If you try "p objc", you will see it's an ObjcPtr object. #<OSX::ObjcPtr:0x50310d8 cptr=0xbfffafdc allocated_size=0 encoding=@> You can deal with pointer arguments through the ObjcPtr class. Actually I wrote a custom NSFormatter as follows: class SingleLineFormatter < NSFormatter def stringForObjectValue(str) str.to_s.gsub(/\r\n|\r|\n/, ' ') end def getObjectValue_forString_errorDescription(objp, str, err) s = str.to_s.gsub(/\r\n|\r|\n/, ' ') objp.assign(s.to_ns) true end def isPartialStringValid_newEditingString_errorDescription(str, strp, err) s = str.to_s return true unless s =~ /\r\n|\r|\n/ s = s.gsub(/\r\n|\r|\n/, ' ') strp.assign(s.to_ns) false end end -- Satoshi Nakagawa On 2008/01/11, at 2:33, Antonin Amand wrote: > Hey, > > I'm trying to subclass NSFormatter but I don't know how to override > getObjectValue_forString_errorDescription > because it has pointer arguments. > > Is there a way to do this or do I have to do Objective-C. > > Thanks. > > Antonin. |