On 6/22/12 11:32 AM, cage wrote:
On Fri, Jun 22, 2012 at 05:02:43PM +0200, Peter Herth wrote:
If you create the canvas items with make-instance, you can just bind events to them
Great! Didn't know that!
Bye. C.
Right, I understand that you can bind events to the canvas. I don't have any trouble doing that. What I want is to bind them to the canvas elements; I want to have different pie slices and track which ones people click on. I tried using tag-bind but it throws an error:
SB-INT:SIMPLE-READER-ERROR on #<TWO-WAY-STREAM :INPUT-STREAM #<SB-SYS:FD-STREAM for "descriptor 9" {10034B3BC1}> :OUTPUT-STREAM #<SB-SYS:FD-STREAM for "descriptor 8" {10034B3681}>>: illegal terminating character after a colon: #\ [Condition of type SB-INT:SIMPLE-READER-ERROR]
This happens whether I use:
(tag-bind pie-canvas arc1 "<ButtonPress-1>" (lambda (event) (declare (ignore event)) (format t "test")))
or
(itemconfigure pie-canvas arc1 "tags" "arc1") (tag-bind pie-canvas arc1 "<ButtonPress-1>" (lambda (event) (declare (ignore event)) (format t "test")))
I am not really sure if I'm doing this right at all, since I'm basically trying to reproduce the Python functionality I'm familiar with. Is there any way to view the string being sent to the Tk interpreter?
On Fri, Jun 22, 2012 at 12:27:59PM -0400, Jerry Vinokurov wrote:
Right, I understand that you can bind events to the canvas. I don't have any trouble doing that. What I want is to bind them to the canvas elements; I want to have different pie slices and track which ones people click on. I tried using tag-bind but it throws an error:
Ok, i think you just used the wrong function (i make this kind of error often! :)), the correct one is "tagbind" not "tag-bind".
Please see the attached source for a simple example.
Anyway i suggest you use the solution provided by Peter, a clever way to accomplish the task, in my opinion.
Bye! C.