diff -r b0df262350a1 -r 36c8fa86d629 EnterFieldGroup.st --- a/EnterFieldGroup.st Fri Sep 18 20:35:58 1998 +0200 +++ b/EnterFieldGroup.st Fri Sep 18 21:02:28 1998 +0200 @@ -569,7 +569,7 @@ currentField keyPress:key x:nil y:nil ] - "Modified: 4.3.1996 / 22:18:22 / cg" + "Modified: / 18.9.1998 / 20:00:36 / cg" ! keyRelease:key x:x y:y view:aView @@ -612,7 +612,8 @@ If there are more fields, go to that one; otherwise, handle this like tabbing to the next component" - |thisIndex action next wg explicit nFields nextField fs| + |thisIndex action next wg explicit nFields nextField fs + delta| "/ currentField notNil ifTrue:[ "/ currentField disable. @@ -646,15 +647,18 @@ ]. ((key == #CursorUp) or:[key == #PreviousField]) ifTrue:[ + delta := -1. (thisIndex == 1) ifTrue:[ next := nFields ] ifFalse:[ next := thisIndex - 1 ] ]. + ((key == #CursorDown) or:[key == #NextField or:[key == #Tab]]) ifTrue:[ + delta := 1. (thisIndex == nFields) ifTrue:[ next := 1. wrap == false ifTrue:[ @@ -666,6 +670,7 @@ ]. ((action == #Return) or:[key == #Tab and:[leaveOnTabLast == true]]) ifTrue:[ + delta := 1. (thisIndex == nFields) ifTrue:[ leaveAction notNil ifTrue:[ self makeInactive:aField. @@ -679,9 +684,37 @@ next := thisIndex + 1 ] ]. + next notNil ifTrue:[ + "/ search for the next enabled field + nextField := fields at:next. + [nextField notNil + and:[nextField enabled not + or:[nextField realized not]]] whileTrue:[ + next := next + delta. + next < 1 ifTrue:[ + next := fields size. + ] ifFalse:[ + next > fields size ifTrue:[ + next := 1 + ] + ]. + next == thisIndex ifTrue:[ + nextField := next := nil + ] ifFalse:[ + nextField := fields at:next. + ] + ]. + next isNil ifTrue:[ + delta < 0 ifTrue:[ + ^ wg focusPreviousFrom:aField + ]. + ^ wg focusNextFrom:aField. + ]. + + nextField := fields at:next. explicit := false. (wg := currentField windowGroup) notNil ifTrue:[ wg focusView == currentField ifTrue:[ @@ -696,7 +729,7 @@ ] "Created: / 18.10.1997 / 03:03:34 / cg" - "Modified: / 4.8.1998 / 02:43:30 / cg" + "Modified: / 18.9.1998 / 20:16:48 / cg" ! ! !EnterFieldGroup methodsFor:'misc'! @@ -733,6 +766,13 @@ "Created: 22.5.1996 / 19:04:05 / cg" ! +delegatesTo:aView + ^ aView == currentField + + "Created: / 18.9.1998 / 19:57:49 / cg" + "Modified: / 18.9.1998 / 19:58:23 / cg" +! + makeInactive "make the current field inActive (take its focus)" @@ -776,5 +816,5 @@ !EnterFieldGroup class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libwidg/EnterFieldGroup.st,v 1.33 1998-08-13 19:24:44 cg Exp $' + ^ '$Header: /cvs/stx/stx/libwidg/EnterFieldGroup.st,v 1.34 1998-09-18 19:02:28 cg Exp $' ! !