English 中文(简体)
黑莓的物体
原标题:ObjectChoicefield in blackberry
  • 时间:2010-07-10 07:00:20
  •  标签:
  • blackberry

I have a objectchoice field with choices as say YES and NO. I want to handle event when the user selects any one of the choices.

for example when the user selects YES i want a labelField to be added to the screen. and when No is selected this label should be removed from the screen

请帮助

问题回答

我认为,你可以这样做,办法是实施外地食堂界面,凌驾于外地活动之上。

在您的窗口类别中,执行外地生计。

objectChoiceField.setChangeListener(this)

我建议对你希望添加/删除标签的指数进行标识,以便你能够更容易地做你想要做的事情,而不必冒用无效指数的风险:

if (selectedIndex == 0) { // Yes
    if (!labelField.hasManager()) { 
        // If the field is not already present, add it to the screen. 
        insert(labelField, positionToInsertField); 
    } 
} else {  // No
    if (labelField.hasManager()) { 
        // Our field is currently on the screen - let s remove it now. 
        remove(labelField); 
    } 
}

在以下法典中,你可以找到一个非常相似的行为的例子:

http://svn.bbssh.org/trunk/BBSSH/src/org/bbssh/ Screens/ConnectionPropertiesScreen.java

实地援引的“手提式”功能 ChangeListener。 在那里,你看看我们如何根据目前的甄选(在这种情况下,真正的真的字体和比图字体)来积极补充和消除控制。





相关问题
How does AlertListener work on Blackberry API 5.0?

Does the AlertListener interface works globally on all alerts on the blackberry device, or does it only work with alerts generated by your application? In other words, can I use this interface to ...

How to buffer audio in Blackberry?

I need to learn how to buffer audio stream from a remote server in Blackberry. There is a sample buffered playback app with Blackberry api but can you tell what url may I use to test the application?

Blackberry push notification implementation

How does one implement a push notification for a blackberry app? I heard that in order to do so I need to purchase a Blackberry Enterprise Server which costs me 1400 per year. Is this true? Where is ...

热门标签