tweaks to dialog

This commit is contained in:
David Botton 2021-02-16 23:16:58 -05:00
parent a8c0b8fc4f
commit 20d5238a84
2 changed files with 19 additions and 11 deletions

View file

@ -983,25 +983,28 @@ interactions. Use window-end-modal to undo."))
(initial-filename nil)) (initial-filename nil))
"Create a local file dialog box called TITLE using INITIAL-DIR on server "Create a local file dialog box called TITLE using INITIAL-DIR on server
machine, upon close ON-FILE-NAME called with filename or nil if failure." machine, upon close ON-FILE-NAME called with filename or nil if failure."
(let* ((win (create-gui-window obj (let* ((win (create-gui-window obj
:title title :title title
:maximize maximize :maximize maximize
:top top :top top
:left left :left left
:width width :width width
:height height)) :height height))
(box (create-div (window-content win) :class "w3-panel")) (box (create-div (window-content win) :class "w3-panel"))
(form (create-form box)) (form (create-form box))
(dirs (create-select form)) (dirs (create-select form))
(files (create-select form)) (files (create-select form))
(input (create-form-element form :input :label (input (create-form-element form :input :label
(create-label form :content "File Name:"))) (create-label form :content "File Name:")))
(ok (create-button form :content "  OK  "))) (ok (create-button form :content "OK"))
(cancel (create-button form :content "Cancel")))
(setf (size dirs) 4) (setf (size dirs) 4)
(setf (box-width dirs) "100%") (setf (box-width dirs) "100%")
(setf (size files) 8) (setf (size files) 8)
(setf (box-width files) "100%") (setf (box-width files) "100%")
(setf (box-width input) "100%") (setf (box-width input) "100%")
(setf (width ok) "7em")
(setf (width cancel) "7em")
(window-make-modal win) (window-make-modal win)
(flet ((populate-dirs (dir) (flet ((populate-dirs (dir)
(setf (inner-html dirs) "") (setf (inner-html dirs) "")
@ -1046,6 +1049,9 @@ machine, upon close ON-FILE-NAME called with filename or nil if failure."
(declare (ignore obj)) (declare (ignore obj))
(window-end-modal win) (window-end-modal win)
(funcall on-file-name nil))) (funcall on-file-name nil)))
(set-on-click cancel (lambda (obj)
(declare (ignore obj))
(window-close win)))
(set-on-click ok (lambda (obj) (set-on-click ok (lambda (obj)
(declare (ignore obj)) (declare (ignore obj))
(set-on-window-close win nil) (set-on-window-close win nil)

View file

@ -75,8 +75,9 @@
(format nil "editor_~A.setValue('~A');editor_~A.moveCursorTo(0,0);" (format nil "editor_~A.setValue('~A');editor_~A.moveCursorTo(0,0);"
(html-id (current-window obj)) (html-id (current-window obj))
(escape-string (read-file fname)) (escape-string (read-file fname))
(html-id (current-window obj))))) (html-id (current-window obj))))))
:left (- (/ (width (body app)) 2) 200))))) :top 10
:left (- (/ (width (body app)) 2) 200))))
(defun do-ide-file-save-as (obj) (defun do-ide-file-save-as (obj)
(let* ((app (connection-data-item obj "app-data")) (let* ((app (connection-data-item obj "app-data"))
@ -90,8 +91,9 @@
(write-file (js-query obj (format nil "editor_~A.getValue()" (write-file (js-query obj (format nil "editor_~A.getValue()"
(html-id cw))) (html-id cw)))
fname))) fname)))
:left (- (/ (width (body app)) 2) 200) :top 10
:initial-filename (window-title cw))))) :left (- (/ (width (body app)) 2) 200)
:initial-filename (window-title cw)))))
(defun do-ide-file-save (obj) (defun do-ide-file-save (obj)
(if (equalp (window-title (current-window obj)) "New Window") (if (equalp (window-title (current-window obj)) "New Window")