checkin from browser
authorClaus Gittinger <cg@exept.de>
Thu, 27 Feb 1997 10:05:15 +0100
changeset 1064 dba203683e94
parent 1063 b315e2580bc7
child 1065 01c863929ddc
checkin from browser
PopUpList.st
--- a/PopUpList.st	Wed Feb 26 19:27:30 1997 +0100
+++ b/PopUpList.st	Thu Feb 27 10:05:15 1997 +0100
@@ -169,10 +169,10 @@
      |p l|
      p := PopUpList label:'dummy'.
      l := OrderedCollection new.
-     l add:('apples' asText emphasizeAllWith:#color->Color red).
-     l add:('bananas' asText emphasizeAllWith:#color->Color red).
-     l add:('grape' asText emphasizeAllWith:#color->Color red).
-     l add:('lemon' asText emphasizeAllWith:#color->Color red).
+     l add:(ColoredListEntry string:'apples' color:Color red).
+     l add:(ColoredListEntry string:'bananas' color:Color red).
+     l add:(ColoredListEntry string:'grape' color:Color red).
+     l add:(ColoredListEntry string:'lemon' color:Color red).
      l add:'='.
      l add:(ColoredListEntry string:'margaritas' color:Color green darkened darkened).
      l add:(ColoredListEntry string:'pina colada' color:Color green darkened darkened).
@@ -205,7 +205,7 @@
                                                                         [exEnd]
 
 
-  with a model (see in the inspector, how the valueHolders index-value changes)
+  with a model (see in the inspector, how the index-holders value changes)
   the defaults are setup to allow a SelectionInList directly as model:
                                                                         [exBegin]
      |p model|
@@ -227,37 +227,36 @@
      model selection:'apples'.
 
      p := PopUpList on:model.
-     p useIndex:true; aspect:#selectionIndex; change:#selectionIndex:.
+     p open.
+
+     slv := SelectionInListView on:model.
+     slv open.
+                                                                        [exEnd]
+
+
+    dynamically changing the list (click button(s) to change):
+                                                                        [exBegin]
+     |p slv model b|
+
+     model := SelectionInList with:#('apples' 'bananas' 'grape' 'lemon' 'margaritas').
+     model selection:'apples'.
+
+     p := PopUpList on:model.
      p open.
 
      slv := SelectionInListView on:model.
      slv open.
 
-     model inspect
+     b := Button label:'long list' action:[model list:#('1' '2' '3' '4' '5' '6')].
+     b open.
+     b := Button label:'short list' action:[model list:#('1' '2' '3')].
+     b open.
+
                                                                         [exEnd]
 
 
-  using another listMessage
-  (the example uses a plug - this would be your applications data model):
-                                                                        [exBegin]
-     |p model selection|
-
-     model := Plug new.
-     model respondTo:#menu with:[#('lasagne' 'spaghetti' 'risotto')].
-     model respondTo:#menuSelection with:[selection].
-     model respondTo:#menuSelection: with:[:val | selection := val].
-     selection := 1.
-
-     p := PopUpList label:'eat'.
-     p aspectMessage:#menuSelection; changeMessage:#menuSelection:; listMessage:#menu.
-     p model:model.
-
-     p open.
-                                                                        [exEnd]
-
 
     two PopUpLists on the same model, different aspects:
-   (the example uses a plug - this would be your applications data model):
                                                                         [exBegin]
      |top panel p model|
 
@@ -293,7 +292,7 @@
 
      p := PopUpList label:'healthy fruit'.
      p listHolder:listHolder.
-     p model:selectionHolder; aspect:#value; change:#value:.
+     p selectionHolder:selectionHolder.
      p open.
      selectionHolder inspect
                                                                         [exEnd]
@@ -307,7 +306,7 @@
 
      p := PopUpList new.
      p listHolder:listHolder.
-     p model:selectionIndexHolder; aspect:#value; change:#value:.
+     p selectionHolder:selectionIndexHolder.
      p useIndex:true.
      p open.
      selectionIndexHolder inspect
@@ -792,5 +791,5 @@
 !PopUpList class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/PopUpList.st,v 1.33 1997-02-26 18:27:30 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/PopUpList.st,v 1.34 1997-02-27 09:05:15 cg Exp $'
 ! !