ispresent_callback(+Source, +EventName, +Destination, +DestinationMethod)

This built-in predicate checks if the specified callback already exists or not, if the callback already exists then the clause is exited else it fails. The source object is the object which generates the event and the EventName must be the name of a documented event like 'OnSize' or 'OnCreate'. The DestinationMethod method must be the name of a public method of the class of the Destination instance. The predicate ispresent_callback/4 is part of the Windows API of Trinc-Prolog.

see also: add_callback/3 add_callback/4 callbacks class_name/2 clear_var/1 del_obj/1 get_instance/2 instance/1 new_obj/2 new_obja/2  object-oriented prolog remove_callback/4 <-/2 ::<-/1 ::<-/2 this/1

Examples
this(T),
ispresent_callback(T, onCreate, T, doOnCreate),
check if the 'onCreate' event of an instance is connected to the method 'doOnCreate' of the same instance
ispresent_callback(Instance, onBeforeSwitch, T, beforeSwitch) determine if the event 'onBeforeSwitch' of a control window is connected to the method 'beforeSwitch' of another window

 

Exceptions
Source and/or Destination are empty variables an instantiation_error exception is thrown
Source and/or Destination not refer to an instance of a class a type_error(class_instance, Var) exception is thrown
EventName and/or DestinationMethod are not atoms or variables containing atoms a type_error(atom, Name) exception is thrown
No event with the same name as EventName existence_error(class_method, Var) is thrown
No method with the same name as DestinationMethod that has 1 parameter existence_error(class_method, Var) is thrown

 

 

info@trinc-prolog.com