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 |
12 |
|
13 'From Smalltalk/X, Version:3.2.1 on 18-oct-1997 at 3:23:15 pm' ! |
|
14 |
13 Object subclass:#EnterFieldGroup |
15 Object subclass:#EnterFieldGroup |
14 instanceVariableNames:'fields currentField leaveAction wrap leaveOnTabLast' |
16 instanceVariableNames:'fields currentField leaveAction wrap leaveOnTabLast' |
15 classVariableNames:'' |
17 classVariableNames:'' |
16 poolDictionaries:'' |
18 poolDictionaries:'' |
17 category:'Interface-Support' |
19 category:'Interface-Support' |
18 ! |
20 ! |
19 |
21 |
20 !EnterFieldGroup class methodsFor:'documentation'! |
22 !EnterFieldGroup class methodsFor:'documentation'! |
21 |
23 |
22 copyright |
24 copyright |
23 " |
25 " |
24 COPYRIGHT (c) 1992 by Claus Gittinger |
26 COPYRIGHT (c) 1992 by Claus Gittinger |
25 All Rights Reserved |
27 All Rights Reserved |
466 ! ! |
468 ! ! |
467 |
469 |
468 !EnterFieldGroup methodsFor:'adding / removing'! |
470 !EnterFieldGroup methodsFor:'adding / removing'! |
469 |
471 |
470 add:aField |
472 add:aField |
471 |thisIndex| |
473 "add another field to the group. |
|
474 Cursor motion out of the previous field will lead to the next |
|
475 one and vice versa." |
|
476 |
|
477 self add:aField before:nil |
|
478 |
|
479 "Modified: 18.10.1997 / 03:19:51 / cg" |
|
480 ! |
|
481 |
|
482 add:aField before:anotherField |
|
483 "add another field to the group into a particular position |
|
484 within the tabbing order. |
|
485 Cursor motion out of the previous field will lead to the next |
|
486 one and vice versa." |
472 |
487 |
473 fields isNil ifTrue:[ |
488 fields isNil ifTrue:[ |
474 fields := OrderedCollection new |
489 fields := OrderedCollection new |
475 ]. |
490 ]. |
476 fields add:aField. |
491 |
477 thisIndex := fields size. |
492 anotherField isNil ifTrue:[ |
|
493 fields add:aField. |
|
494 ] ifFalse:[ |
|
495 fields add:aField before:anotherField |
|
496 ]. |
478 |
497 |
479 aField delegate:self. |
498 aField delegate:self. |
480 aField hideCursor. |
499 aField hideCursor. |
481 "/ aField disable. |
500 "/ aField disable. |
482 |
501 |
487 ]. |
506 ]. |
488 |
507 |
489 "set the fields leaveAction to enable next field" |
508 "set the fields leaveAction to enable next field" |
490 |
509 |
491 aField leaveAction:[:key | |
510 aField leaveAction:[:key | |
492 self fieldLeft:aField index:thisIndex withKey:key |
511 self fieldLeft:aField withKey:key |
493 ]. |
512 ]. |
494 |
513 |
495 fields size == 1 ifTrue:[ |
514 fields size == 1 ifTrue:[ |
496 "the first one" |
515 "the first one" |
497 self makeActive:aField |
516 self makeActive:aField |
498 ] |
517 ] |
499 |
518 |
500 "Modified: 21.5.1996 / 21:18:58 / cg" |
519 "Created: 18.10.1997 / 03:06:00 / cg" |
|
520 "Modified: 18.10.1997 / 03:20:36 / cg" |
|
521 ! |
|
522 |
|
523 remove:aField |
|
524 "remove a field from the group." |
|
525 |
|
526 fields isNil ifTrue:[^ self]. |
|
527 (fields includesIdentical:aField) ifFalse:[^ self]. |
|
528 |
|
529 fields removeIdentical:aField. |
|
530 |
|
531 "Created: 18.10.1997 / 02:53:29 / cg" |
|
532 "Modified: 18.10.1997 / 03:21:09 / cg" |
501 ! ! |
533 ! ! |
502 |
534 |
503 !EnterFieldGroup methodsFor:'event forwarding'! |
535 !EnterFieldGroup methodsFor:'event forwarding'! |
504 |
536 |
505 buttonPress:button x:x y:y view:aView |
537 buttonPress:button x:x y:y view:aView |
574 "Created: 27.4.1996 / 16:42:07 / cg" |
606 "Created: 27.4.1996 / 16:42:07 / cg" |
575 ! ! |
607 ! ! |
576 |
608 |
577 !EnterFieldGroup methodsFor:'group control'! |
609 !EnterFieldGroup methodsFor:'group control'! |
578 |
610 |
579 fieldLeft:aField index:thisIndex withKey:key |
611 fieldLeft:aField withKey:key |
580 |action next wg explicit nFields nextField fs| |
612 |thisIndex action next wg explicit nFields nextField fs| |
581 |
613 |
582 "/ currentField notNil ifTrue:[ |
614 "/ currentField notNil ifTrue:[ |
583 "/ currentField disable. |
615 "/ currentField disable. |
584 "/ currentField hideCursor. |
616 "/ currentField hideCursor. |
585 "/ ]. |
617 "/ ]. |
586 "/ |
618 "/ |
587 action := key. |
619 action := key. |
588 nFields := fields size. |
620 nFields := fields size. |
|
621 thisIndex := fields indexOf:aField. |
589 |
622 |
590 "/ if there is a windowGroup, which has a focusSequence, |
623 "/ if there is a windowGroup, which has a focusSequence, |
591 "/ and the group is left, let it control who is going to get the |
624 "/ and the group is left, let it control who is going to get the |
592 "/ focus. Otherwise, stay within the group. |
625 "/ focus. Otherwise, stay within the group. |
593 |
626 |