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.
}
}