handle disabled state
authorClaus Gittinger <cg@exept.de>
Fri, 09 Feb 1996 02:10:36 +0100
changeset 333 f1c500f177d8
parent 332 284baf841664
child 334 65bb9656a30e
handle disabled state
EditField.st
--- a/EditField.st	Thu Feb 08 22:08:41 1996 +0100
+++ b/EditField.st	Fri Feb 09 02:10:36 1996 +0100
@@ -180,440 +180,444 @@
 
     basic field in some view:
 
-	|top field|
+        |top field|
 
-	top := StandardSystemView new.
-	top extent:200@100.
+        top := StandardSystemView new.
+        top extent:200@100.
 
-	field := EditField origin:0.0@0.0 in:top.
-	field width:1.0.                                'let its height as-is'.
+        field := EditField origin:0.0@0.0 in:top.
+        field width:1.0.                                'let its height as-is'.
 
-	top open
+        top open
 
 
     forward input in topView to the field:
     (currently, the field does not know this - therefore,
      its been told here ... this may change)
 
-	|top field|
+        |top field|
 
-	top := StandardSystemView new.
-	top extent:200@100.
+        top := StandardSystemView new.
+        top extent:200@100.
 
-	field := EditField origin:0.0@0.0 in:top.
-	field width:1.0.                                'let its height as-is'.
+        field := EditField origin:0.0@0.0 in:top.
+        field width:1.0.                                'let its height as-is'.
 
-	top delegate:(KeyboardForwarder toView:field).
-	field hasKeyboardFocus:true.
-	top open
+        top delegate:(KeyboardForwarder toView:field).
+        field hasKeyboardFocus:true.
+        top open
 
 
     to make it look better: set some inset:
 
-	|top field spacing|
+        |top field spacing|
 
-	top := StandardSystemView new.
-	top extent:200@100.
+        top := StandardSystemView new.
+        top extent:200@100.
 
-	spacing := View viewSpacing.
-	field := EditField origin:(0.0 @ spacing) in:top.
-	field width:1.0.                                        'let its height as-is'.
-	field leftInset:spacing; rightInset:spacing.
+        spacing := View viewSpacing.
+        field := EditField origin:(0.0 @ spacing) in:top.
+        field width:1.0.                                        'let its height as-is'.
+        field leftInset:spacing; rightInset:spacing.
 
-	top open
+        top open
 
 
     give it an initial contents:
 
-	|top field|
+        |top field|
 
-	top := StandardSystemView new.
-	top extent:200@100.
+        top := StandardSystemView new.
+        top extent:200@100.
 
-	field := EditField origin:(0.0 @ 0@0) in:top.
-	field width:1.0.       
+        field := EditField origin:(0.0 @ 0@0) in:top.
+        field width:1.0.       
 
-	field editValue:'hello world'.
+        field editValue:'hello world'.
 
-	top open
+        top open
 
 
     have it preselected:
 
-	|top field|
+        |top field|
 
-	top := StandardSystemView new.
-	top extent:200@100.
+        top := StandardSystemView new.
+        top extent:200@100.
 
-	field := EditField origin:(0.0 @ 0.0) in:top.
-	field width:1.0.     
-	field editValue:'hello world' selected:true.
+        field := EditField origin:(0.0 @ 0.0) in:top.
+        field width:1.0.     
+        field editValue:'hello world' selected:true.
 
-	top open
+        top open
 
 
     have part of it preselected:
 
-	|top field|
+        |top field|
 
-	top := StandardSystemView new.
-	top extent:200@100.
+        top := StandardSystemView new.
+        top extent:200@100.
 
-	field := EditField origin:(0.0 @ 0.0) in:top.
-	field width:1.0.     
+        field := EditField origin:(0.0 @ 0.0) in:top.
+        field width:1.0.     
 
-	field editValue:'hello world'.
-	field selectFromCharacterPosition:1 to:5.
+        field editValue:'hello world'.
+        field selectFromCharacterPosition:1 to:5.
 
-	top open
+        top open
 
 
     set a size limit:
 
-	|top field|
+        |top field|
 
-	top := StandardSystemView new.
-	top extent:200@100.
+        top := StandardSystemView new.
+        top extent:200@100.
 
