[MacRuby] #1002: AXUIElement functions won't accept Pointers of type :id
MacRuby
ruby-noreply at macosforge.org
Mon Nov 29 18:04:52 PST 2010
#1002: AXUIElement functions won't accept Pointers of type :id
---------------------------+------------------------------------------------
Reporter: haxie1@… | Owner: lsansonetti@…
Type: defect | Status: new
Priority: blocker | Milestone: MacRuby 0.8
Component: MacRuby | Keywords:
---------------------------+------------------------------------------------
Comment(by lsansonetti@…):
MacRuby will not let you create a void pointer, but it will let you pass
any pointer as a void* argument. But here, the function accepts a void**
pointer, so it's a different story.
What you need to do is create a Pointer to void*, pass it to the API, then
cast it back as a pointer to type id.
{{{
$ cat t.rb
framework 'ApplicationServices'
pid = 433
safari = AXUIElementCreateApplication(pid)
titlePtr = Pointer.new('^v')
err = AXUIElementCopyAttributeValue(safari, "AXTitle", titlePtr)
titlePtr.cast!('@')
p titlePtr[0]
$ ./miniruby t.rb
"Safari"
}}}
I am pondering if MacRuby shouldn't let you pass the :id pointer directly.
--
Ticket URL: <http://www.macruby.org/trac/ticket/1002#comment:3>
MacRuby <http://macruby.org/>
More information about the macruby-tickets
mailing list