Added select support.

This commit is contained in:
2026-08-06 00:08:24 +02:00
parent 3d4deed94a
commit 963fec5df5
6 changed files with 100 additions and 5 deletions
+43 -1
View File
@@ -384,4 +384,46 @@ Writes @racket[v] by delegating to:
(webview-set-value! wv element-id v)
]
}
}
}
@section{Class: wv-input/select%}
@defclass[wv-input/select% wv-element% ()]{
Wrapper for an HTML select element.
@defconstructor[([window (is-a?/c wv-window%)]
[element-id symbol?])]{
Creates a select-element wrapper.
}
@defmethod[(get) (or/c string? boolean?)]{
Returns the value of the selected option by delegating to
@racket[webview-value].
}
@defmethod[(set! [v (or/c symbol? string? number? boolean?
g:date? g:time? g:datetime? rgba?)])
any/c]{
Selects the option whose value equals @racket[v] by delegating to
@racket[webview-set-value!].
}
@defmethod[(set-options! [options list?]
[selected any/c #f])
any/c]{
Replaces the option elements. Each entry in @racket[options] is a list
containing a value and a label. When @racket[selected] is not @racket[#f],
the option with that value is selected.
}
@defmethod[(on-change! [callback-func procedure?]) any/c]{
Binds @racket[callback-func] to the HTML @tt{change} event. The callback
receives the newly selected value.
}
}
+2 -1
View File
@@ -133,6 +133,7 @@ following classes is instantiated:
@item{@racket[wv-input/check%] for @racket['checkbox]}
@item{@racket[wv-input/radio%] for @racket['radio]}
@item{@racket[wv-input/color%] for @racket['color]}
@item{@racket[wv-input/select%] for an HTML @tt{select} element}
@item{@racket[wv-element%] otherwise}]
Newly created wrappers receive this window through the @racket[window] init
@@ -537,4 +538,4 @@ This module also re-exports the public APIs from:
@item{@racketmodname[rgba]}
@item{@racketmodname[wv-settings]}]
It also re-exports @racket[webview-version].
It also re-exports @racket[webview-version].