-	field := EditField origin:(0.0 @ 0.0) in:top.
-	field width:1.0.     
-	field editValue:'hello'.
+        field := EditField origin:(0.0 @ 0.0) in:top.
+        field width:1.0.     
+        field editValue:'hello'.
 
-	field maxChars:8.
+        field maxChars:8.
 
-	top open
+        top open
 
 
     set a size limit, initial width and stop it from scrolling
     notice: you may prefer a constant-pitch font (such as courier):
 
-	|top field|
+        |top field|
 
-	top := StandardSystemView new.
-	top extent:200@100.
+        top := StandardSystemView new.
+        top extent:200@100.
 
-	field := EditField origin:(0.0 @ 0.0) in:top.
-	field innerWidth:(field font widthOf:'00000000').     
-	field editValue:'12345678'.
+        field := EditField origin:(0.0 @ 0.0) in:top.
+        field innerWidth:(field font widthOf:'00000000').     
+        field editValue:'12345678'.
 
-	field maxChars:8.
-	field autoScroll:false.
+        field maxChars:8.
+        field autoScroll:false.
 
-	top open
+        top open
 
 
     enable / disable:
 
-	|top panel check field ena|
+        |top panel check field ena|
+
+        top := StandardSystemView new.
+        top extent:200@100.
 
-	top := StandardSystemView new.
-	top extent:200@100.
-
-	panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
-	panel horizontalLayout:#leftSpace.
+        panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
+        panel borderWidth:0.
+        panel horizontalLayout:#left.
+        panel horizontalInset:View viewSpacing.
 
-	check := CheckBox label:'enable' in:panel.
-	check turnOn.
-	check action:[:onOff | onOff ifTrue:[field enable] ifFalse:[field disable]].
+        check := CheckBox label:'enable' in:panel.
+        check turnOn.
+        check action:[:onOff | onOff ifTrue:[field enable] ifFalse:[field disable]].
 
-	panel add:(View new height:30).
+        panel add:(View new height:30; borderWidth:0).
 
-	field := EditField in:panel.
-	field width:1.0.     
-	field editValue:'hello'.
+        field := EditField in:panel.
+        field width:1.0.     
+        field editValue:'hello'.
         
-	top open
+        top open
 
 
     enable / disable using a channel:
 
-	|top panel check field ena|
+        |top panel check field ena|
 
-	top := StandardSystemView new.
-	top extent:200@100.
+        top := StandardSystemView new.
+        top extent:200@100.
 
-	panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
-	panel horizontalLayout:#leftSpace.
+        panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
+        panel borderWidth:0.
+        panel horizontalLayout:#left.
+        panel horizontalInset:View viewSpacing.
 
-	ena := true asValue.
+        ena := true asValue.
 
-	check := CheckBox label:'enable' in:panel.
-	check model:ena.
+        check := CheckBox label:'enable' in:panel.
+        check model:ena.
 
-	panel add:(View new height:30).
+        panel add:(View new height:30; borderWidth:0).
 
-	field := EditField in:panel.
-	field enableChannel:ena.
-	field width:1.0.     
-	field editValue:'hello'.
+        field := EditField in:panel.
+        field enableChannel:ena.
+        field width:1.0.     
+        field editValue:'hello'.
 
-	top open
+        top open
 
 
     use a converter:
       - numbers (default to 0):
 
-	|top field|
+        |top field|
 
-	top := StandardSystemView new.
-	top extent:200@100.
+        top := StandardSystemView new.
+        top extent:200@100.
 
-	field := EditField origin:0.0@ViewSpacing in:top.
-	field width:1.0.
-	field leftInset:ViewSpacing;
-	      rightInset:ViewSpacing.
+        field := EditField origin:0.0@ViewSpacing in:top.
+        field width:1.0.
+        field leftInset:ViewSpacing;
+              rightInset:ViewSpacing.
 
-	field converter:(PrintConverter new initForNumber).
-	field editValue:1234.
-	field acceptAction:[:value | Transcript showCr:value].
-	field crAction:[field accept. top destroy].
-	top open.
+        field converter:(PrintConverter new initForNumber).
+        field editValue:1234.
+        field acceptAction:[:value | Transcript showCr:value].
+        field crAction:[field accept. top destroy].
+        top open.
 
       - dates:
 
