Scrollpanes – what do they actually do
Do scrollpanes scroll the object placed inside, or the text within the object (by passing a message to the object).
I assume a scrollpane scrolls the object inside. Thus, the object can be larger than the pane, that’s the point, right?
However, i recall reading about six years back that Java components used to implement scrolling. Then that functionality was removed, and we had to wrap (say) a list inside a
JScrollPane. I presume the component had to implement an interface (perhaps
Scrollable) and its methods would be called. Thus, JScrollpane would scroll the text within the textarea or listbox. But what would happen if the listbox were larger than the scrollpane?
What if the component inside does not implement Scrollable? Does it have to ?
Currently, text objects and listboxes in rbcurse do implement internal scrolling (C-n C-p). OTOH,
rscrollpane scrolls the entire text object or whatever. That does mean i need to define a separate key for scrollpanes (M-p and M-n). That does suck.
So what does one do ? If the object implements some methods, pass a message to the internal object to scroll, otherwise scroll the entire object. Does this mean that an object that implements Scrollable should not be larger than the Scrollpane whereas an object that does not, can ?
Any suggestion on how I should go about this in rbcurses ?
The attached image shows an outer vertical splitpane, with a horizontal splitpane in the left (as its first component). The horizontal splitpane’s first component is a Scrollpane which contains a TextView. The textview is deliberately larger than the display area. Thus, there are 2 kinds of scrolling actions that I understand. C-n will scroll the data within the textview. M-n will scroll the textview itself. If it were not for the scrollpane, scrolling the data would not display the last page or so, since the textview is larger than the display area. That can be seen in the second image, where there’s no scrollpane.