Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Improved dialog interface, injection code |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
f19371823b877ee2b45a27739bc5015d |
User & Date: | murphy 2018-09-01 04:23:22.728 |
Context
2018-09-01
| ||
13:06 | Silly fortune database example check-in: 0f7cbfc3e6 user: murphy tags: trunk | |
04:23 | Improved dialog interface, injection code check-in: f19371823b user: murphy tags: trunk | |
01:49 | Fragment rendering for write-html check-in: 78dabae49f user: murphy tags: trunk | |
Changes
Changes to main.scm.
︙ | ︙ | |||
128 129 130 131 132 133 134 | (define (webview-inject view id html) (webview-eval view (call-with-output-string (lambda (port) (display "document.getElementById(" port) (write-js id port) | | | < | | | | > > < > | > | > | > > | | | | > > | | | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | (define (webview-inject view id html) (webview-eval view (call-with-output-string (lambda (port) (display "document.getElementById(" port) (write-js id port) (display ").innerHTML=" port) (write-js (call-with-output-string (cut write-html html <>)) port))))) (define (webview-dialog view title type #!optional value) (let ([type (case type [(#:open #:open-directory) (foreign-value "WEBVIEW_DIALOG_TYPE_OPEN" int)] [(#:save) (foreign-value "WEBVIEW_DIALOG_TYPE_SAVE" int)] [(#:info #:warning #:error) (foreign-value "WEBVIEW_DIALOG_TYPE_ALERT" int)] [else (error 'webview-dialog "unknown dialog type" type)])] [flags (bitwise-ior (case type [(#:open #:save) (foreign-value "WEBVIEW_DIALOG_FLAG_FILE" int)] [(#:open-directory) (foreign-value "WEBVIEW_DIALOG_FLAG_DIRECTORY" int)] [else 0]) (case type [(#:info) (foreign-value "WEBVIEW_DIALOG_FLAG_INFO" int)] [(#:warning) (foreign-value "WEBVIEW_DIALOG_FLAG_WARNING" int)] [(#:error) (foreign-value "WEBVIEW_DIALOG_FLAG_ERROR" int)] [else 0]))] [buf (make-string 4096 #\nul)]) ((foreign-safe-lambda void "webview_dialog" nonnull-webview int int nonnull-c-string c-string scheme-pointer size_t) view type flags title value buf (string-length buf)) (let scan ([pos 0]) (if (or (fx>= pos (string-length buf)) (eqv? (string-ref buf pos) #\nul)) (and (fx> pos 0) (substring buf 0 pos)) (scan (fx+ pos 1)))))) (define webview-log (foreign-lambda void "webview_print_log" nonnull-c-string)) |
︙ | ︙ |
Changes to webview.wiki.
︙ | ︙ | |||
85 86 87 88 89 90 91 | <tt>HTML</tt> content is specified in the form accepted by <tt>write-html</tt>. <h2>Dialogs</h2> <h3><tt><nowiki> | | | | | | | | > | < < | | | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | <tt>HTML</tt> content is specified in the form accepted by <tt>write-html</tt>. <h2>Dialogs</h2> <h3><tt><nowiki> (webview-dialog WEBVIEW TITLE TYPE [VALUE]) ⇒ VALUE </nowiki></tt></h3> Shows a modal dialog with the given <tt>TITLE</tt> in the context of the given <tt>WEBVIEW</tt>. If <tt>TYPE</tt> is <tt>#:open</tt> or <tt>#:save</tt>, a file selection dialog is shown and <tt>VALUE</tt> may be the path to a file that will be pre-selected. If <tt>TYPE</tt> is <tt>#:open-directory</tt>, the dialog allows the selection of directories rather than regular files. The procedure will return the path to a selected file or <tt>#f</tt> in case the dialog is cancelled. If <tt>TYPE</tt> is <tt>#:info</tt>, <tt>#:warning</tt> or <tt>#:error</tt>, a message dialog is shown and <tt>VALUE</tt> is the message to display in the dialog. The procedure will not return a meaningful result in this case. The running operating system thread will be blocked until the dialog is dismissed. <h2>Logging</h2> <h3><tt><nowiki> |
︙ | ︙ |