-	|top field|
+        |top field|
 
-	top := StandardSystemView new.
-	top extent:200@100.
+        top := StandardSystemView new.
+        top extent:200@100.
 
-	field := EditField origin:0.0@ViewSpacing in:top.
-	field width:1.0.
-	field leftInset:ViewSpacing;
-	      rightInset:ViewSpacing.
+        field := EditField origin:0.0@ViewSpacing in:top.
+        field width:1.0.
+        field leftInset:ViewSpacing;
+              rightInset:ViewSpacing.
 
-	field converter:(PrintConverter new initForDate).
-	field editValue:Date today.
-	field acceptAction:[:value | Transcript showCr:value class name , ' ' , value printString].
-	field crAction:[field accept. top destroy].
-	top open.
+        field converter:(PrintConverter new initForDate).
+        field editValue:Date today.
+        field acceptAction:[:value | Transcript showCr:value class name , ' ' , value printString].
+        field crAction:[field accept. top destroy].
+        top open.
 
 
     setting immediateAccept, makes the field update with every key:
 
       - immediate accept numbers, defaulting to nil:
 
-	|top field|
+        |top field|
 
-	top := StandardSystemView new.
-	top extent:200@100.
+        top := StandardSystemView new.
+        top extent:200@100.
 
-	field := EditField origin:0.0@ViewSpacing in:top.
-	field width:1.0.
-	field leftInset:ViewSpacing;
-	      rightInset:ViewSpacing.
+        field := EditField origin:0.0@ViewSpacing in:top.
+        field width:1.0.
+        field leftInset:ViewSpacing;
+              rightInset:ViewSpacing.
 
-	field converter:(PrintConverter new initForNumberOrNil).
-	field immediateAccept:true.
-	field editValue:1234.
-	field acceptAction:[:value | Transcript showCr:value].
-	field crAction:[field accept. top destroy].
-	top open.
+        field converter:(PrintConverter new initForNumberOrNil).
+        field immediateAccept:true.
+        field editValue:1234.
+        field acceptAction:[:value | Transcript showCr:value].
+        field crAction:[field accept. top destroy].
+        top open.
 
 
 
     grouping multiple fields, and forward keyPres from the outer view to the active field
     (i.e. actually: to the group):
 
-	|top field1 field2 field3 group|
+        |top field1 field2 field3 group|
 
 
-	top := StandardSystemView new.
-	top extent:200@100.
+        top := StandardSystemView new.
+        top extent:200@100.
 
-	field1 := EditField origin:(0.0 @ 0.0) in:top.
-	field1 width:1.0.
+        field1 := EditField origin:(0.0 @ 0.0) in:top.
+        field1 width:1.0.
 
-	field2 := EditField origin:(0.0 @ 0.0) in:top.
-	field2 width:0.5.
-	field2 topInset:(field1 height); bottomInset:(field1 height negated).
+        field2 := EditField origin:(0.0 @ 0.0) in:top.
+        field2 width:0.5.
+        field2 topInset:(field1 height); bottomInset:(field1 height negated).
 
-	field3 := EditField origin:(0.5 @ 0.0) in:top.
-	field3 width:0.5.
-	field3 topInset:(field1 height); bottomInset:(field1 height negated).
+        field3 := EditField origin:(0.5 @ 0.0) in:top.
+        field3 width:0.5.
+        field3 topInset:(field1 height); bottomInset:(field1 height negated).
 
-	group := EnterFieldGroup new.
-	group add:field1; add:field2; add:field3.
+        group := EnterFieldGroup new.
+        group add:field1; add:field2; add:field3.
 
-	top delegate:(KeyboardForwarder to:group).
+        top delegate:(KeyboardForwarder to:group).
 
-	top open.
+        top open.
 
         
     in addition: tell the group to close when the last field is left:
 
-	|top field1 field2 field3 group|
+        |top field1 field2 field3 group|
 
 
-	top := StandardSystemView new.
-	top extent:200@100.
+        top := StandardSystemView new.
+        top extent:200@100.
 
-	field1 := EditField origin:(0.0 @ 0.0) in:top.
-	field1 width:1.0.
+        field1 := EditField origin:(0.0 @ 0.0) in:top.
+        field1 width:1.0.
 
