[ltk-user] canvas objects
nik gaffney
nik at fo.am
Sat Jan 28 15:24:48 UTC 2006
>> Ive been playing around with the canvas widget, and was wondering if there is a
>> way to find if a created object is 'selected', or at the same coordinates as
>> (ltk:event-x ltk:event-y) without having to manually keep track of each object
>> on the canvas.
>
> It sounds as if you bound an event handler to the canvas widget and
> then tried to find a corresponding canvas item. The canvas widget is
> really powerful and provides event handlers on the items themselves,
> i.e.
>
> (let ((item (create-line canvas (list x1 y1 x2 y2))))
> (itembind canvas item "<Enter>" (lambda (ev)
> (format t "entered item ~A~%" item)))
> (itembind canvas item "<Leave>" (lambda (ev)
> (format t "left item ~A~%" item))))
>
Thanks. I didnt realise that items could also have event handlers, so this
simplifies things substantially.
nik
More information about the ltk-user
mailing list