[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

buttons, items and???

I am having some trouble with :dialog-item-action.
I do not understand how to get the buttons to do the action
for example when setting up a menu with the following code:
(make-instance 'menu-item
                                    :menu-item-title "Move Poly To The Right"
                                    #'(lambda nil
                                        (setq poly-over-by (+ 1 poly-over-by))
                                        (view-draw-contents *window*))
the action in the lambda function is done, but when ussing
a button:
                               #'(lambda nil  (poly-right)))
                 (make-instance 'button-dialog-item
                               :view-position #@(330 260)
                               :dialog-item-text "Move Poly - Centre"
                                    #'(lambda (item) item
                                        (if (> 0 poly-over-by)
                                          (dotimes (count (abs poly-over-by))
                                            (setq poly-over-by (+ poly-over-by 1
                                            (view-draw-contents *window*))
                                          (dotimes (count poly-over-by)
                                            (setq poly-over-by (- poly-over-by 1
                                            (view-draw-contents *window*)))))

                (make-instance 'button-dialog-item
                               :view-position #@(160 260)
                               :dialog-item-text "Move Poly - Left"
                                    #'(lambda (item) item
                                        (setq poly-over-by (- poly-over-by 1 ))
                                        (view-draw-contents *window*)))
                (my-scroller window)))

(defun poly-right ()
   (setf (poly-over *window*) (+ 1 (poly-over *window*)))
   (view-draw-contents *window*))

actions are not done.
I believe I do not understand item and view-container, nor do I understand
the difference between dialog-item-action and menu-item-action.
Sorry for the somple questions I'm new to this game!!
Any ideas?????
Andrew Cohen
Centre for Applied Cog. Sci.