EnterFieldGroup.st
changeset 661 27057bdde205
parent 655 acad3ef3a46c
child 675 770fec28aec8
--- a/EnterFieldGroup.st	Tue May 21 21:33:05 1996 +0200
+++ b/EnterFieldGroup.st	Tue May 21 21:33:53 1996 +0200
@@ -489,64 +489,7 @@
     "set the fields leaveAction to enable next field"
 
     aField leaveAction:[:key |
-        |next wg explicit nFields nextField|
-
-"/        currentField notNil ifTrue:[
-"/            currentField disable.
-"/            currentField hideCursor.
-"/        ].
-"/
-        action := key.
-        nFields := fields size.
-
-        ((key == #CursorUp) or:[key == #PreviousField]) ifTrue:[
-            (thisIndex == 1) ifTrue:[
-                next := nFields
-            ] ifFalse:[
-                next := thisIndex - 1
-            ]
-        ].
-        ((key == #CursorDown) 
-        or:[key == #NextField
-        or:[key == #Tab]]) ifTrue:[
-            (thisIndex == nFields) ifTrue:[
-                next := 1.
-                wrap == false ifTrue:[
-                    action := #Return.
-                ].
-            ] ifFalse:[
-                next := thisIndex + 1
-            ]
-        ].
-        ((action == #Return)
-        or:[key == #Tab and:[leaveOnTabLast == true]]) ifTrue:[
-            (thisIndex == nFields) ifTrue:[
-                leaveAction notNil ifTrue:[
-                    currentField := nil.
-                    leaveAction value.
-                    next := nil
-                ] ifFalse:[
-                    next := 1
-                ]
-            ] ifFalse:[
-                next := thisIndex + 1
-            ]
-        ].
-        next notNil ifTrue:[
-            nextField := fields at:next.
-
-            explicit := false.
-            (wg := currentField windowGroup) notNil ifTrue:[
-                wg focusView == currentField ifTrue:[
-                    explicit := true.
-                ]
-            ].
-            explicit ifTrue:[
-                wg focusView:nextField.
-            ] ifFalse:[
-                self makeActive:nextField 
-            ]
-        ]
+        self fieldLeft:aField index:thisIndex withKey:key
     ].
 
     fields size == 1 ifTrue:[
@@ -554,7 +497,7 @@
         self makeActive:aField
     ]
 
-    "Modified: 30.4.1996 / 09:24:37 / cg"
+    "Modified: 21.5.1996 / 21:18:58 / cg"
 ! !
 
 !EnterFieldGroup methodsFor:'event forwarding'!
@@ -645,6 +588,73 @@
     "Created: 27.4.1996 / 16:42:07 / cg"
 ! !
 
+!EnterFieldGroup methodsFor:'group control'!
+
+fieldLeft:aField index:thisIndex withKey:key
+    |action next wg explicit nFields nextField|
+
+"/        currentField notNil ifTrue:[
+"/            currentField disable.
+"/            currentField hideCursor.
+"/        ].
+"/
+    action := key.
+    nFields := fields size.
+
+    ((key == #CursorUp) or:[key == #PreviousField]) ifTrue:[
+        (thisIndex == 1) ifTrue:[
+            next := nFields
+        ] ifFalse:[
+            next := thisIndex - 1
+        ]
+    ].
+    ((key == #CursorDown) 
+    or:[key == #NextField
+    or:[key == #Tab]]) ifTrue:[
+        (thisIndex == nFields) ifTrue:[
+            next := 1.
+            wrap == false ifTrue:[
+                action := #Return.
+            ].
+        ] ifFalse:[
+            next := thisIndex + 1
+        ]
+    ].
+    ((action == #Return)
+    or:[key == #Tab and:[leaveOnTabLast == true]]) ifTrue:[
+        (thisIndex == nFields) ifTrue:[
+            leaveAction notNil ifTrue:[
+                self makeInactive:aField.
+                currentField := nil.
+                leaveAction value.
+                next := nil
+            ] ifFalse:[
+                next := 1
+            ]
+        ] ifFalse:[
+            next := thisIndex + 1
+        ]
+    ].
+    next notNil ifTrue:[
+        nextField := fields at:next.
+
+        explicit := false.
+        (wg := currentField windowGroup) notNil ifTrue:[
+            wg focusView == currentField ifTrue:[
+                explicit := true.
+            ]
+        ].
+        explicit ifTrue:[
+            wg focusView:nextField.
+        ] ifFalse:[
+            self makeActive:nextField 
+        ]
+    ]
+
+    "Created: 21.5.1996 / 21:18:08 / cg"
+    "Modified: 21.5.1996 / 21:21:56 / cg"
+! !
+
 !EnterFieldGroup methodsFor:'misc'!
 
 activateFirst
@@ -665,20 +675,31 @@
     currentField == aField ifTrue:[^ self].
 
     currentField notNil ifTrue:[
-"/        currentField disable.
         currentField hideCursor.
         currentField hasKeyboardFocus:false.
     ].
     currentField := aField.
-"/    currentField enable.
     currentField showCursor.
     currentField hasKeyboardFocus:true.
 
-    "Modified: 30.4.1996 / 09:24:16 / cg"
+    "Modified: 21.5.1996 / 21:21:07 / cg"
+!
+
+makeInactive:aField
+    "make a specific field inActive"
+
+    currentField == aField ifTrue:[currentField := nil].
+
+    aField notNil ifTrue:[
+        aField hideCursor.
+        aField hasKeyboardFocus:false.
+    ].
+
+    "Created: 21.5.1996 / 21:20:57 / cg"
 ! !
 
 !EnterFieldGroup class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/EnterFieldGroup.st,v 1.24 1996-05-18 15:39:03 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/EnterFieldGroup.st,v 1.25 1996-05-21 19:33:53 cg Exp $'
 ! !