Last active
November 23, 2017 02:51
-
-
Save RyanScottLewis/2fbcf4cf695d654ea43c0cbe4764b4d7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "hoop" | |
include Hoop | |
WINDOW_WIDTH = 700 | |
WINDOW_HEIGHT = 700 | |
NSAutoreleasePool.new | |
NSApp.activation_policy = LibAppKit::NSApplicationActivationPolicy::Regular | |
window = NSWindow.new( | |
NSRect.new(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT).to_objc, | |
LibAppKit::NSWindowMask::Titled | | |
LibAppKit::NSWindowMask::Closable | | |
LibAppKit::NSWindowMask::Miniaturizable | | |
LibAppKit::NSWindowMask::Resizable, | |
LibAppKit::NSBackingStoreType::Buffered, | |
false | |
) | |
# window.set_background_color = NSColor.white_color.to_objc | |
window.cascade_top_left_from_point NSPoint.new(20, 20).to_objc | |
window.title = "NSRect Test".to_objc | |
window.make_key_and_order_front(nil.to_objc) | |
# NOTE: Error occurs here, cannot retrieve view's frame NSRect | |
p window.content_view.frame | |
NSApp.activate_ignoring_other_apps = true | |
NSApp.run | |
# Error: | |
# Error in src/hooptest.cr:162: instantiating 'Hoop::NSView#frame()' | |
# | |
# p window.content_view.frame | |
# ^~~~~ | |
# | |
# in macro 'method' /Volumes/Media/Self/Science/Technology/Software/Languages/Crystal/Projects/cr-gtk/lib/hoop/src/foundation/nsobject.cr:101, line 2: | |
# | |
# 1. | |
# > 2. objc_method_helper(self.to_objc, "frame", nil, "NSRect", "frame") | |
# 3. | |
# 4. | |
# | |
# expanding macro | |
# in macro 'objc_method_helper' /Volumes/Media/Self/Science/Technology/Software/Languages/Crystal/Projects/cr-gtk/lib/hoop/src/foundation/nsobject.cr:39, line 10: | |
# | |
# 1. #"frame" | |
# 2. #[] | |
# 3. def frame() | |
# 4. | |
# 5. res = Hoop.send_msg(self.to_objc, "frame" | |
# 6. | |
# 7. ) | |
# 8. | |
# 9. | |
# > 10. NSRect.new(res) | |
# 11. | |
# 12. end | |
# 13. | |
# | |
# wrong number of arguments for 'Hoop::NSRect.new' (given 1, expected 4) | |
# Overloads are: | |
# - Hoop::NSRect.new(x, y, w, h) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment