I'm currently learning McCLIM. Trying to figure out how to define a command, that will react to keystroke. For a app named superapp
I have a function
(defun show (text)
(lambda (gadget)
(declare (ignore gadget))
(with-slots (text-field) *application-frame*
(setf (gadget-value text-field)
text))))
which show some text on it's screen pane. It works fine for pane-buttons in activate-callback
. However, this
(define-superapp-command (com-greet :name t :keystroke (#\g :control)) ()
(show "Hey"))
doesn't work. I know that I defined it right, since it works well with (frame-exit *application-frame*)
. So I just don't understand something else.
EDIT: SO, this is the working variant
(define-application-frame superapp ()
()
(:panes
(tf1
:push-button
:label "Left"
:activate-callback (show "HI"))
(app :application
:display-time nil
:height 400
:width 600)
(screen :text-field))
(:layouts
(default
(with-slots (text-field) *application-frame*
(vertically ()
screen
(tabling (:grid t)
(list tf1 app)))))))
(defun show (text)
(lambda (gadget)
(declare (ignore gadget))
(setf (gadget-value (find-pane-named *application-frame* 'screen))
text)))
(define-superapp-command (com-greet :name t :keystroke (#\g)) ()
(setf (gadget-value (find-pane-named *application-frame* 'screen))
"text"))