I trying to watch out for a text field to change, using macruby
.
AXObserverCreate
expects an AXObserverCallback
as parameter.
How can I pass a ruby function as a callback?
My function in AX.m
:
+ (AXError) addNotificationWithElement: (AXUIElementRef) element
forEvent:(CFStringRef) event_type
callback:(AXObserverCallback) acallback;
This is how I want to invoke this method:
rb_main.rb
:
def my_callback *args
p args
end
p AX.addNotificationWithElement ref,
forEvent:'AXValueChange',
callback: *** What to write here?***
What to pass to my addNotificationWithElement
function that expects an AXObserverCallback
as callback parameter?
For reference: Apple documentation for AXObserverCallback