A newbie problem with generic function
Posted: Tue Dec 16, 2008 1:11 pm
I've got another Lisp-newbie question. I'm trying to define my own button class using the LTK package. In the ltk-mw package the following code can be found:
My code is as follows:
The drawing code is probably buggy, but that's not the point. The problem is I get the following message from SBCL when I load my code using (load "my-lisp-file"):
STYLE-WARNING: Implicitly creating new generic function REDRAW.
It seems that Lisp isn't able to find the generic function redraw in the ltk-mw package. But why it is so? The generic function is defined in that package, and the pacakage is used in my program...
Code: Select all
(defgeneric redraw (widget))
(defclass redraw-on-resize ()
())
(defmethod initialize-instance :after ((r redraw-on-resize) &key)
(bind r "<Configure>" (lambda (evt) (declare (ignore evt))
(redraw r))))
Code: Select all
(require 'asdf)
(require 'ltk)
(require 'ltk-mw)
(use-package 'ltk)
(use-package 'ltk-mw)
;;; A simple button class.
(defclass btn (redraw-on-resize canvas)
( (rect :accessor acc-rect)
(text :accessor acc-text) ))
(defmethod redraw ((widget btn))
(let* ( (width (window-width widget))
(height (window-height widget))
(whalf (truncate width 2))
(hhalf (truncate height 2)) )
(set-coords widget (acc-rect widget) (list 0 0 width height))
(create-text widget whalf hhalf (acc-text widget))))
STYLE-WARNING: Implicitly creating new generic function REDRAW.
It seems that Lisp isn't able to find the generic function redraw in the ltk-mw package. But why it is so? The generic function is defined in that package, and the pacakage is used in my program...