| Did you know ... | Search Documentation: |
| graphical->event |
->post.
If the graphical has recogniser
objects associated (see‘object
graphical<-all_recognisers’)
and graphical<-active
equals @on,
the recognisers are activated in the order they appear in this chain
until one succeeds, after which this method returns successfully.
This method is redefined by many subclasses of class graphical to achieve predefined response to user-events. When programming user-defined (graphical) classes, this method is commonly used to attach predefined user-interface behaviour to the new class.
The following creates a box that may be moved using the middle button:
?- new(B, box(100,100)), send(B, recogniser, new(move_gesture)).
And the following example defines a class movable_box from which all instances can be moved:
:- pce_begin_class(movable_box, box).
:- pce_global(@movable_box_gesture,
new(move_gesture)).
event(B, Ev:event) :->
( send(B, send_super, event, Ev)
-> true
; send(@movable_box_gesture, event, Ev)
).
:- pce_end_class.
Diagnostics: Fails silently if there are no recognisers or none of the recognisers accepted the event.
->recogniser <-all_recognisers ->event