-	field2 := EditField origin:(0.0 @ 0.0) in:top.
-	field2 width:0.5.
-	field2 topInset:(field1 height); bottomInset:(field1 height negated).
+        field2 := EditField origin:(0.0 @ 0.0) in:top.
+        field2 width:0.5.
+        field2 topInset:(field1 height); bottomInset:(field1 height negated).
 
-	field3 := EditField origin:(0.5 @ 0.0) in:top.
-	field3 width:0.5.
-	field3 topInset:(field1 height); bottomInset:(field1 height negated).
+        field3 := EditField origin:(0.5 @ 0.0) in:top.
+        field3 width:0.5.
+        field3 topInset:(field1 height); bottomInset:(field1 height negated).
 
-	group := EnterFieldGroup new.
-	group add:field1; add:field2; add:field3.
-	group leaveAction:[top destroy].
+        group := EnterFieldGroup new.
+        group add:field1; add:field2; add:field3.
+        group leaveAction:[top destroy].
 
-	top delegate:(KeyboardForwarder to:group).
+        top delegate:(KeyboardForwarder to:group).
 
-	top open.
+        top open.
 
 
     use a model:
     (see changing model value in inspector when return is pressed in the field)
 
-	|top field model|
+        |top field model|
 
-	model := 'hello world' asValue.
+        model := 'hello world' asValue.
 
-	top := StandardSystemView new.
-	top extent:200@100.
+        top := StandardSystemView new.
+        top extent:200@100.
 
-	field := EditField origin:(0.0 @ 0.0) in:top.
-	field width:1.0.
-	field model:model.
-	field acceptOnReturn:true.
+        field := EditField origin:(0.0 @ 0.0) in:top.
+        field width:1.0.
+        field model:model.
+        field acceptOnReturn:true.
 
-	top open.
-	model inspect.
+        top open.
+        model inspect.
 
 
     two views on the same model (each accepts on return):
 
-	|top1 top2 field1 field2 model|
+        |top1 top2 field1 field2 model|
 
-	model := 'hello world' asValue.
+        model := 'hello world' asValue.
 
-	top1 := StandardSystemView new.
-	top1 extent:200@100.
-	field1 := EditField origin:(0.0 @ 0.0) in:top1.
-	field1 width:1.0.
-	field1 model:model.
-	field1 acceptOnReturn:true.
-	top1 open.
+        top1 := StandardSystemView new.
+        top1 extent:200@100.
+        field1 := EditField origin:(0.0 @ 0.0) in:top1.
+        field1 width:1.0.
+        field1 model:model.
+        field1 acceptOnReturn:true.
+        top1 open.
 
-	top2 := StandardSystemView new.
-	top2 extent:200@100.
-	field2 := EditField origin:(0.0 @ 0.0) in:top2.
-	field2 width:1.0.
-	field2 model:model.
-	field2 acceptOnReturn:true.
-	top2 open.
+        top2 := StandardSystemView new.
+        top2 extent:200@100.
+        field2 := EditField origin:(0.0 @ 0.0) in:top2.
+        field2 width:1.0.
+        field2 model:model.
+        field2 acceptOnReturn:true.
+        top2 open.
 
     two views on the same model (no accept on return):
 
-	|top1 top2 field1 field2 model|
+        |top1 top2 field1 field2 model|
 
-	model := 'hello world' asValue.
+        model := 'hello world' asValue.
 
-	top1 := StandardSystemView new.
-	top1 extent:200@100.
-	field1 := EditField origin:(0.0 @ 0.0) in:top1.
-	field1 width:1.0.
-	field1 model:model; acceptOnReturn:false.
-	top1 open.
+        top1 := StandardSystemView new.
+        top1 extent:200@100.
+        field1 := EditField origin:(0.0 @ 0.0) in:top1.
+        field1 width:1.0.
+        field1 model:model; acceptOnReturn:false.
+        top1 open.
 
-	top2 := StandardSystemView new.
-	top2 extent:200@100.
-	field2 := EditField origin:(0.0 @ 0.0) in:top2.
-	field2 width:1.0.
-	field2 model:model; acceptOnReturn:false.
-	top2 open.
+        top2 := StandardSystemView new.
+        top2 extent:200@100.
+        field2 := EditField origin:(0.0 @ 0.0) in:top2.
+        field2 width:1.0.
+        field2 model:model; acceptOnReturn:false.
+        top2 open.
 
     with immediate accept (every key updates the model):
 
-	|top1 top2 field1 field2 model|
+        |top1 top2 field1 field2 model|
 
-	model := 'hello world' asValue.
+        model := 'hello world' asValue.
 
-	top1 := StandardSystemView new.
-	top1 extent:200@100.
-	field1 := EditField origin:(0.0 @ 0.0) in:top1.
-	field1 width:1.0.
-	field1 model:model; immediateAccept:true.
-	top1 open.
+        top1 := StandardSystemView new.
+        top1 extent:200@100.
+        field1 := EditField origin:(0.0 @ 0.0) in:top1.
+        field1 width:1.0.
+        field1 model:model; immediateAccept:true.
+        top1 open.
 
-	top2 := StandardSystemView new.
-	top2 extent:200@100.
-	field2 := EditField origin:(0.0 @ 0.0) in:top2.
-	field2 width:1.0.
-	field2 model:model; immediateAccept:true.
-	top2 open.
+        top2 := StandardSystemView new.
+        top2 extent:200@100.
+        field2 := EditField origin:(0.0 @ 0.0) in:top2.
+        field2 width:1.0.
+        field2 model:model; immediateAccept:true.
+        top2 open.
 
     just an example; a checkBox and an editField on the same model:
 
-	|top1 top2 field1 box model|
+        |top1 top2 field1 box model|
 
-	model := false asValue.
+        model := false asValue.
 
-	top1 := StandardSystemView new.
-	top1 extent:200@100.
-	field1 := EditField origin:(0.0 @ 0.0) in:top1.
-	field1 width:1.0.
-	field1 converter:(PrintConverter new initForYesNo).
-	field1 model:model.
-	top1 open.
+        top1 := StandardSystemView new.
+        top1 extent:200@100.
+        field1 := EditField origin:(0.0 @ 0.0) in:top1.
+        field1 width:1.0.
+        field1 converter:(PrintConverter new initForYesNo).
+        field1 model:model.
+        top1 open.
 
-	top2 := StandardSystemView new.
-	top2 extent:200@100.
-	box := CheckBox on:model.
-	box label:'on/off'.
-	top2 add:box.
-	top2 open.
+        top2 := StandardSystemView new.
+        top2 extent:200@100.
+        box := CheckBox on:model.
+        box label:'on/off'.
+        top2 add:box.
+        top2 open.
 
-	model inspect.
+        model inspect.
 
 
     multiple editFields on multiple models (value holders):
     (the fields are connected by a group to allow tabbing)
 
-	|top panel group field1 field2 field3 box v1 v2 v3|
+        |top panel group field1 field2 field3 box v1 v2 v3|
 
-	v1 := true asValue.
-	v2 := 'some string' asValue.
-	v3 := 1.2 asValue.
+        v1 := true asValue.
+        v2 := 'some string' asValue.
+        v3 := 1.2 asValue.
 
-	top := StandardSystemView new.
-	top extent:200@100.
+        top := StandardSystemView new.
+        top extent:200@100.
 
-	panel := VerticalPanelView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
+        panel := VerticalPanelView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
 
-	field1 := EditField new.
-	field1 width:1.0.
-	field1 horizontalInset:ViewSpacing.
-	field1 converter:(PrintConverter new initForYesNo).
-	field1 model:v1.
-	panel add:field1.
+        field1 := EditField new.
+        field1 width:1.0.
+        field1 horizontalInset:ViewSpacing.
+        field1 converter:(PrintConverter new initForYesNo).
+        field1 model:v1.
+        panel add:field1.
 
-	field2 := EditField new.
-	field2 width:1.0.
-	field2 horizontalInset:ViewSpacing.
-	field2 model:v2.
-	panel add:field2.
+        field2 := EditField new.
+        field2 width:1.0.
+        field2 horizontalInset:ViewSpacing.
+        field2 model:v2.
+        panel add:field2.
 
