[MacRuby-devel] NSPoint and CGPoint issue

david kramf dakr.012 at gmail.com
Sun Dec 9 08:41:04 PST 2012

I am trying to create an NSPoint object so I can call setFrameOrigin but I get in response a CGPoint object . When I pass the CGPoint to setFrameOrigin , it crashes. How do I make NSMakePoint making an NSPoint object and not a CGPoint object.
Thank you for  your help, 
David Kramf

 def  initLabel(h)
        @label = NSTextField.alloc.initWithFrame(CGRectMake(0,0,250, 45))
        @label.drawsBackground = false
        @label.bezeled = false
        @label.font = NSFont.fontWithName("Arial", size:45.0)
        @label.editable = false
        puts "class of label is #{@label.class}"
        width = (@window.contentView.frameSize.width/2.0)-(@label.frameSize.width/2.0)
        height = (@window.contentView.frameSize.height/2.0)-(@label.frameSize.height/2.0)
        puts "width is #{width} heght is #{height}"
        origin = NSMakePoint(width,height)
        puts "class of origin is #{origin.class}"

class of label is NSTextField
width is 75.0 heght is 77.5
class of origin is CGPoint
2012-12-09 18:33:13.525 two[3836:503] /Users/davidkramf/Library/Developer/Xcode/DerivedData/two-gdovgltwrnzjfbfpizcbgrudvizf/Build/Products/Debug/two.app/Contents/Resources/MyController.rb:34:in `initLabel': undefined method `￯﾿ᄐ￯﾿ᄐ' for #<MyController:0x4011a6080> (NoMethodError)
	from /Users/davidkramf/Library/Developer/Xcode/DerivedData/two-gdovgltwrnzjfbfpizcbgrudvizf/Build/Products/Debug/two.app/Contents/Resources/MyController.rb:15:in `initialize'
	from /Users/davidkramf/Library/Developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20121209/871f72ab/attachment.html>

More information about the MacRuby-devel mailing list