I'm too lazy to type in the whole example from the Hillegass text.  But just looking at the implementation of the "cast_as" method, I would suggest that you try :

    partial = partPtr.cast_as('^@'

Let us know if that helps....


Le 7 mars 10 à 09:38, Wolfgang Kittenberger a écrit :

Hi folks,

  has anybody implemented the Hillegass example regarding NSFormatter (chapter 26 in the 3rd edition of "Cocoa Programming for MAC OS X") in rubycocoa?

  I failed to transcript the isPartialStringValid:proposedSelectedRange:originalString:originalSelectedRange:errorDescription: method on the pages 336+337: 

def isPartialStringValid_proposedSelectedRange_originalString_originalSelectedRange_errorDescription(partPtr, selPtr, origString, origSel, error_ptr)
    NSLog("partPtr.class = #{partPtr.class}")
    NSLog("partPtr.inspect = #{partPtr.inspect}")
    partial = partPtr.cast_as('@')
    NSLog("partial.class = #{partial.class}")

 I started with some test-printout, but when entering the cast statement, it blows up! here is the correspondig console output:

2010-03-07 09:27:38.170 TypingTutor[6519:a0f] partPtr.class = OSX::ObjcPtr
2010-03-07 09:27:38.171 TypingTutor[6519:a0f] partPtr.inspect = #<OSX::ObjcPtr:0x29f036 cptr=0xbfffd4dc allocated_size=0 encoding=@>
Program received signal:  “EXC_BAD_ACCESS”.
sharedlibrary apply-load-rules all

any ideas?

best regards

Wolfgang Kittenberger
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
Rubycocoa-talk mailing list