#FEATURE by exept
authorClaus Gittinger <cg@exept.de>
Sat, 10 Aug 2019 09:26:45 +0200
changeset 4327 2564d42c6024
parent 4326 3cbb2d3d12ed
child 4328 3950beaf22af
#FEATURE by exept class: PluggableAdaptor comment/format in: #selectValue: class: PluggableAdaptor class comment/format in: #examples
PluggableAdaptor.st
--- a/PluggableAdaptor.st	Thu Aug 01 14:24:40 2019 +0200
+++ b/PluggableAdaptor.st	Sat Aug 10 09:26:45 2019 +0200
@@ -104,6 +104,21 @@
         t open.
                                                                         [exEnd]
 
+    choose one from alternatives (radioButton-like behavior):
+
+                                                                        [exBegin]
+        |m v|
+
+        m := #foo asValue.
+        v := HorizontalPanelView new.
+        v add:(Toggle on:((PluggableAdaptor on:m) selectValue:#foo) label:'foo' ).
+        v add:(Toggle on:((PluggableAdaptor on:m) selectValue:#bar) label:'bar' ).
+        v add:(Toggle on:((PluggableAdaptor on:m) selectValue:#baz) label:'baz' ).
+        v add:(Label label:'Current:' ).
+        v add:(Label new labelChannel:m ).
+        v open.
+                                                                        [exEnd]
+
     extract values from a complex model:
                                                                         [exBegin]
         |model dialog  name pId|
@@ -398,7 +413,7 @@
 
 selectValue:something
     "configure the adaptor to behave like a boolean value, returning
-     true whenever the models value equals something"
+     true whenever the model's value equals something"
 
 "/    getBlock := [:model | model value = something].
 "/    putBlock := [:model :newValue | newValue ifTrue:[model value:something]].