View.st
changeset 6790 4f1842a7dbf3
parent 6743 5e81c856acce
child 6844 69c6ab874e20
equal deleted inserted replaced
6789:a1d3aeba44c8 6790:4f1842a7dbf3
   736 
   736 
   737 ! !
   737 ! !
   738 
   738 
   739 !View methodsFor:'initialization & release'!
   739 !View methodsFor:'initialization & release'!
   740 
   740 
   741 assignKeyboardFocusTo:aConsumer
       
   742     |wg|
       
   743 
       
   744     wg := self windowGroup .
       
   745     self graphicsDevice isWindowsPlatform ifTrue:[
       
   746         wg focusView:aConsumer byTab:true.
       
   747     ] ifFalse:[
       
   748         aConsumer requestFocus.
       
   749         "/ consumer requestFocus. - could be denied; but we force it here
       
   750         wg focusView:aConsumer byTab:false.
       
   751     ].
       
   752 !
       
   753 
       
   754 assignKeyboardFocusToFirstInputField
       
   755     "assign the keyboard focus to the first first keyboardConsumer.
       
   756      (in older versions, this used to favour inputfields over editFields;
       
   757       see (or redefine) preferFirstInputFieldWhenAssigningInitialFocus)"
       
   758 
       
   759     |firstInputField firstConsumer firstCursorConsumer consumer|
       
   760 
       
   761     self allSubViewsDo:[:v |
       
   762         v shown ifTrue:[
       
   763             (firstInputField isNil and:[v isInputField]) ifTrue:[
       
   764                 firstInputField := v
       
   765             ].
       
   766             (firstConsumer isNil and:[v isKeyboardConsumer]) ifTrue:[
       
   767                 firstConsumer := v
       
   768             ].
       
   769             (firstCursorConsumer isNil and:[v isCursorKeyConsumer]) ifTrue:[
       
   770                 firstCursorConsumer := v
       
   771             ].
       
   772         ].
       
   773     ].
       
   774     (firstInputField notNil and:[self preferFirstInputFieldWhenAssigningInitialFocus]) ifTrue:[
       
   775         consumer := firstInputField.
       
   776     ].
       
   777     consumer := (consumer ? firstConsumer ? firstCursorConsumer).
       
   778     "/ Transcript showCR:consumer.
       
   779     consumer notNil ifTrue:[
       
   780         self assignKeyboardFocusTo:consumer
       
   781     ].
       
   782 
       
   783     "Modified: / 29-08-2006 / 14:32:30 / cg"
       
   784 !
       
   785 
       
   786 initialize
   741 initialize
   787     super initialize.
   742     super initialize.
   788 
   743 
   789     aspectMsg := self class defaultAspectMessage.
   744     aspectMsg := self class defaultAspectMessage.
   790     changeMsg := self class defaultChangeMessage.
   745     changeMsg := self class defaultChangeMessage.
   824 ! !
   779 ! !
   825 
   780 
   826 !View class methodsFor:'documentation'!
   781 !View class methodsFor:'documentation'!
   827 
   782 
   828 version
   783 version
   829     ^ '$Header: /cvs/stx/stx/libview/View.st,v 1.88 2015-01-12 10:29:06 cg Exp $'
   784     ^ '$Header: /cvs/stx/stx/libview/View.st,v 1.89 2015-02-24 15:45:44 cg Exp $'
   830 !
   785 !
   831 
   786 
   832 version_CVS
   787 version_CVS
   833     ^ '$Header: /cvs/stx/stx/libview/View.st,v 1.88 2015-01-12 10:29:06 cg Exp $'
   788     ^ '$Header: /cvs/stx/stx/libview/View.st,v 1.89 2015-02-24 15:45:44 cg Exp $'
   834 ! !
   789 ! !
   835 
   790