ButtonController.st
changeset 87 2c6ab478466a
parent 76 81e3409404d2
child 88 7560534e9026
--- a/ButtonController.st	Thu Feb 16 04:13:03 1995 +0100
+++ b/ButtonController.st	Thu Feb 16 17:31:54 1995 +0100
@@ -37,7 +37,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libwidg/ButtonController.st,v 1.1 1995-02-06 00:51:58 claus Exp $
+$Header: /cvs/stx/stx/libwidg/ButtonController.st,v 1.2 1995-02-16 16:31:37 claus Exp $
 "
 !
 
@@ -66,6 +66,17 @@
 
 examples
 "
+  Although you can specify a lot in a button,
+  use the default in most applications.
+  As you specify more things in your program, 
+  the styleSheet settings are more and more ignored.
+  Also, even though it might look fancy, colorful
+  button panels are usually not a good GUI design;
+  they will attract the users attention - possibly to things
+  which are not worth it.
+
+  default settings:
+
     |top b|
 
     top := StandardSystemView new.
@@ -76,13 +87,139 @@
     top open.
 
 
+  changing colors:
+
+    |top b|
+
+    top := StandardSystemView new.
+    top extent:100@100.
+
+    b := Button label:'hello' in:top.
+    b action:[Transcript flash].
+    b activeForegroundColor:(Color white).
+    b activeBackgroundColor:(Color red).
+    top open.
+
+
+  changing more colors:
+
     |top b|
 
     top := StandardSystemView new.
     top extent:100@100.
 
     b := Button label:'hello' in:top.
-    b controller beTriggerOnUp.
+    b action:[Transcript flash].
+    b enteredForegroundColor:(Color red).
+    b enteredBackgroundColor:(b backgroundColor).
+    b activeForegroundColor:(Color white).
+    b activeBackgroundColor:(Color red).
+    top open.
+
+
+  button with an image:
+
+    |top b|
+
+    top := StandardSystemView new.
+    top extent:100@100.
+
+    b := Button in:top.
+    b form:(Image fromFile:'bitmaps/SBrowser.xbm').
+    b action:[Transcript flash].
+    b enteredForegroundColor:(Color green darkened).
+    b enteredBackgroundColor:(b backgroundColor).
+    b activeForegroundColor:(Color white).
+    b activeBackgroundColor:(Color red).
+    top open.
+
+
+  changing the image:
+
+    |top b|
+
+    top := StandardSystemView new.
+    top extent:100@100.
+
+    b := Button in:top.
+    b passiveLogo:(Image fromFile:'bitmaps/SBrowser.xbm').
+    b activeLogo:(Image fromFile:'bitmaps/CBrowser.xbm').
+    b action:[Transcript flash].
+    b enteredForegroundColor:(Color red).
+    b enteredBackgroundColor:(b backgroundColor).
+    b activeForegroundColor:(Color white).
+    b activeBackgroundColor:(Color red).
+    top open.
+
+
+  well, even that is possible (but you should never do it):
+  (notice the changing size and the resulting problem when
+   pressed near the bottom)
+
+    |top b|
+
+    top := StandardSystemView new.
+    top extent:100@100.
+
+    b := Button in:top.
+    b passiveLogo:(Image fromFile:'bitmaps/SmalltalkX.xbm').
+    b activeLogo:#('start') asStringCollection.
+    b action:[Transcript flash].
+    b enteredForegroundColor:(Color red).
+    b enteredBackgroundColor:(b backgroundColor).
+    b activeForegroundColor:(Color white).
+    b activeBackgroundColor:(Color red).
+    top open.
+
+
+  same as above, with frozen size 
+  (make certain, that the size is ok for all possible logos):
+
+    |top b|
+
+    top := StandardSystemView new.
+    top extent:100@100.
+
+    b := Button in:top.
+    b passiveLogo:(Image fromFile:'bitmaps/SmalltalkX.xbm').
+    b activeLogo:#('go') asStringCollection.
+    b action:[Transcript flash].
+    b enteredForegroundColor:(Color red).
+    b enteredBackgroundColor:(b backgroundColor).
+    b activeForegroundColor:(Color white).
+    b activeBackgroundColor:(Color red).
+    b sizeFixed:true.
+    top open.
+
+
+  more playing with colors:
+
+    |top b|
+
+    top := StandardSystemView new.
+    top extent:100@100.
+
+    b := Button in:top.
+    b passiveLogo:(Image fromFile:'bitmaps/SmalltalkX.xbm').
+    b action:[Transcript flash].
+    b foregroundColor:(Color red:0 green:80 blue:20) darkened.
+    b backgroundColor:(Color grey:10).
+    b enteredBackgroundColor:(Color grey:20).
+    b activeForegroundColor:(Color red).
+    b activeBackgroundColor:(Color grey:20).
+    top open.
+
+
+  fire on press (buttons in scrollbars do this):
+
+    |top b|
+
+    top := StandardSystemView new.
+    top extent:100@100.
+
+    b := Button label:'hello' in:top.
+    b controller beTriggerOnDown.
+    b action:[Transcript flash].
     top open.
 "
 ! !