[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [platform-swt-dev] Changes to StyledText.setTopIndex
- From: "Steve Northover" <Steve_Northover@xxxxxxx>
- Date: Fri, 25 Oct 2002 08:52:48 -0400
- Delivered-to: email@example.com
Is this the way the native text widget setTopIndex works (on platforms
there is more than a page of text visible, scrolling to the end causes the
last line of
text to be at the bottom of the widget). Whew.
<knut_radloff@xxxxxxx> To: platform-swt-dev@xxxxxxxxxxx
Sent by: cc:
platform-swt-dev-admin@ Subject: [platform-swt-dev] Changes to StyledText.setTopIndex
10/24/02 06:53 PM
Please respond to
The specification of setTopIndex limits the top index to the number of
lines minus the number of (fully) visible lines. This is valid unless no
line is fully visible. In that case the spec implies that an input
parameter of getLineCount() is valid. This is not true and would lead to
errors under certain conditions.
The specification of StyledText setTopIndex(int) is going to change as
"@param index new top index. Must be between 0 and getLineCount() -
visible lines per page. An out of range index will be adjusted
will change to:
"@param index new top index. Must be between 0 and getLineCount() - fully
visible lines per page. If no lines are fully visible the maximum value is
getLineCount() - 1. An out of range index will be adjusted accordingly."
Note that, as indicated in the spec, the setTopIndex API does not throw an
exception if the index is out of range. Instead, the index is adjusted to
be within the valid range. This change will therefore not affect any
callers of setTopIndex.
The only potential effect of the change will be to callers of
getTopIndex() for following scenario ==> Call setTopIndex with input
parameter of getLineCount() while the widget
height is less than the line height. Then call getTopIndex and expect the
returned top index to be getLineCount(). Note that, as soon as the widget
height is increased, the top index is fixed by the widget to reflect the
visual location of the scroll bar and the actual top line. The widget
height is 0 if the widget has not been made visible yet after creation.
Knut & Lynne
platform-swt-dev mailing list