ListField 和按钮在同屏中焦点问题
大家好,我遇到了一个问题。我在一个屏幕中实现了一个 ListField
。在屏幕顶部,我使用了一个 HorizontalFieldManager
来容纳一个 TitleLabel 和两个按钮
。我已经在列表字段的所有行上推送了一些屏幕。我的问题是,假设当我在第四行并且我选择了我想要的内容,然后当我单击按钮时,按钮起作用了,但是我在第四行实现的屏幕也出现了如何避免它。我正在 Storm 9550 模拟器上测试它并使用 Blackberry eclipse plugin5.0 。我已经没有主意了,请帮助我。
导航点击是这样的
protected boolean navigationClick(int status, int time) {
selectListAndButton();
return true;
}
//这里是 selectListAndButton 方法
private selectListAndButton(){
Field field = getFieldWithFocus().getLeafFieldWithFocus();
if(field == backCustomButton){
//Popped the active Screen
}else if(field == saveCustomButton){
//Saving some Data to the Database And pushing another Screen here
// problem comes here if i am at 2nd row of the listfield and selects
something from there and clicked on the button the screen which was
implemented at 2nd row also appears
}
else if (_list.getSelectedIndex() == 0){
//Called a date picker
}
else if (_list.getSelectedIndex() == 1){
//Pushed some another screen
}
else if (_list.getSelectedIndex() == ){
//Pushed some another screen
}
Hello all i stuck at one problem. I have implemented a ListField
in one Screen. On top of the Screen i have used one HorizontalFieldManager
to hold a TitleLabel and Two Butons
. I have pushed some screen on all the rows of the listfield. My problem is, letSuppose when i am on 4th row and i have selected what i want then when i clicking on the button, then the button worked but the screen which i have implemented at 4th row also appear how to avoid it. I am testing it on storm 9550 simulator and using Blackberry eclipse plugin5.0 . I am running out of idea please help me .
navigation click is like this
protected boolean navigationClick(int status, int time) {
selectListAndButton();
return true;
}
//And here is the selectListAndButton Method
private selectListAndButton(){
Field field = getFieldWithFocus().getLeafFieldWithFocus();
if(field == backCustomButton){
//Popped the active Screen
}else if(field == saveCustomButton){
//Saving some Data to the Database And pushing another Screen here
// problem comes here if i am at 2nd row of the listfield and selects
something from there and clicked on the button the screen which was
implemented at 2nd row also appears
}
else if (_list.getSelectedIndex() == 0){
//Called a date picker
}
else if (_list.getSelectedIndex() == 1){
//Pushed some another screen
}
else if (_list.getSelectedIndex() == ){
//Pushed some another screen
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要覆盖
Screen
的onTouch
并根据事件坐标和Field
边界调用特定功能:You need to override
onTouch
forScreen
and call specific functionality depend on event coordinates andField
boundaries:我已经解决了。但发布答案晚了。我刚刚放弃了使用 ListField 的想法,因为我没有那么多行要添加。所以我只是使用了这个小技巧,而不是使用
ListField
我使用了HorizontalFieldManager
,它看起来像一个List
所以一切工作正常。谢谢干杯:)
I had solved it. but posting the answer late. I just dropped the idea of using
ListField
because i dont have so much rows to add. So i have just used the little trick rather usingListField
i have usedHorizontalFieldManager
and its look like aList
so everything working fine.Thanks cheers :)