Thanks Laurent - it works! Bob Rice
On May 23, 2010, at 1:36 AM, Laurent Sansonetti wrote: > Hi Robert, > > Can you try: > > def knowsPageRange(range_ptr) > range_ptr[0] = NSMakeRange(1, 1) > true > end > > This method is called with a pointer to an NSRange structure and you're > supposed to set it to something in case you return true. In C, it would have > been: > > *range_ptr = NSMakeRange(1, 1) > > Doing range[0].location=1 would do in C: > > (*range_ptr).location = 1; > > Which isn't what you want. > > I don't know why range.location=1 was working in earlier versions of MacRuby. > It should really be a Pointer object. > > Laurent > > On May 22, 2010, at 9:50 PM, Robert Rice wrote: > >> I'm have some trouble understanding the new Pointer class. In older versions >> of MacRuby I used: >> >> def knowsPageRange( range ) # Override pagination. Image my clip on >> some printers >> # The range is passed by reference. >> range.location = 1 # first page number >> range.length = 1 >> true >> end >> >> MacRuby 0.6 gives me undefined method location= for the Pointer class. >> Adding an index eliminates the error but then my printing doesn't stop at >> one page: >> >> def knowsPageRange( range ) # Override pagination. Image my clip on >> some printers >> # The range is passed by reference. >> range[0].location = 1 # first page number >> range[0].length = 1 >> true >> end >> >> How can I fix this? >> Thanks, >> Bob Rice >> >> _______________________________________________ >> MacRuby-devel mailing list >> MacRuby-devel@lists.macosforge.org >> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel > > _______________________________________________ > MacRuby-devel mailing list > MacRuby-devel@lists.macosforge.org > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel > _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel