EditField.st
changeset 2105 364c74512645
parent 2042 7080474e7966
child 2130 40515380f762
equal deleted inserted replaced
2104:6ca8e039298f 2105:364c74512645
    14 	instanceVariableNames:'leaveAction enabled clickAction crAction tabAction converter
    14 	instanceVariableNames:'leaveAction enabled clickAction crAction tabAction converter
    15 		leaveKeys immediateAccept acceptOnLeave acceptOnReturn
    15 		leaveKeys immediateAccept acceptOnLeave acceptOnReturn
    16 		lengthLimit entryCompletionBlock entryCompletionCharacter
    16 		lengthLimit entryCompletionBlock entryCompletionCharacter
    17 		passwordCharacter cursorMovementWhenUpdating
    17 		passwordCharacter cursorMovementWhenUpdating
    18 		autoScrollHorizontally acceptOnTab acceptOnLostFocus
    18 		autoScrollHorizontally acceptOnTab acceptOnLostFocus
    19 		acceptOnPointerLeave'
    19 		acceptOnPointerLeave acceptIfUnchanged'
    20 	classVariableNames:'DefaultForegroundColor DefaultBackgroundColor
    20 	classVariableNames:'DefaultForegroundColor DefaultBackgroundColor
    21 		DefaultSelectionForegroundColor DefaultSelectionBackgroundColor'
    21 		DefaultSelectionForegroundColor DefaultSelectionBackgroundColor'
    22 	poolDictionaries:''
    22 	poolDictionaries:''
    23 	category:'Views-Text'
    23 	category:'Views-Text'
    24 !
    24 !
   821     acceptEnabled == false ifTrue:[
   821     acceptEnabled == false ifTrue:[
   822         device beep.
   822         device beep.
   823         ^ self
   823         ^ self
   824     ].
   824     ].
   825 
   825 
       
   826     (acceptIfUnchanged not
       
   827     and:[model notNil
       
   828     and:[model value = self editValue]]) ifTrue:[^ self].
       
   829 
   826     super accept.
   830     super accept.
       
   831 
   827     converter notNil ifTrue:[
   832     converter notNil ifTrue:[
   828         val := self editValue.
   833         val := self editValue.
   829         string := converter printStringFor:val.
   834         string := converter printStringFor:val.
   830         string ~= self contents ifTrue:[
   835         string ~= self contents ifTrue:[
   831             self contents:string.
   836             self contents:string.
   835 
   840 
   836     "Modified: 7.3.1997 / 11:06:00 / cg"
   841     "Modified: 7.3.1997 / 11:06:00 / cg"
   837 ! !
   842 ! !
   838 
   843 
   839 !EditField methodsFor:'accessing-behavior'!
   844 !EditField methodsFor:'accessing-behavior'!
       
   845 
       
   846 acceptIfUnchanged
       
   847     "return the acceptIfUnchanged flag setting.
       
   848      if set (the default), an accept notification is sent on accept,
       
   849      even if the fields value is the same. If cleared,
       
   850      the notification is suppressed, if the fields contents is the same."
       
   851 
       
   852     ^ acceptIfUnchanged
       
   853 !
       
   854 
       
   855 acceptIfUnchanged:aBoolean
       
   856     "if set (the default), an accept notification is sent on accept,
       
   857      even if the fields value is the same. If cleared,
       
   858      the notification is suppressed, if the fields contents is the same."
       
   859 
       
   860     acceptIfUnchanged := aBoolean
       
   861 !
   840 
   862 
   841 acceptOnLeave:aBoolean
   863 acceptOnLeave:aBoolean
   842     "set/clear the acceptOnLeave flag. The default is false.
   864     "set/clear the acceptOnLeave flag. The default is false.
   843      If true, leaving the box (via return, cursor etc.) accepts my 
   865      If true, leaving the box (via return, cursor etc.) accepts my 
   844      string into the valueHolder (if any).
   866      string into the valueHolder (if any).
  1803     acceptOnPointerLeave := false.
  1825     acceptOnPointerLeave := false.
  1804     enabled := fixedSize := autoScrollHorizontally := true.
  1826     enabled := fixedSize := autoScrollHorizontally := true.
  1805     acceptOnLeave := acceptOnReturn := acceptOnTab := true.
  1827     acceptOnLeave := acceptOnReturn := acceptOnTab := true.
  1806     cursorShown := true.
  1828     cursorShown := true.
  1807     entryCompletionCharacter := #Tab.
  1829     entryCompletionCharacter := #Tab.
       
  1830     acceptIfUnchanged := false.
  1808 
  1831 
  1809     leaveKeys isNil ifTrue:[
  1832     leaveKeys isNil ifTrue:[
  1810         leaveKeys := self class defaultLeaveKeys.
  1833         leaveKeys := self class defaultLeaveKeys.
  1811     ].
  1834     ].
  1812     cursorMovementWhenUpdating := #endOfLine
  1835     cursorMovementWhenUpdating := #endOfLine
  2071 ! !
  2094 ! !
  2072 
  2095 
  2073 !EditField class methodsFor:'documentation'!
  2096 !EditField class methodsFor:'documentation'!
  2074 
  2097 
  2075 version
  2098 version
  2076     ^ '$Header: /cvs/stx/stx/libwidg/EditField.st,v 1.146 1999-11-13 13:17:41 cg Exp $'
  2099     ^ '$Header: /cvs/stx/stx/libwidg/EditField.st,v 1.147 2000-01-26 14:36:34 ca Exp $'
  2077 ! !
  2100 ! !