Calling OSX API similar to calling Win32 API?

Discussion in 'Ruby' started by Thomas Thomassen, Dec 28, 2010.

  1. I'm writing plugins for Google SketchUp using its Ruby API. I want to
    manipulate some windows from my script and under Windows I have this
    working by using the Win32 API.

    But how can one do this under OSX?

    Example: get the handle for a window and change its frame style.

    --
    Posted via http://www.ruby-forum.com/.
    Thomas Thomassen, Dec 28, 2010
    #1
    1. Advertising

  2. On Dec 28, 10:42 am, Thomas Thomassen <> wrote:
    > I'm writing plugins for Google SketchUp using its Ruby API. I want to
    > manipulate some windows from my script and under Windows I have this
    > working by using the Win32 API.
    >
    > But how can one do this under OSX?


    I've never used SketchUp, but I thought this was abstracted through
    their API (just curious)? Are these non-SketchUp windows of native
    applications?

    This sounds like it could be solved by the AbstractFactory pattern:
    http://en.wikipedia.org/wiki/Abstract_factory_pattern
    though I can't say if it's the right approach without more info.

    class OSXWindow
    def title
    #OSX native stuff
    end
    end

    # class Win32Window...

    class Window
    def initialize
    case PLATFORM #is there an arch-less variable for this?
    when /darwin/
    OSXWindow.new
    when /win32/
    Win32Window.new
    else
    raise "#{PLATFORM} is not supported"
    end
    end

    w = Window.new

    -Skye
    Skye Shaw!@#$, Dec 28, 2010
    #2
    1. Advertising

  3. With the SketchUp Ruby API one can create your own custom windows -
    called WebDialogs - which is simply a window with an embedded browser
    control where you create your UI in HTML+JS+CSS.

    The only control one has over these windows via the API is this:
    http://code.google.com/apis/sketchup/docs/ourdoc/webdialog.html

    It does not allow you to change the window style. But I wanted to make
    toolwindows and that I managed to do under Windows by using the Win32
    API thanks to Ruby's Win32 module. (I send my own SetWindowLong message
    after sniffing out the window's handle.)

    So what I'm trying to do is modify windows which hasn't been created
    directly by me.

    --
    Posted via http://www.ruby-forum.com/.
    Thomas Thomassen, Dec 29, 2010
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex Lyman
    Replies:
    0
    Views:
    662
    Alex Lyman
    Mar 7, 2004
  2. Praveen, Tayal (IE10)
    Replies:
    0
    Views:
    361
    Praveen, Tayal (IE10)
    Mar 17, 2005
  3. Java and Swing
    Replies:
    1
    Views:
    659
    Chris Lambacher
    Oct 24, 2005
  4. Tim Golden
    Replies:
    0
    Views:
    428
    Tim Golden
    Oct 21, 2005
  5. rcmn
    Replies:
    1
    Views:
    328
    =?ISO-8859-1?Q?Michael_Str=F6der?=
    Nov 6, 2006
Loading...

Share This Page