wv-input
1 Overview
2 Common Structure
3 Class:   wv-input/  text%
wv-input/  text%
new
get
set!
4 Class:   wv-input/  number%
wv-input/  number%
new
get
set!
5 Class:   wv-input/  boolean%
wv-input/  boolean%
new
get
set!
6 Class:   wv-input/  date%
wv-input/  date%
new
get
set!
7 Class:   wv-input/  time%
wv-input/  time%
new
get
set!
8 Class:   wv-input/  datetime%
wv-input/  datetime%
new
get
set!
9 Class:   wv-input/  range%
wv-input/  range%
new
get
set!
10 Class:   wv-input/  check%
wv-input/  check%
new
get
set!
11 Class:   wv-input/  radio%
wv-input/  radio%
new
get
set!
12 Class:   wv-input/  color%
wv-input/  color%
new
get
set!
9.1

wv-input🔗ℹ

Hans Dijkema <hans@dijkewijk.nl>

 (require wv-input)

Typed input-element wrappers used by the window layer.

This module exports a family of classes derived from wv-element%. Each class represents one DOM input element and provides a typed get method together with a set! method.

1 Overview🔗ℹ

All classes in this module inherit from wv-element%.

Each input wrapper:

  • is associated with one wv-window%

  • is associated with one DOM element id

  • uses webview-set-value! to write values

  • uses a type-specific webview-value* function to read values

The classes do not add their own storage. They delegate directly to the lower-level DOM/value API from racket-webview. Their accepted argument shapes and result values therefore follow the contracts of those lower-level functions.

2 Common Structure🔗ℹ

All input wrapper classes have the same constructor shape:

