Hello, As my paste on irc lisp, did not have any answer, I turning again to this more specialized mailing list.
I have this MClim problem. The application runs fine on Linux with SBCL 1.0.13, xorg-x11-server 1.3.0.0-9.fc7, a recent version of MClim. But doesn't on my Mac (Darwin PowerPC) with MacOS 10.5 (leopard), SBCL 1.0.16, cvs version of MClim, Xquartz 2.1.5 - (xorg-server 1.3.0-apple22)(2.1.5).
I have tried to create the smallest as possible application where the problems occurs (attached). Just compile the file and launch mini::(start)
On Linux, I have the desired behaviour: a circle blinks (red/green/red/...) on the display pane and at the bottom of the window application, the "quit" button is displayed and works.
On the Mac, the circle blinks correctly but the "Quit" button never shows up. For a while the application is killable with C-c C-c (under Slime), but after a while there is no way to kill it than to stop Lisp and restart everything (even /the/ http://www.lispworks.com/reference/HyperSpec/Body/s_the.htm X server).
Note that this application used to work on Mac OS 10.3 (Panther) with older versions of everything. I suspect the X server to behave differently from before. But now I don't see how to make the application work. This is too bad, as I usually use a similar application for my Lisp undergraduate course.
If anyone has an idea, it will be welcomed. Irène
(defpackage :mini (:use :clim :clim-extensions :clim-lisp)) (in-package :mini)
(let ((colors (list +red+ +green+))) (setf colors (nconc colors colors)) (defun display-function (frame pane) (draw-circle* pane 10 10 10 :ink (pop colors)) (sleep 0.5) (redisplay-frame-panes frame)))
(defun quit () (frame-exit *application-frame*))
(define-application-frame mini () () (:panes (display :application :display-function 'display-function :incremental-redisplay t) (quit :push-button :label "Quit" :activate-callback (lambda (x) (declare (ignore x)) (quit)))) (:layouts (defaults (vertically () display quit))))
(defun run-test (name) (loop for port in climi::*all-ports* do (destroy-port port)) (setq climi::*all-ports* nil) (let ((frame (make-application-frame name))) (run-frame-top-level frame)))
(defun start () (run-test 'mini) 0)
(defmethod run-frame-top-level :before ((mini mini) &key) (let* ((frame-manager (frame-manager *application-frame*)) (port (climi::frame-manager-port frame-manager)) (display (clim-clx::clx-port-display port))) (setf (xlib:display-after-function display) g#'xlib:display-force-output)))
This program's display function recurses infinitely (display-function -> redisplay-frame-panes -> ... -> display-function), and control is never returned to the event loop. I'm surprised it worked in the past.
The only reliable technique I know to achieve animation in mcclim is to use a separate thread which loops calling sleep and sends an event to the application frame periodically. I've attached a version of your program using this technique.
(defpackage :mini (:use :clim :clim-extensions :clim-lisp)) (in-package :mini)
(let ((colors (list +red+ +green+))) (setf colors (nconc colors colors)) (defun display-function (frame pane) (draw-circle* pane 10 10 10 :ink (pop colors))))
(defun quit () (frame-exit *application-frame*))
(define-application-frame mini () () (:panes (display :application :display-function 'display-function :incremental-redisplay t) (quit :push-button :label "Quit" :activate-callback (lambda (x) (declare (ignore x)) (quit)))) (:layouts (defaults (vertically () display quit))))
(defun run-test (name) (run-frame-top-level (make-application-frame name)))
(defun start () (run-test 'mini) 0)
(defclass interrupt-event (climi::standard-event) ((fn :initarg :fn :reader fn-of)) (:default-initargs :sheet nil))
(defmethod handle-event (sheet (event interrupt-event)) (funcall (fn-of event)))
(defmethod run-frame-top-level :around ((mini mini) &key) (let ((running t)) (clim-sys:make-process (lambda () (loop while running do (sleep 0.50) (climi::event-queue-append (climi::frame-event-queue mini) (make-instance 'interrupt-event :fn (lambda () (redisplay-frame-panes mini))))))) (unwind-protect (call-next-method) (setf running nil))))
Hello,
In order to give a project to my students using McClim for the graphical interface, I am trying to make a square button of a given size.
But I always obtain a default size button the width, height, max-width, ... have no effect.
Where could I find some help about that?
Thank you, Irène
(defun make-square-pane () (make-pane 'square-button-pane :label "" :width 20 :height 20 :activate-callback (lambda (x) (setf (gadget-label x) "O"))))
Hi.
Did you try with :x-spacing and :y-spacing instead of :width and :height to see what happens?
Mariano
El 27/03/13 09:22, Irène Durand escribió:
Hello,
In order to give a project to my students using McClim for the graphical interface, I am trying to make a square button of a given size.
But I always obtain a default size button the width, height, max-width, ... have no effect.
Where could I find some help about that?
Thank you, Irène
(defun make-square-pane () (make-pane 'square-button-pane :label "" :width 20 :height 20 :activate-callback (lambda (x) (setf (gadget-label x) "O"))))
mcclim-devel mailing list mcclim-devel@common-lisp.net http://lists.common-lisp.net/cgi-bin/mailman/listinfo/mcclim-devel
From a quick glance at the push-button-pane code, it looks like Mariano's
suggestion of using x-spacing / y-spacing may work. If not, an alternative is to define a subclass of push-button-pane with a new compose-space method.
On Wed, Mar 27, 2013 at 8:22 AM, Irène Durand idurand@labri.fr wrote:
Hello,
In order to give a project to my students using McClim for the graphical interface, I am trying to make a square button of a given size.
But I always obtain a default size button the width, height, max-width, ... have no effect.
Where could I find some help about that?
Thank you, Irène
(defun make-square-pane () (make-pane 'square-button-pane :label "" :width 20 :height 20 :activate-callback (lambda (x) (setf (gadget-label x) "O"))))
mcclim-devel mailing list mcclim-devel@common-lisp.net http://lists.common-lisp.net/cgi-bin/mailman/listinfo/mcclim-devel