I am trying to have a full-screen interface with a patch title (manager with some fields) and scrollable content (list of custom field). The idea is to emulate some kind of scrollable list.
To do this, I created a custom VerticalFieldManager that accepts maxHeight (screen height - header height).
I am having the following issues:
- Scrolling arrows are not displayed (ever)
- In OS 4.7 (Storm), I can scroll lower than the last item until nothing but a title appears on the screen.
My code needs to be compiled using JDE 4.2.1 and 4.7 and run on Pearl and Storm. (in the worst case, I could have two versions of this class)
I suspect these two issues are related. I probably have something wrong. I looked through some examples / forum and always found a similar solution / code. Can you guys tell me what I did wrong?
class myVerticalFieldManager extends VerticalFieldManager{
private int maxHeight = 0;
myVerticalFieldManager(int _maxHeight){
super(
Manager.VERTICAL_SCROLL
| Manager.VERTICAL_SCROLLBAR
);
maxHeight = _maxHeight;
}
protected void sublayout(int width, int height){
super.sublayout(width, getPreferredHeight());
setExtent(width, getPreferredHeight());
}
public int getPreferredWidth() {
return Graphics.getScreenWidth();
}
public boolean forceMaxHeight = false;
public int getPreferredHeight() {
if (forceMaxHeight) return maxHeight;
int m = super.getPreferredHeight();
if (m > maxHeight) m = maxHeight;
return m;
}
protected boolean isUpArrowShown(){
int i = getFieldWithFocusIndex();
return i > 0;
}
protected boolean isDownArrowShown(){
int i = getFieldWithFocusIndex();
return i < getFieldCount();
}
public int myBackgroundColor = 0xffffff;
protected void paint(Graphics g){
g.setBackgroundColor(myBackgroundColor);
g.clear();
super.paint(g);
}
}
Any hints are welcome.
source
share