(new some-input% [window some-window] [element-id 'some-id])

where window is the owning wv-window% and element-id is the DOM id of the corresponding element.

Each class provides two public methods:

  • get, returning the current typed value

  • set!, writing a new value through webview-set-value!

3 Class: wv-input/text%🔗ℹ

class

wv-input/text% : class?

  superclass: wv-element%

Wrapper for a text input element.

constructor

(new wv-input/text% 
    [window window] 
    [element-id element-id]) 
  (is-a?/c wv-input/text%)
  window : (is-a?/c wv-window%)
  element-id : symbol?
Creates a text-input wrapper.

method

(send a-wv-input/text get)  (or/c string? boolean?)

Returns the current value by delegating to:

(webview-value wv element-id)

method

(send a-wv-input/text set! v)  any/c

  v : 
(or/c symbol? string? number? boolean?
      g:date? g:time? g:datetime? rgba?)
Writes v by delegating to:

(webview-set-value! wv element-id v)

4 Class: wv-input/number%🔗ℹ

class

wv-input/number% : class?

  superclass: wv-element%

Wrapper for a numeric input element.

constructor

(new wv-input/number% 
    [window window] 
    [element-id element-id]) 
  (is-a?/c wv-input/number%)
  window : (is-a?/c wv-window%)
  element-id : symbol?
Creates a numeric-input wrapper.

method

(send a-wv-input/number get)  (or/c number? #f)

Returns the current value by delegating to:

(webview-value/number wv element-id)

method

(send a-wv-input/number set! v)  any/c

  v : 
(or/c symbol? string? number? boolean?
      g:date? g:time? g:datetime? rgba?)
Writes v by delegating to:

(webview-set-value! wv element-id v)

5 Class: wv-input/boolean%🔗ℹ

class

wv-input/boolean% : class?

  superclass: wv-element%

Wrapper for an input whose value is interpreted as a boolean.

constructor

(new wv-input/boolean% 
    [window window] 
    [element-id element-id]) 
  (is-a?/c wv-input/boolean%)
  window : (is-a?/c wv-window%)
  element-id : symbol?
Creates a boolean-input wrapper.

method

(send a-wv-input/boolean get)  (or/c boolean? #f)

Returns the current value by delegating to:

(webview-value/boolean wv element-id)

method

(send a-wv-input/boolean set! v)  any/c

  v : 
(or/c symbol? string? number? boolean?
      g:date? g:time? g:datetime? rgba?)
Writes v by delegating to:

(webview-set-value! wv element-id v)

6 Class: wv-input/date%🔗ℹ

class

wv-input/date% : class?

  superclass: wv-element%

Wrapper for a date input element.

constructor

(new wv-input/date% 
    [window window] 
    [element-id element-id]) 
  (is-a?/c wv-input/date%)
  window : (is-a?/c wv-window%)
  element-id : symbol?
Creates a date-input wrapper.

method

(send a-wv-input/date get)  (or/c g:date? #f)

Returns the current value by delegating to:

(webview-value/date wv element-id)

method

(send a-wv-input/date set! v)  any/c

  v : 
(or/c symbol? string? number? boolean?
      g:date? g:time? g:datetime? rgba?)
Writes v by delegating to:

(webview-set-value! wv element-id v)

7 Class: wv-input/time%🔗ℹ

class

wv-input/time% : class?

  superclass: wv-element%

Wrapper for a time input element.

constructor

(new wv-input/time% 
    [window window] 
    [element-id element-id]) 
  (is-a?/c wv-input/time%)
  window : (is-a?/c wv-window%)
  element-id : symbol?
Creates a time-input wrapper.

method

(send a-wv-input/time get)  (or/c g:time? #f)

Returns the current value by delegating to:

(webview-value/time wv element-id)

method

(send a-wv-input/time set! v)  any/c

  v : 
(or/c symbol? string? number? boolean?
      g:date? g:time? g:datetime? rgba?)
Writes v by delegating to:

(webview-set-value! wv element-id v)

8 Class: wv-input/datetime%🔗ℹ

class

wv-input/datetime% : class?

  superclass: wv-element%

Wrapper for a datetime input element.

constructor

(new wv-input/datetime% 
    [window window] 
    [element-id element-id]) 
  (is-a?/c wv-input/datetime%)
  window : (is-a?/c wv-window%)
  element-id : symbol?
Creates a datetime-input wrapper.

method

(send a-wv-input/datetime get)  (or/c g:datetime? #f)

Returns the current value by delegating to:

(webview-value/datetime wv element-id)

method

(send a-wv-input/datetime set! v)  any/c

  v : 
(or/c symbol? string? number? boolean?
      g:date? g:time? g:datetime? rgba?)
Writes v by delegating to:

(webview-set-value! wv element-id v)

9 Class: wv-input/range%🔗ℹ

class

wv-input/range% : class?

  superclass: wv-element%

Wrapper for a range input element.

constructor

(new wv-input/range% 
    [window window] 
    [element-id element-id]) 
  (is-a?/c wv-input/range%)
  window : (is-a?/c wv-window%)
  element-id : symbol?
Creates a range-input wrapper.

method

(send a-wv-input/range get)  (or/c number? #f)

Returns the current value by delegating to:

(webview-value/number wv element-id)

method

(send a-wv-input/range set! v)  any/c

  v : 
(or/c symbol? string? number? boolean?
      g:date? g:time? g:datetime? rgba?)
Writes v by delegating to:

(webview-set-value! wv element-id v)

10 Class: wv-input/check%🔗ℹ

class

wv-input/check% : class?

  superclass: wv-element%

Wrapper for a checkbox input element.

constructor

(new wv-input/check% 
    [window window] 
    [element-id element-id]) 
  (is-a?/c wv-input/check%)
  window : (is-a?/c wv-window%)
  element-id : symbol?
Creates a checkbox wrapper.

method

(send a-wv-input/check get)  (or/c boolean? #f)

Returns the current value by delegating to:

(webview-value/boolean wv element-id)

method

(send a-wv-input/check set! v)  any/c

  v : 
(or/c symbol? string? number? boolean?
      g:date? g:time? g:datetime? rgba?)
Writes v by delegating to:

(webview-set-value! wv element-id v)

11 Class: wv-input/radio%🔗ℹ

class

wv-input/radio% : class?

  superclass: wv-element%

Wrapper for a radio input element.

constructor

(new wv-input/radio% 
    [window window] 
    [element-id element-id]) 
  (is-a?/c wv-input/radio%)
  window : (is-a?/c wv-window%)
  element-id : symbol?
Creates a radio-input wrapper.

method

(send a-wv-input/radio get)  (or/c boolean? #f)

Returns the current value by delegating to:

(webview-value/boolean wv element-id)

method

(send a-wv-input/radio set! v)  any/c

  v : 
(or/c symbol? string? number? boolean?
      g:date? g:time? g:datetime? rgba?)
Writes v by delegating to:

(webview-set-value! wv element-id v)

12 Class: wv-input/color%🔗ℹ

class

wv-input/color% : class?

  superclass: wv-element%

Wrapper for a color input element.

constructor

(new wv-input/color% 
    [window window] 
    [element-id element-id]) 
  (is-a?/c wv-input/color%)
  window : (is-a?/c wv-window%)
  element-id : symbol?
Creates a color-input wrapper.

method

(send a-wv-input/color get)  (or/c rgba? #f)

Returns the current value by delegating to:

(webview-value/color wv element-id)

method

(send a-wv-input/color set! v)  any/c

  v : 
(or/c symbol? string? number? boolean?
      g:date? g:time? g:datetime? rgba?)
Writes v by delegating to:

(webview-set-value! wv element-id v)