Hi,
I have a very beginners question about calling a command from a push-button.
It seems that I need to call redisplay-frame-panes in the activate-callback, although this is not necessary if I invoke the command from the interactor.
(button2 push-button :label "incf and call REDISPLAY-FRAME-PANES" :activate-callback (lambda (button) (declare (ignore button)) (com-incf) ;; * (redisplay-frame-panes *application-frame*)))
Is an activation of a push-button not an event in the command-loop?
I would be glad to know, how this is supposed to be done.
Best, Kilian
================================================ My changes to the SUPERAPP:
(in-package :common-lisp-user)
(defpackage "APP" (:use :clim :clim-lisp) (:export "APP-MAIN"))
(in-package :app)
(define-application-frame superapp () ((currrent-number :initform 1 :accessor current-number)) (:pointer-documentation t) (:panes (app :application :height 400 :width 600 :display-function 'display-app) (button push-button :label "incf" :activate-callback (lambda (button) (declare (ignore button)) (com-incf))) (button2 push-button :label "incf and call REDISPLAY-FRAME-PANES" :activate-callback (lambda (button) (declare (ignore button)) (com-incf) (redisplay-frame-panes *application-frame*))) (int :interactor :height 200 :width 600)) (:layouts (default (vertically () (horizontally () +fill+ button button2 +fill+) app int))))
(defun display-app (frame pane) (let ((number (current-number frame))) (format pane "~a is ~a" number (cond ((null number) "not a number") ((oddp number) "odd") (t "even")))))
(defun app-main () (run-frame-top-level (make-application-frame 'superapp)))
(define-superapp-command (com-quit :name t) () (frame-exit *application-frame*))
(define-superapp-command (com-parity :name t) ((number 'integer)) (setf (current-number *application-frame*) number))
(define-superapp-command (com-incf :name t) () (incf (current-number *application-frame*)))