Hi, I trying to listen to events by mouseMoved using a NSTrackingArea as the cocoa docs suggest but I can't get it working in MacRuby. This is my simplified view i want to add the tracking zone but I'm getting: undefined method `initWithRect' for #<NSTrackingArea:0x200bfa3c0> (NoMethodError) class TowerView < NSView def awakeFromNib tracking_area = NSTrackingArea.alloc.initWithRect self.bounds self.addTrackingArea tracking_area tracking_area.initWithRect self.bounds end end Any hint for me, or is it missing in one of those bridge files? -- Thomas R. "TomK32" Koll http://ananasblau.com
Hi, http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/NSTrac... Looks like the initializer is: – initWithRect:options:owner:userInfo: Try something like: tc = NSTrackingArea.alloc.initWithRect(self.bounds, options:(NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways), owner:self, userInfo:nil) hth k On Apr 27, 2011, at 8:39 AM, Thomas R. Koll wrote:
tracking_area.initWithRect
Nope, still no good. Am 27.04.2011 um 18:07 schrieb Kam Dahlin:
Hi,
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/NSTrac...
Looks like the initializer is:
– initWithRect:options:owner:userInfo:
Try something like:
tc = NSTrackingArea.alloc.initWithRect(self.bounds, options:(NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways), owner:self, userInfo:nil)
-- Thomas R. "TomK32" Koll, Ruby/Rails freelancer http://ananasblau.com | http://github.com/TomK32
Thomas, Are you still getting an undefined method error, or something new? Do you have a "framework 'Cocoa'" line somewhere in your app? - Josh On Wed, Apr 27, 2011 at 12:10 PM, Thomas R. Koll <info@ananasblau.com>wrote:
Nope, still no good.
Am 27.04.2011 um 18:07 schrieb Kam Dahlin:
Hi,
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/NSTrac...
Looks like the initializer is:
– initWithRect:options:owner:userInfo:
Try something like:
tc = NSTrackingArea.alloc.initWithRect(self.bounds,
options:(NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways), owner:self, userInfo:nil)
-- Thomas R. "TomK32" Koll, Ruby/Rails freelancer http://ananasblau.com | http://github.com/TomK32
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
It's still the same and of course I have the cocoa framework loaded otherwise it wouldn't find the NSTrackingArea class. Am 27.04.2011 um 18:49 schrieb Joshua Ballanco:
Thomas,
Are you still getting an undefined method error, or something new? Do you have a "framework 'Cocoa'" line somewhere in your app?
- Josh
On Wed, Apr 27, 2011 at 12:10 PM, Thomas R. Koll <info@ananasblau.com> wrote:
Nope, still no good.
Am 27.04.2011 um 18:07 schrieb Kam Dahlin:
Hi,
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/NSTrac...
Looks like the initializer is:
– initWithRect:options:owner:userInfo:
Try something like:
tc = NSTrackingArea.alloc.initWithRect(self.bounds, options:(NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways), owner:self, userInfo:nil)
-- Thomas R. "TomK32" Koll, Ruby/Rails freelancer http://ananasblau.com | http://github.com/TomK32
_______________________________________________ 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
-- Thomas R. "TomK32" Koll, Ruby/Rails freelancer http://ananasblau.com | http://github.com/TomK32
Looking at the sample you pasted: class TowerView < NSView def awakeFromNib tracking_area = NSTrackingArea.alloc.initWithRect self.bounds self.addTrackingArea tracking_area tracking_area.initWithRect self.bounds # <- ??? end end Why the extra call to -initWithRect on the instance of NSTrackingArea? k On Apr 27, 2011, at 9:55 AM, Thomas R. Koll wrote:
It's still the same and of course I have the cocoa framework loaded otherwise it wouldn't find the NSTrackingArea class.
Am 27.04.2011 um 18:49 schrieb Joshua Ballanco:
Thomas,
Are you still getting an undefined method error, or something new? Do you have a "framework 'Cocoa'" line somewhere in your app?
- Josh
On Wed, Apr 27, 2011 at 12:10 PM, Thomas R. Koll <info@ananasblau.com> wrote:
Nope, still no good.
Am 27.04.2011 um 18:07 schrieb Kam Dahlin:
Hi,
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/NSTrac...
Looks like the initializer is:
– initWithRect:options:owner:userInfo:
Try something like:
tc = NSTrackingArea.alloc.initWithRect(self.bounds, options:(NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways), owner:self, userInfo:nil)
-- Thomas R. "TomK32" Koll, Ruby/Rails freelancer http://ananasblau.com | http://github.com/TomK32
_______________________________________________ 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
-- Thomas R. "TomK32" Koll, Ruby/Rails freelancer http://ananasblau.com | http://github.com/TomK32
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
participants (3)
-
Joshua Ballanco
-
Kam Dahlin
-
Thomas R. Koll