| Did you know ... | Search Documentation: |
| Selection |
Select Graphicals
This example defines a gesture that allows the user to set the selection of a graphical device to a specified graphical by left-clicking the graphical. With a SHIFT-left-click, the graphical is either removed from or added to the selection.
:- pce_global(@selection_gesture,
new(handler_group(
click_gesture(left, '', single,
message(@event?receiver?device,
selection, @event?receiver)),
click_gesture(left, s, single,
message(@event?receiver,
toggle_selected))))).
select_demo :-
new(P, picture('Select Demo')),
send(P, display,
new(Box, box(100, 100))),
send(P, display,
new(Bitmap, bitmap('pce.bm')), point(150,50)),
send_list([Box, Bitmap], recogniser,
@selection_gesture),
send(P, open).
% Start the demo
:- select_demo.
->toggle_selected