-	field3 := EditField new.
-	field3 width:1.0.
-	field3 horizontalInset:ViewSpacing.
-	field3 converter:(PrintConverter new initForNumber).
-	field3 model:v3.
-	panel add:field3.
+        field3 := EditField new.
+        field3 width:1.0.
+        field3 horizontalInset:ViewSpacing.
+        field3 converter:(PrintConverter new initForNumber).
+        field3 model:v3.
+        panel add:field3.
 
-	group := EnterFieldGroup new.
-	group add:field1; add:field2; add:field3.
+        group := EnterFieldGroup new.
+        group add:field1; add:field2; add:field3.
 
-	top openModal.
+        top openModal.
 
-	Transcript showCr:v1 value.
-	Transcript showCr:v2 value.
-	Transcript showCr:v3 value.
+        Transcript showCr:v1 value.
+        Transcript showCr:v2 value.
+        Transcript showCr:v3 value.
 
 
     connecting fields:
@@ -622,81 +626,81 @@
      class, or in a complex model. For the demonstration below, we use
      a Plug to simulate the protocol.)
 
-	|application top field1 field2 value1 value2|
+        |application top field1 field2 value1 value2|
 
-	application := Plug new.
-	application respondTo:#value1Changed
-			 with:[value2 value:(value1 value isNil ifTrue:[nil]
-								ifFalse:[value1 value squared])].
+        application := Plug new.
+        application respondTo:#value1Changed
+                         with:[value2 value:(value1 value isNil ifTrue:[nil]
+                                                                ifFalse:[value1 value squared])].
 
-	value1 := 1 asValue.
-	value2 := 1 asValue.
+        value1 := 1 asValue.
+        value2 := 1 asValue.
 
-	top := Dialog new.
-	top extent:200@200.
+        top := Dialog new.
+        top extent:200@200.
 
-	(top addTextLabel:'some number:') layout:#left.
-	top addVerticalSpace.
+        (top addTextLabel:'some number:') layout:#left.
+        top addVerticalSpace.
 
-	(top addInputFieldOn:value1 tabable:false) 
-	    converter:(PrintConverter new initForNumberOrNil);
-	    immediateAccept:true.
-	top addVerticalSpace.
+        (top addInputFieldOn:value1 tabable:false) 
+            converter:(PrintConverter new initForNumberOrNil);
+            immediateAccept:true.
+        top addVerticalSpace.
 
-	(top addTextLabel:'squared:') layout:#left.
-	top addVerticalSpace.
-	(top addInputFieldOn:value2 tabable:false) 
-	    converter:(PrintConverter new initForNumberOrNil).
+        (top addTextLabel:'squared:') layout:#left.
+        top addVerticalSpace.
+        (top addInputFieldOn:value2 tabable:false) 
+            converter:(PrintConverter new initForNumberOrNil).
 
-	value1 onChangeSend:#value1Changed to:application.
+        value1 onChangeSend:#value1Changed to:application.
 
-	top openModeless.
+        top openModeless.
 
 
     two-way connect:
     each field updates the other (notice, that we have to turn off
     onChange: notification, to avoid an endless notification cycle)
 
-	|application top field1 field2 value1 value2|
+        |application top field1 field2 value1 value2|
 
-	application := Plug new.
-	application respondTo:#value1Changed
-			 with:[value2 retractInterestsFor:application.
-			       value2 value:(value1 value isNil ifTrue:[nil]
-								ifFalse:[value1 value squared]).
-			       value2 onChangeSend:#value2Changed to:application.
-			      ].
-	application respondTo:#value2Changed
-			 with:[value1 retractInterestsFor:application.
-			       value1 value:(value2 value isNil ifTrue:[nil]
-								ifFalse:[value2 value sqrt]).
-			       value1 onChangeSend:#value1Changed to:application.
-			      ].
+        application := Plug new.
+        application respondTo:#value1Changed
+                         with:[value2 retractInterestsFor:application.
+                               value2 value:(value1 value isNil ifTrue:[nil]
+                                                                ifFalse:[value1 value squared]).
+                               value2 onChangeSend:#value2Changed to:application.
+                              ].
+        application respondTo:#value2Changed
+                         with:[value1 retractInterestsFor:application.
+                               value1 value:(value2 value isNil ifTrue:[nil]
+                                                                ifFalse:[value2 value sqrt]).
+                               value1 onChangeSend:#value1Changed to:application.
+                              ].
 
