Handbook
Glossary
model-changed ( model observer -- )
Models
Prev:
remove-connection ( observer model -- )
Next:
activate-model ( model -- )
Vocabulary
models
Inputs
model
a
model
observer
an
object
Outputs
None
Generic word contract
Called to notify observers of a model that the model value has changed as a result of a call to
set-model
. Observers can be registered with
add-connection
.
See also
add-connection
,
remove-connection
Definition
IN:
models
GENERIC:
model-changed
( model observer -- )
Methods
USING:
kernel
models
models.arrow
;
M:
?arrow
model-changed
[
compute-arrow-value
]
[
?set-model
]
bi
;
USING:
kernel
models
models.arrow
;
M:
arrow
model-changed
[
compute-arrow-value
]
[
set-model
]
bi
;
USING:
images.viewer.scaling
kernel
models
ui.gadgets
;
M:
autoscaling-image-gadget
model-changed
nip
relayout
;
USING:
kernel
models
ui.gadgets
ui.gadgets.books
;
M:
book
model-changed
nip
dup
hide-all
dup
current-page
show-gadget
relayout
;
USING:
accessors
kernel
models
ui.gadgets
ui.gadgets.buttons
;
M:
checkbox
model-changed
swap
value>>
>>selected?
relayout-1
;
USING:
accessors
color-picker
kernel
models
ui.gadgets
ui.pens.solid
;
M:
color-preview
model-changed
swap
value>>
<solid>
>>interior
relayout-1
;
USING:
accessors
calendar
combinators
kernel
models
models.conditional
threads
;
M:
conditional
model-changed
[
[
dup
[
condition>>
( -- ? )
call-effect
]
[
thread>>
self
=
not
]
bi
or
[
[
value>>
]
dip
set-model
f
]
[
2drop
t
]
if
100
milliseconds
sleep
]
2curry
"models.conditional"
spawn-server
]
keep
thread<<
;
USING:
accessors
kernel
models
models.delay
timers
;
M:
delay
model-changed
nip
timer>>
restart-timer
;
USING:
accessors
combinators
kernel
models
ui.gadgets.editors
ui.gadgets.editors.private
;
M:
editor
model-changed
{
{
[
2dup
model>>
eq?
]
[
contents-changed
]
}
{
[
2dup
caret>>
eq?
]
[
nip
caret/mark-changed
]
}
{
[
2dup
mark>>
eq?
]
[
nip
caret/mark-changed
]
}
}
cond
;
USING:
accessors
combinators
documents
escape-strings.ui
generic
kernel
models
ui.gadgets.editors
;
M:
escape-string-editor
model-changed
2dup
source-model>>
eq?
[
[
doc-string
]
dip
[
quot>>
( str -- str' )
call-effect
]
[
set-editor-string
]
bi
]
[
M\
escape-string-editor
model-changed
(call-next-method)
]
if
;
USING:
accessors
gemini.ui
kernel
models
present
ui.gadgets.editors
;
M:
gemini-gadget
model-changed
[
value>>
present
]
[
url-field>>
editor>>
set-editor-string
]
bi*
;
USING:
accessors
gml.viewer
kernel
models
ui.gadgets
;
M:
gml-viewer-world
model-changed
nip
[
control-value
]
[
b-rep<<
]
[
dup
viewable?
[
refresh-b-rep-view
]
[
drop
]
if
]
tri
;
USING:
accessors
gopher.ui
kernel
models
present
ui.gadgets.editors
;
M:
gopher-gadget
model-changed
[
value>>
present
]
[
url-field>>
editor>>
set-editor-string
]
bi*
;
USING:
accessors
images.viewer
kernel
models
ui.gadgets
;
M:
image-control
model-changed
swap
value>>
>>image
t
>>image-updated?
relayout
;
USING:
accessors
generic
kernel
models
ui.gadgets.status-bar
ui.tools.listener
;
M:
interactor
model-changed
2dup
word-model>>
eq?
[
dup
popup>>
[
2drop
]
[
[
value>>
]
dip
show-summary
]
if
]
[
M\
interactor
model-changed
(call-next-method)
]
if
;
USING:
accessors
kernel
models
ui.gadgets.labels
;
M:
label-control
model-changed
[
value>>
]
[
string<<
]
bi*
;
USING:
kernel
models
ui.gadgets
ui.gadgets.lists
;
M:
list
model-changed
nip
dup
clear-gadget
dup
<list-items>
add-gadgets
bound-index
;
USING:
accessors
assocs
kernel
models
models.mapping
;
M:
mapping
model-changed
nip
[
assoc>>
[
value>>
]
assoc-map
]
keep
set-model
;
USING:
accessors
kernel
models
ui.gadgets
ui.gadgets.menus
;
M:
menu-button
model-changed
swap
value>>
over
=
>>selected?
relayout-1
;
USING:
accessors
kernel
models
ui.gadgets.editors
;
M:
model-field
model-changed
nip
[
editor>>
editor-string
]
[
field-model>>
]
bi
set-model
;
USING:
accessors
kernel
models
ui.gadgets.controls
ui.gadgets.editors
;
M:
model-field
model-changed
2dup
model*>>
=
[
[
value>>
]
[
editor>>
]
bi*
set-editor-string
]
[
nip
[
editor>>
editor-string
]
[
model*>>
]
bi
set-model
]
if
;
USING:
accessors
kernel
models
models.combinators
;
M:
multi-model
model-changed
over
value>>
[
(model-changed)
]
[
2drop
]
if
;
USING:
kernel
models
;
M:
object
model-changed
2drop
;
USING:
accessors
combinators
kernel
models
ui.gadgets.panes
;
M:
pane-control
model-changed
[
value>>
]
[
dup
quot>>
]
bi*
[
( value -- )
call-effect
]
curry
with-pane
;
USING:
accessors
kernel
models
models.product
;
M:
product
model-changed
nip
dup
[
value>>
]
product-value
>>value
notify-connections
;
USING:
accessors
kernel
models
ui.gadgets
ui.gadgets.buttons.private
;
M:
radio-control
model-changed
2dup
[
value>>
]
same?
>>selected?
relayout-1
drop
;
USING:
accessors
boids
combinators
kernel
models
models.range
;
M:
range-observer
model-changed
[
range-value
]
dip
quot>>
( value -- )
call-effect
;
USING:
accessors
kernel
models
ui.gadgets.scrollers
;
M:
scroller
model-changed
f
>>follows
2drop
;
USING:
accessors
kernel
models
ui.gadgets.search-tables
;
M:
search-table
model-changed
nip
field>>
clear-search-field
;
USING:
accessors
kernel
models
ui.gadgets
ui.gadgets.sliders
;
M:
slider
model-changed
nip
elevator>>
relayout-1
;
USING:
kernel
models
ui.gadgets
ui.gadgets.tables
ui.gadgets.tables.private
;
M:
table
model-changed
nip
dup
update-table-rows
dup
update-selection
dup
update-mouse-index
[
update-status
]
[
relayout
]
bi
;
USING:
accessors
combinators
kernel
models
ui.pens.solid
ui.tools.walker
;
M:
thread-status
model-changed
[
value>>
]
dip
{
[
[
thread-status-text
]
[
string<<
]
bi*
]
[
[
thread-status-foreground
]
[
font>>
foreground<<
]
bi*
]
[
[
thread-status-background
<solid>
]
[
parent>>
parent>>
interior<<
]
bi*
]
}
2cleave
;
USING:
accessors
kernel
math.vectors
models
ui.gadgets
ui.gadgets.viewports
;
M:
viewport
model-changed
nip
[
relayout-1
]
[
[
gadget-child
]
[
scroll-position
vneg
]
[
constraint>>
]
tri
v*
>>loc
drop
]
bi
;