Mercurial > dwindows
comparison android/DWindows.kt @ 2706:4e9eba7f7226
Android: Implement dw_scrollbox_get_range() and dw_scrollbox_get_pos().
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 19 Nov 2021 02:20:11 +0000 |
parents | 321e2cf1282a |
children | a3f6ca621453 |
comparison
equal
deleted
inserted
replaced
2705:ddcbed595a84 | 2706:4e9eba7f7226 |
---|---|
1691 box!!.setPadding(pad, pad, pad, pad) | 1691 box!!.setPadding(pad, pad, pad, pad) |
1692 } | 1692 } |
1693 return box | 1693 return box |
1694 } | 1694 } |
1695 | 1695 |
1696 fun scrollBoxNew(type: Int, pad: Int) : ScrollView? { | 1696 fun scrollBoxNew(type: Int, pad: Int): ScrollView? { |
1697 var scrollBox: ScrollView? = null | 1697 var scrollBox: ScrollView? = null |
1698 | 1698 |
1699 waitOnUiThread { | 1699 waitOnUiThread { |
1700 val box = LinearLayout(this) | 1700 val box = LinearLayout(this) |
1701 scrollBox = ScrollView(this) | 1701 scrollBox = ScrollView(this) |
1716 // Add a pointer back to the ScrollView | 1716 // Add a pointer back to the ScrollView |
1717 box.tag = scrollBox | 1717 box.tag = scrollBox |
1718 scrollBox!!.addView(box) | 1718 scrollBox!!.addView(box) |
1719 } | 1719 } |
1720 return scrollBox | 1720 return scrollBox |
1721 } | |
1722 | |
1723 fun scrollBoxGetPos(scrollBox: ScrollView, orient: Int): Int { | |
1724 var retval: Int = -1 | |
1725 | |
1726 waitOnUiThread { | |
1727 // DW_VERT 1 | |
1728 if(orient == 1) { | |
1729 retval = scrollBox.scrollY | |
1730 } else { | |
1731 retval = scrollBox.scrollX | |
1732 } | |
1733 } | |
1734 return retval | |
1735 } | |
1736 | |
1737 fun scrollBoxGetRange(scrollBox: ScrollView, orient: Int): Int { | |
1738 var retval: Int = -1 | |
1739 | |
1740 waitOnUiThread { | |
1741 // DW_VERT 1 | |
1742 if(orient == 1) { | |
1743 retval = scrollBox.getChildAt(0).height | |
1744 } else { | |
1745 retval = scrollBox.getChildAt(0).width | |
1746 } | |
1747 } | |
1748 return retval | |
1721 } | 1749 } |
1722 | 1750 |
1723 // Update the layoutParams of a box after a change | 1751 // Update the layoutParams of a box after a change |
1724 private fun boxUpdate(box: LinearLayout) | 1752 private fun boxUpdate(box: LinearLayout) |
1725 { | 1753 { |