Hi, Looking at the CGWindowLevel.h header of the CoreGraphics framework:
enum { kCGBaseWindowLevelKey = 0, ... kCGDesktopIconWindowLevelKey, ... #define kCGDesktopIconWindowLevel \ CGWindowLevelForKey(kCGDesktopIconWindowLevelKey) $ ./miniruby -e "framework 'Cocoa'; p KCGDesktopIconWindowLevel" /Users/lrz/src/macruby-trunk/-e:1:in `<main>': uninitialized constant KCGDesktopIconWindowLevel (NameError) $ ./miniruby -e "framework 'Cocoa'; p KCGDesktopIconWindowLevelKey" 18 It looks like the bridge support generator was not able to handle this #define notation. If you file a bug using http://bugreport.apple.com we can try to address this problem in a next version of Mac OS X. In the meantime, a workaround is to use CGWindowLevelForKey(KCGDesktopIconWindowLevelKey) as you already figured out :-) HTH, Laurent On Apr 24, 2010, at 3:51 AM, Michel Steuwer wrote: > Hi, > > I didn't find out how to use the kCGDesktopWindowLevel directly, but you can > use the kCGDesktopWindowLevelKey constant if you use a capital K at the > beginning. > So the call: > > window.setLevel(CGWindowLevelForKey(KCGDesktopWindowLevelKey)) > > works. > > I looked at the CoreGraphics.bridgesupport in > /System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreGraphics.framework/Resources/BridgeSupport > and it only provides the constant kCGDesktopWindowLevelKey not > kCGDesktopWindowLevel. > > Thanks for the quick respond. > > Michel > >> I've not been able to generate a Bridge Support file for the >> AppKit.framework on my machine, but if you can then you can load the >> framework and then load the bridge support file and you should get access to >> those constants, I believe the k changes to K though. >> >> The alternative would be to define those constants in a .rb file which you >> then require into your script. >> >> Geoff >> >> On 24 Apr 2010, at 11:09, robert gleeson wrote: >> >>> Hey, >>> >>> In Ruby, constants are identified by a capital letter at the beginning of >>> its name, and that is why a NameError exception is raised. >>> If this Objective-C constant is available to you, I don't think it would be >>> available as a local variable in MacRuby. >>> >>> Maybe MacRuby encapsulates this data in a class somewhere - I have no idea >>> - Sorry :-) >>> >>> Thanks, >>> Rob >>> >>> On 24 Apr 2010, at 11:01, Michel Steuwer wrote: >>> >>>> Hello everybody, >>>> >>>> i'm new to MacRuby and currently trying my first Project. >>>> >>>> I try to draw a NSPanel at the desktop window level. >>>> Therefore, i would use the [window setLevel:kCGDesktopIconWindowLevel] >>>> method in Objective-C. >>>> In MacRuby the call window.setLevel(kCGDesktopIconWindowLevel) doesn't >>>> work and produces the following log message: >>>> >>>> undefined local variable or method `kCGDesktopIconWindowLevel' for >>>> #<PanelController:0x2002f1ac0> >>>> >>>> Currently i have solved the Problem by using this work-around: >>>> window.setLevel(CGWindowLevelForKey(2)) >>>> >>>> Why can't i use the call with the pre defined constant as i would in >>>> Objective-C ? >>>> >>>> Thanks, >>>> Michel >>>> >>>> -- >>>> Michel Steuwer | michel.steu...@onlinehome.de >>>> >>>> _______________________________________________ >>>> 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 > > > > -- > Michel Steuwer | michel.steu...@onlinehome.de > > _______________________________________________ > 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