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

It's platform specific (I think I said that) but you are doing what Windows
does.
For example, OS/2 didn't do it this way.



                                                                                                                                           
                      "Knut Radloff"                                                                                                       
                      <knut_radloff@xxxxxxx>          To:      platform-swt-dev@xxxxxxxxxxx                                                
                      Sent by:                        cc:                                                                                  
                      platform-swt-dev-admin@         Subject: Re: [platform-swt-dev] Changes to StyledText.setTopIndex                    
                      eclipse.org                                                                                                          
                                                                                                                                           
                                                                                                                                           
                      10/25/02 11:43 AM                                                                                                    
                      Please respond to                                                                                                    
                      platform-swt-dev                                                                                                     
                                                                                                                                           
                                                                                                                                           



What you describe is how the SWT Text widget works on win32. I haven't
tried any other platform. Presumably it should work consistently on all
platforms.

On win32 SWT Text explicitly limits the top index to line count - 1. In
addition the platform seems to limit the the top index to line count -
visible line count. The net result is the same as what we do now. Not sure
what we were thinking (if anything) when we put in that bogus check.

Knut




"Steve Northover" <Steve_Northover@xxxxxxx>
Sent by: platform-swt-dev-admin@xxxxxxxxxxx
25/10/2002 08:52
Please respond to platform-swt-dev


        To:     platform-swt-dev@xxxxxxxxxxx
        cc:     platform-swt-dev@xxxxxxxxxxx
        Subject:        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




_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev



_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev






Back to the top