| Did you know ... | Search Documentation: |
| Send methods |
|host_method,
summary=[string]*, source=[source_location]*, group=[name]*procedures and get_method
objects for
functions.
Method objects may
be associated to a class or
to an individual object using the methods class->send_method, class->get_method,
object->send_method
or object->get_method.
The arguments to method->initialise
are:
behaviour <-nameName of the selectorto handlemethod <-typesVector of type objects for arguments implementation method <-message implementing the methodmethod <-summaryOnline manual summary description method <-sourceSource-file location of the definition method <-groupFunctional group of the method
Messages to classes are normally associated using the class definition interface implemented by pce_begin_class/[2,3], pce_end_class/0 and various macros defined by these predicates.
The example below defines a move_gesture
object that is only active if the window in which the graphical to be
moved defines an attribute (get_method) method<-mode
that yields the value edit.
...,
new(G, move_gesture),
send(G, send_method,
send_method(verify, vector(event),
@arg1?window?mode == edit)),
...
The alternative would be to define a new class for move gestures that only operate in windows that are editabe:
:- pce_begin_class(move_if_editable_gesture,
move_gesture).
verify(_G, Ev:event) :->
"Test if the window is editable"::
get(Ev?window, mode, edit).
:- pce_end_class.