Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在blackberry上滚动更改侦听器_Blackberry - Fatal编程技术网

在blackberry上滚动更改侦听器

在blackberry上滚动更改侦听器,blackberry,Blackberry,我已经把我的问题贴在下面的链接上了 错误已被解决 但我需要在滚动后移动场中心位置。请给出任何想法。。。先谢谢你。。。 滚动条中添加了许多字段。。。 像这样滚动显示之后 但我需要像这样移动场中心的位置 请给出任何想法。看起来您只需要一些标志来检测这是由用户发起的sroll事件,还是来自代码(以编程方式) 如果以编程方式发起滚动事件,则将一些布尔值(我们称之为ignoreScrollEvent)设置为true。类似这样的Smth(伪代码): 看起来您只需要一些标志来检测这是由用户发起的srol

我已经把我的问题贴在下面的链接上了

错误已被解决

但我需要在滚动后移动场中心位置。请给出任何想法。。。先谢谢你。。。 滚动条中添加了许多字段。。。 像这样滚动显示之后

但我需要像这样移动场中心的位置


请给出任何想法。

看起来您只需要一些标志来检测这是由用户发起的sroll事件,还是来自代码(以编程方式)

如果以编程方式发起滚动事件,则将一些布尔值(我们称之为
ignoreScrollEvent
)设置为true。类似这样的Smth(伪代码):


看起来您只需要一些标志来检测这是由用户发起的sroll事件,还是由代码(以编程方式)发起的sroll事件

如果以编程方式发起滚动事件,则将一些布尔值(我们称之为
ignoreScrollEvent
)设置为true。类似这样的Smth(伪代码):

private boolean ignoreScrollEvent = false;

public void scrollChanged(Manager manager, int newHorizontalScroll, 
         int newVerticalScroll) {
    if (!ignoreScrollEvent) {
         ignoreScrollEvent = true;
         // recalculate the newHorizontalScroll so the field in the focus 
         // gets in the middle
         horizontalScrollLayout.setHorizontalScroll(newHorizontalScroll);
         int fieldIndex = horizontalScrollLayout.getFieldAtLocation(
             newHorizontalScroll + customfieldwidth, 0
         );
         Field f = horizontalScrollLayout.getField(fieldIndex);
         f.setFocus();
         invalidate();
    } else {
         ignoreScrollEvent = false;
    }
}