7 inclusion of the above copyright notice. This software may not |
7 inclusion of the above copyright notice. This software may not |
8 be provided or otherwise made available to, or used by, any |
8 be provided or otherwise made available to, or used by, any |
9 other person. No title to or ownership of the software is |
9 other person. No title to or ownership of the software is |
10 hereby transferred. |
10 hereby transferred. |
11 " |
11 " |
|
12 "{ Package: 'stx:libwidg' }" |
12 |
13 |
13 Object subclass:#EnterFieldGroup |
14 Object subclass:#EnterFieldGroup |
14 instanceVariableNames:'fields currentField leaveAction wrap leaveOnTabLast' |
15 instanceVariableNames:'fields currentField leaveAction wrap leaveOnTabLast' |
15 classVariableNames:'' |
16 classVariableNames:'' |
16 poolDictionaries:'' |
17 poolDictionaries:'' |
610 "some of my fields was left using key. |
611 "some of my fields was left using key. |
611 Figure out, which one to give the focus: |
612 Figure out, which one to give the focus: |
612 If there are more fields, go to that one; |
613 If there are more fields, go to that one; |
613 otherwise, handle this like tabbing to the next component" |
614 otherwise, handle this like tabbing to the next component" |
614 |
615 |
615 |thisIndex action next wg explicit nFields nextField fs |
616 |thisIndex action next wg explicit nFields nextField delta| |
616 delta| |
|
617 |
617 |
618 action := key. |
618 action := key. |
619 nFields := fields size. |
619 nFields := fields size. |
620 thisIndex := fields indexOf:aField. |
620 thisIndex := fields indexOf:aField. |
621 |
|
622 "/ if there is a windowGroup, which has a focusSequence, |
|
623 "/ and the group is left, let it control who is going to get the |
|
624 "/ focus. Otherwise, stay within the group. |
|
625 "/ Q: is this a good idea (or should we always stay here) ? |
|
626 |
|
627 ((wg := aField windowGroup) notNil |
|
628 and:[(fs := wg focusSequence) notNil |
|
629 and:[fs includesIdentical:aField]]) ifTrue:[ |
|
630 ((key == #CursorUp) or:[key == #PreviousField]) ifTrue:[ |
|
631 (thisIndex == 1) ifTrue:[ |
|
632 ^ wg focusPreviousFrom:aField |
|
633 ]. |
|
634 ]. |
|
635 ((key == #CursorDown) |
|
636 or:[key == #NextField |
|
637 or:[key == #Tab]]) ifTrue:[ |
|
638 (thisIndex == nFields) ifTrue:[ |
|
639 ^ wg focusNextFrom:aField |
|
640 ]. |
|
641 ]. |
|
642 ]. |
|
643 |
621 |
644 ((key == #CursorUp) or:[key == #PreviousField]) ifTrue:[ |
622 ((key == #CursorUp) or:[key == #PreviousField]) ifTrue:[ |
645 delta := -1. |
623 delta := -1. |
646 (thisIndex == 1) ifTrue:[ |
624 (thisIndex == 1) ifTrue:[ |
647 next := nFields |
625 next := nFields |