diff --git a/source/clog-gui.lisp b/source/clog-gui.lisp
index 4934af1..a8126f0 100644
--- a/source/clog-gui.lisp
+++ b/source/clog-gui.lisp
@@ -108,6 +108,10 @@
:accessor modal-background
:initform nil
:documentation "Modal Background")
+ (modal-count
+ :accessor modal-count
+ :initform 0
+ :documentation "Count of nested modal windows")
(in-drag
:accessor in-drag
:initform nil
@@ -971,8 +975,10 @@ interactions. Use window-end-modal to undo."))
(defmethod window-make-modal ((obj clog-gui-window))
(let ((app (connection-data-item obj "clog-gui")))
- (setf (modal-background app) (create-div (body app) :class "w3-overlay"))
- (setf (display (modal-background app)) :block)
+ (when (= (modal-count app) 0)
+ (setf (modal-background app) (create-div (body app) :class "w3-overlay"))
+ (setf (display (modal-background app)) :block))
+ (incf (modal-count app))
(setf (keep-on-top obj) t)
(setf (z-index obj) 4)))
@@ -985,7 +991,9 @@ interactions. Use window-end-modal to undo."))
(defmethod window-end-modal ((obj clog-gui-window))
(let ((app (connection-data-item obj "clog-gui")))
- (destroy (modal-background app))
+ (decf (modal-count app))
+ (when (<= (modal-count app) 0)
+ (destroy (modal-background app)))
(window-focus obj)))
;;;;;;;;;;;;;;;;;;;
@@ -1392,27 +1400,30 @@ Calls on-input with t if confirmed or nil if canceled."
(html-id nil))
"Create a form dialog box with CONTENT followed by FIELDS centered.
Fields is an a-list of field names to field descriptions, a third element
-can be added of another a-list of option Text to Value. Calls on-input
+can be added to state field is :filename followed by default dir or
+is a select followed by an a-list of option Text to Value. Calls on-input
with a-list of field name to value if confirmed or nil if canceled."
(unless html-id
(setf html-id (clog-connection:generate-id)))
(let* ((body (connection-data-item obj "clog-body"))
(fls (format nil "~{~A~}"
(mapcar (lambda (l)
- (if (third l)
- (format nil
- "