Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] Changes to StyledText.setTopIndex

Is this the way the native text widget setTopIndex works (on platforms
where when
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"                                                                                                       
                      <knut_radloff@xxxxxxx>          To:      platform-swt-dev@xxxxxxxxxxx                                                
                      Sent by:                        cc:                                                                                  
                      platform-swt-dev-admin@         Subject: [platform-swt-dev] Changes to StyledText.setTopIndex                        
                      eclipse.org                                                                                                          
                                                                                                                                           
                                                                                                                                           
                      10/24/02 06:53 PM                                                                                                    
                      Please respond to                                                                                                    
                      platform-swt-dev                                                                                                     
                                                                                                                                           
                                                                                                                                           



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
follows.

"@param index new top index. Must be between 0 and getLineCount() -
visible lines per page. An out of range index will be adjusted
accordingly."

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
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev






Back to the top