comparison android/DWindows.kt @ 2676:a43cf048ff17

Android: Fix what I thought was a MLE layout issue... but it turns out the method I had been using to disable editing on an MLE, caused it to layout the text differently. So instead of changing the inputType... we set the isFocusable property instead. If the MLE can't be focused, it can't be edited. Word wrapping is still broken though, committing a few scrollbar settings changes in an attempt to fix that, but it is still broken.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 21 Oct 2021 18:53:35 +0000
parents a7868380098f
children c90b2d7057c8
comparison
equal deleted inserted replaced
2675:a7868380098f 2676:a43cf048ff17
1950 1950
1951 mle = EditText(this) 1951 mle = EditText(this)
1952 mle!!.tag = dataArrayMap 1952 mle!!.tag = dataArrayMap
1953 mle!!.id = cid 1953 mle!!.id = cid
1954 mle!!.isSingleLine = false 1954 mle!!.isSingleLine = false
1955 mle!!.maxLines = Integer.MAX_VALUE
1955 mle!!.imeOptions = EditorInfo.IME_FLAG_NO_ENTER_ACTION 1956 mle!!.imeOptions = EditorInfo.IME_FLAG_NO_ENTER_ACTION
1956 mle!!.inputType = (InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_MULTI_LINE) 1957 mle!!.inputType = (InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_MULTI_LINE)
1957 mle!!.isVerticalScrollBarEnabled = true 1958 mle!!.isVerticalScrollBarEnabled = true
1958 mle!!.scrollBarStyle = View.SCROLLBARS_INSIDE_INSET 1959 mle!!.scrollBarStyle = View.SCROLLBARS_INSIDE_INSET
1959 mle!!.setHorizontallyScrolling(true) 1960 mle!!.setHorizontallyScrolling(true)
1961 mle!!.isHorizontalScrollBarEnabled = true
1960 mle!!.gravity = Gravity.TOP or Gravity.LEFT 1962 mle!!.gravity = Gravity.TOP or Gravity.LEFT
1961 } 1963 }
1962 return mle 1964 return mle
1963 } 1965 }
1964 1966
1965 fun mleSetWordWrap(mle: EditText, state: Int) 1967 fun mleSetWordWrap(mle: EditText, state: Int)
1966 { 1968 {
1967 waitOnUiThread { 1969 waitOnUiThread {
1968 if (state != 0) { 1970 if (state != 0) {
1969 mle.setHorizontallyScrolling(false) 1971 mle.setHorizontallyScrolling(false)
1972 mle.isHorizontalScrollBarEnabled = false
1970 } else { 1973 } else {
1971 mle.setHorizontallyScrolling(true) 1974 mle.setHorizontallyScrolling(true)
1975 mle.isHorizontalScrollBarEnabled = true
1972 } 1976 }
1973 } 1977 }
1974 } 1978 }
1975 1979
1976 fun mleSetEditable(mle: EditText, state: Int) 1980 fun mleSetEditable(mle: EditText, state: Int)
1977 { 1981 {
1978 waitOnUiThread { 1982 waitOnUiThread {
1979 if (state != 0) { 1983 mle.isFocusable = state != 0
1980 mle.inputType = (InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_MULTI_LINE)
1981 } else {
1982 mle.inputType = InputType.TYPE_NULL
1983 }
1984 } 1984 }
1985 } 1985 }
1986 1986
1987 fun mleSetCursor(mle: EditText, point: Int) 1987 fun mleSetCursor(mle: EditText, point: Int)
1988 { 1988 {