macruby

MacRuby, error when using Sequel

吃可爱长大的小学妹 提交于 2019-12-02 03:54:24
I have just installed Sequel using the command sudo macgem install sequel . It tells me sequel-3.18.0 was successfully installed. When I fire up xcode, and start a new MacRuby application, it sets up a target for unit tests. I have modified stub_test.rb with the following two lines: require "rubygems" require "sequel" When trying to run the unit tests, I get the following error: /Users/.../macRuby Test/Tests/run_suite.rb:1:in `<main>': super: no superclass method `require' for Sequel:Class (NoMethodError) Without the two require statements, the tests run fine. I have tried to google this, and

Interface Builder not Seeing Outlets with MacRuby

拈花ヽ惹草 提交于 2019-12-01 01:12:19
问题 I am trying to get a basic hello world application going using XCode and Interface Builder. However, in Interface Builder I can't see my outlets to wire things up with. I go to the connections tab of the objects inspector pane and it says "New Referencing Outlet". I am wondering if my code is wrong. Here it is class HelloWorldController attr_accessor :hello_label, :hello_button, :hello def awakeFromNib @hello = true end def changeLabel(sender) if @hello @hello_label.stringValue = "Good Bye"

Getting source HTML from a WebView in Cocoa

穿精又带淫゛_ 提交于 2019-11-30 09:36:49
I'm working on a OS X program where the user does some light WYSIWYG HTML editing in a WebView. Being new to programming with Cocoa and WebKit, I have absolutely no idea how to get selected text from a WebView - the intention being to take what the user selected, add HTML code (like div's or span's) around the text, and replace the selected text with the modified code. How can this be accomplished? I'm currently programming this project with MacRuby, but I'd appreciate help from Objective-C programmers as well. Thank you! You can ask for the WebView 's -selectedDOMRange and you'll get a

Getting the main window of an app via an NSRunningApplication instance

天涯浪子 提交于 2019-11-28 12:23:28
I'm observing NSWorkspaceDidDeactivateApplicationNotification notification to get the application that has just lost focus. I'm ending up with an instance of NSRunningApplication which you get from the userInfo dictionary key - NSWorkspaceApplicationKey - of the notification object. I was thinking that I'd be able to get the main window from the app from the notification but I'm not sure where to go from here as NSRunningApplication seems to pretty limited. Any help would be appreciated. BTW - I'm using MacRuby but the answer doesn't need to be in MacRuby. Thanks Chuck Apple has traditionally

Getting the main window of an app via an NSRunningApplication instance

。_饼干妹妹 提交于 2019-11-27 06:57:14
问题 I'm observing NSWorkspaceDidDeactivateApplicationNotification notification to get the application that has just lost focus. I'm ending up with an instance of NSRunningApplication which you get from the userInfo dictionary key - NSWorkspaceApplicationKey - of the notification object. I was thinking that I'd be able to get the main window from the app from the notification but I'm not sure where to go from here as NSRunningApplication seems to pretty limited. Any help would be appreciated. BTW