ListView.st
changeset 4634 663a43a31111
parent 4610 dcf585ff2309
child 4637 ada9f49ba034
equal deleted inserted replaced
4633:d81164de732d 4634:663a43a31111
  2012 ! !
  2012 ! !
  2013 
  2013 
  2014 !ListView methodsFor:'event handling'!
  2014 !ListView methodsFor:'event handling'!
  2015 
  2015 
  2016 contentsChanged
  2016 contentsChanged
  2017     "contents changed - move origin up if possible"
  2017     "size of contents changed - move origin up if possible"
  2018 
  2018 
  2019     |listSize newOrigin|
  2019     |listSize newOrigin|
  2020 
  2020 
  2021     shown ifTrue:[
  2021     shown ifTrue:[
  2022 	list notNil ifTrue:[
  2022         list notNil ifTrue:[
  2023 	    listSize := self numberOfLines.
  2023             listSize := self numberOfLines.
  2024 
  2024 
  2025 	    listSize == 0 ifTrue:[
  2025             listSize == 0 ifTrue:[
  2026 		widthOfWidestLine := 0.
  2026                 widthOfWidestLine := 0.
  2027 	    ].
  2027             ].
  2028 
  2028 
  2029 	    "
  2029             "
  2030 	     if we are beyond the end, scroll up a bit
  2030              if we are beyond the end, scroll up a bit
  2031 	    "
  2031             "
  2032 	    ((firstLineShown + nFullLinesShown) > listSize) ifTrue:[
  2032             ((firstLineShown + nFullLinesShown) > listSize) ifTrue:[
  2033 		newOrigin := listSize - nFullLinesShown + 1.
  2033                 newOrigin := listSize - nFullLinesShown + 1.
  2034 		newOrigin < 1 ifTrue:[
  2034                 newOrigin < 1 ifTrue:[
  2035 		    newOrigin := 1
  2035                     newOrigin := 1
  2036 		].
  2036                 ].
  2037 		self scrollToLine: newOrigin.
  2037                 self scrollToLine: newOrigin.
  2038 	    ].
  2038             ].
  2039 	].
  2039         ].
  2040     ].
  2040     ].
  2041 
  2041 
  2042     ^ super contentsChanged
  2042     ^ super contentsChanged
  2043 
  2043 
  2044     "Modified: 18.11.1996 / 19:50:07 / stefan"
  2044     "Modified: 18.11.1996 / 19:50:07 / stefan"
  4897 ! !
  4897 ! !
  4898 
  4898 
  4899 !ListView class methodsFor:'documentation'!
  4899 !ListView class methodsFor:'documentation'!
  4900 
  4900 
  4901 version
  4901 version
  4902     ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.367 2013-06-17 12:52:56 stefan Exp $'
  4902     ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.368 2013-06-27 13:54:42 cg Exp $'
  4903 !
  4903 !
  4904 
  4904 
  4905 version_CVS
  4905 version_CVS
  4906     ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.367 2013-06-17 12:52:56 stefan Exp $'
  4906     ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.368 2013-06-27 13:54:42 cg Exp $'
  4907 ! !
  4907 ! !
  4908 
  4908