From: Jonathan P. <jp...@dc...> - 2005-04-17 11:18:37
|
On 17 Apr 2005, at 11:58, Remo Eichenberger wrote: > require 'osx/cocoa' > include OSX > > NSRunLoop.currentRunLoop.addTimer(timer, NSEventTrackingRunLoopMode) > > But "NSEventTrackingRunLoopMode" is not in the symboltable of Ruby. i > found this in the file: "NSApplication.h" as following: > > APPKIT_EXTERN NSString *NSEventTrackingRunLoopMode; Because NSEventTrackingRunLoopMode isn't a compile-time constant, RubyCocoa implements it as a method (rather than a Ruby constant) on module OSX which can look it up when necessary. This is confusing in Ruby because symbols with initial capital letters are treated as constants. So, your code above ends up looking for OSX::NSEventTrackingRunLoopMode but, because it's a method and not a constant, you must explicitly use: OSX.NSEventTrackingRunLoopMode I hope that makes sense. |