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" |