Je tente de faire attention à un champ de texte à modifier, en utilisant macruby
.macruby: Utilisation de la méthode ruby comme AXObserverCallback
AXObserverCreate
attend un AXObserverCallback
comme paramètre. Comment passer une fonction ruby comme rappel?
Ma fonction AX.m
:
+ (AXError) addNotificationWithElement: (AXUIElementRef) element
forEvent:(CFStringRef) event_type
callback:(AXObserverCallback) acallback;
Voilà comment je veux invoquer cette méthode:
rb_main.rb
:
def my_callback *args
p args
end
p AX.addNotificationWithElement ref,
forEvent:'AXValueChange',
callback: *** What to write here?***
Que passer à ma fonction addNotificationWithElement
qui attend une AXObserverCallback
comme paramètre de rappel?
Pour référence: Apple documentation for AXObserverCallback