I would like to simulate a modal dialog, contained in its own window, via an ACCEPTING-VALUES inside a frame opened with OPEN-WINDOW-STREAM. I use code like this:
(in-package :clim-user)
(define-application-frame window-stream () () (:menu-bar t) (:panes (commands :interactor)) (:layouts (default commands)))
(defun show-dialog (stream) (let (integer string) (restart-case (accepting-values (stream) (setq integer (accept 'integer :stream stream :prompt "Gimme an integer ")) (terpri stream) (setq string (accept 'string :stream stream :prompt "Gimme a string ")) (terpri stream)) (abort () nil)) (values integer string)))
(define-window-stream-command (com-dialog :menu t :name t) () (let ((stream (open-window-stream))) (unwind-protect (multiple-value-bind (integer string) (show-dialog stream) (format t "~&You entered ~D and ~A~%" integer string)) (when (open-stream-p stream) (frame-exit (pane-frame stream)) (close stream)))))
(define-window-stream-command (com-quit :menu t :name t) () (frame-exit *application-frame*))
This mostly works, but the CLIM frame opened with OPEN-WINDOW-STREAM is not closed. I tried using only CLOSE in COM-DIALOG, but without success. How can I close that window?
Paolo
Paolo Amoroso amoroso@mclink.it writes:
I would like to simulate a modal dialog, contained in its own window, via an ACCEPTING-VALUES inside a frame opened with OPEN-WINDOW-STREAM. I use code like this:
[...]
This mostly works, but the CLIM frame opened with OPEN-WINDOW-STREAM is not closed. I tried using only CLOSE in COM-DIALOG, but without success. How can I close that window?
Ooops, I didn't notice this bug:
Windows opened by open-window-stream are not automatically closed when their parent is closed http://mcclim.cliki.net/Bug#open-window-stream-not-closed
I do not need to close the parent, but what I reported is probably related to this bug. In the CLOSE method on CLIM-STREAM-PANE in panes.lisp, the call to DISABLE-FRAME does not apparently do much. I tried adding the forms:
(frame-exit *application-frame*)
or:
(frame-exit (pane-frame stream))
before and after the one to DISABLE-FRAME, but the window still refuses to close.
Paolo