-	value1 := 1 asValue.
-	value2 := 1 asValue.
+        value1 := 1 asValue.
+        value2 := 1 asValue.
 
-	top := Dialog new.
-	top extent:200@200.
+        top := Dialog new.
+        top extent:200@200.
 
-	(top addTextLabel:'some number:') layout:#left.
-	top addVerticalSpace.
+        (top addTextLabel:'some number:') layout:#left.
+        top addVerticalSpace.
 
-	(top addInputFieldOn:value1 tabable:false) 
-	    converter:(PrintConverter new initForNumberOrNil);
-	    immediateAccept:true.
-	top addVerticalSpace.
+        (top addInputFieldOn:value1 tabable:false) 
+            converter:(PrintConverter new initForNumberOrNil);
+            immediateAccept:true.
+        top addVerticalSpace.
 
-	(top addTextLabel:'squared:') layout:#left.
-	top addVerticalSpace.
-	(top addInputFieldOn:value2 tabable:false) 
-	    converter:(PrintConverter new initForNumberOrNil);
-	    immediateAccept:true.
+        (top addTextLabel:'squared:') layout:#left.
+        top addVerticalSpace.
+        (top addInputFieldOn:value2 tabable:false) 
+            converter:(PrintConverter new initForNumberOrNil);
+            immediateAccept:true.
 
-	value1 onChangeSend:#value1Changed to:application.
-	value2 onChangeSend:#value2Changed to:application.
+        value1 onChangeSend:#value1Changed to:application.
+        value2 onChangeSend:#value2Changed to:application.
 
-	top openModeless.
+        top openModeless.
 "
 ! !
 
@@ -1159,8 +1163,12 @@
 buttonPress:button x:x y:y
     "enable myself on mouse click"
 
+    enabled ifFalse:[
+        ^ self
+    ].
+
     clickAction notNil ifTrue:[
-	clickAction value:self
+        clickAction value:self
     ].
     super buttonPress:button x:x y:y
 
@@ -1173,6 +1181,8 @@
 "/    ] ifTrue:[
 "/        super buttonPress:button x:x y:y
 "/    ]
+
+    "Modified: 9.2.1996 / 01:51:20 / cg"
 !
 
 canHandle:aKey
@@ -1346,9 +1356,13 @@
     "/ giving me the focus is loke clicking on me
     "/ (tell my enterFieldGroup ....
 
-    clickAction notNil ifTrue:[clickAction value:self].
-    self showCursor.
-    super showFocus:explicit
+    enabled ifTrue:[
+        clickAction notNil ifTrue:[clickAction value:self].
+        self showCursor.
+        super showFocus:explicit
+    ]
+
+    "Modified: 9.2.1996 / 01:45:58 / cg"
 ! !
 
 !EditField methodsFor:'initialization'!
@@ -1357,36 +1371,41 @@
     |labels selectors m|
 
     labels := #(
-		'copy'
-		'cut'
-		'paste'
+                'copy'
+                'cut'
+                'paste'
 "
-		'replace'
+                'replace'
 "
-		'-'
-		'accept'
-	       ).
+                '-'
+                'accept'
+               ).
 
      selectors := #(
-		 copySelection
-		 cut
-		 paste
+                 copySelection
+                 cut
+                 paste
 "
-		 replace
+                 replace
 "
-		 nil
-		 accept
-		).
+                 nil
+                 accept
+                ).
 
     m := PopUpMenu 
-	  labels:(resources array:labels)
-	  selectors:selectors.
+          labels:(resources array:labels)
+          selectors:selectors.
 
     self hasSelection ifFalse:[
-	m disableAll:#(copySelection cut)
+        m disableAll:#(copySelection cut)
+    ].
+    enabled ifFalse:[
+        m disableAll:#(cut paste accept)
     ].
 
     ^ m
+
+    "Modified: 9.2.1996 / 01:50:10 / cg"
 !
 
 initStyle
@@ -1571,5 +1590,5 @@
 !EditField class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/EditField.st,v 1.44 1996-02-07 18:37:45 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/EditField.st,v 1.45 1996-02-09 01:10:36 cg Exp $'
 ! !