@@ -682,7 +682,13 @@ public handler OnClick() returns nothing
682682end handler
683683
684684private handler yPosToRowNumber(in pYPos as Number) returns Integer
685- return the floor of ((mViewTopPosition + pYPos) / mRowHeight + 1)
685+ variable tRow as Number
686+ put the floor of ((mViewTopPosition + pYPos) / mRowHeight + 1) into tRow
687+ if mReadOnly then
688+ add 1 to tRow
689+ end if
690+
691+ return tRow
686692end handler
687693
688694private handler xPosToIconString(in pXPos as Number) returns String
@@ -723,11 +729,7 @@ end handler
723729// Clamp mViewTopPosition
724730private handler ensureViewTopPosition()
725731 variable tMinTop as Real
726- if mReadOnly then
727- put mRowHeight into tMinTop
728- else
729- put 0 into tMinTop
730- end if
732+ put 0 into tMinTop
731733
732734 // Make sure we don't try to scroll above 0
733735 if mViewTopPosition < tMinTop then
@@ -745,15 +747,18 @@ private handler updateFirstDataItem()
745747 put the floor of (mViewTopPosition / mRowHeight) + 1 into mFirstDataItem
746748 if mFirstDataItem < 1 then
747749 put 1 into mFirstDataItem
748- end if
750+ end if
751+ if mReadOnly then
752+ add 1 to mFirstDataItem
753+ end if
749754end handler
750755
751756private handler updateParameters() returns nothing
752757 put the number of elements in mDataList into mDataCount
753758 if mReadOnly then
754- put mRowHeight * mDataCount into mDataHeight
755- else
756759 put mRowHeight * (mDataCount - 1) into mDataHeight
760+ else
761+ put mRowHeight * mDataCount into mDataHeight
757762 end if
758763 put my height into mViewHeight
759764 put my width into mViewWidth
0 commit comments