Default value for input-dialogs

This commit is contained in:
David Botton 2022-01-09 19:52:44 -05:00
parent 755dd08503
commit cebb81f061
2 changed files with 30 additions and 1 deletions

View file

@ -1228,6 +1228,10 @@ interactions. Use window-end-modal to undo."))
;; Implementation - Dialog Boxes
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;
;; alert-toast ;;
;;;;;;;;;;;;;;;;;
(defun alert-toast (obj title content &key
(color-class "w3-red")
(time-out nil)
@ -1263,6 +1267,10 @@ is placed in DOM at top of html body instead of bottom of html body."
(sleep time-out)
(destroy win))))
;;;;;;;;;;;;;;;;;;
;; alert-dialog ;;
;;;;;;;;;;;;;;;;;;
(defun alert-dialog (obj content &key (modal t)
(title "About")
(left nil) (top nil)
@ -1308,8 +1316,14 @@ is placed in DOM at top of html body instead of bottom of html body."
(when modal
(window-end-modal win))))))
;;;;;;;;;;;;;;;;;;
;; input-dialog ;;
;;;;;;;;;;;;;;;;;;
(defun input-dialog (obj content on-input &key (modal t)
(title "Input")
(size 20)
(default-value "")
(left nil) (top nil)
(width 300) (height 200)
(client-movement nil)
@ -1325,13 +1339,15 @@ Calls on-input with input box contents or nil if canceled."
"<div class='w3-panel'>
<center>~A<br><br>
<form class='w3-container' onSubmit='return false;'>
<input type='text' id='~A-input' size='20'><br><br>
<input type='text' id='~A-input' size='~A' value='~A'><br><br>
<button class='w3-button w3-black' style='width:7em' id='~A-ok'>OK</button>
<button class='w3-button w3-black' style='width:7em' id='~A-cancel'>Cancel</button>
</form>
</center>
</div>" content
html-id ; input
size
(escape-string default-value)
html-id ; ok
html-id) ; cancel
:top top
@ -1373,6 +1389,10 @@ Calls on-input with input box contents or nil if canceled."
(window-end-modal win))
(funcall on-input nil)))))
;;;;;;;;;;;;;;;;;;;;
;; confirm-dialog ;;
;;;;;;;;;;;;;;;;;;;;
(defun confirm-dialog (obj content on-input &key (modal t)
(title "Confirm")
(ok-text "OK")
@ -1436,6 +1456,10 @@ Calls on-input with t if confirmed or nil if canceled."
(window-end-modal win))
(funcall on-input nil)))))
;;;;;;;;;;;;;;;;;
;; form-dialog ;;
;;;;;;;;;;;;;;;;;
(defun form-dialog (obj content fields on-input &key (modal t)
(title "Form")
(ok-text "OK")
@ -1617,6 +1641,10 @@ if confirmed or nil if canceled."
(window-end-modal win))
(funcall on-input nil)))))
;;;;;;;;;;;;;;;;;;;;;;;;
;; server-file-dialog ;;
;;;;;;;;;;;;;;;;;;;;;;;;
(defun server-file-dialog (obj title initial-dir on-file-name
&key (modal t)
(left nil) (top nil) (width 390) (height 425)