how to handle the rows in a ListField - blackberry

1.i want to call a new screen when i click the row in a ListField....

Implement a FieldChangeListener and then add it as a listener on your ListField by calling add ListField.setChangeListener.

Related

Fields added multipletimes Blackberry

I am implementing tabs. I have five tabs. For each tab i am calling screen in following way. In
displayTab1() function i am calling another class, It is easily loading MyScreen class but problem is for first time it is showing me same fields two times and whenever i click on this tab same fields are added continously. I have used delete(tabArea);
public VerticalFieldManager displayTab1()
{ MyScreen loadingScreen = new MyScreen();
tab1Manager.add(loadingScreen);
return tab1Manager;
}
Please let me know where i am doing wrong
Thanks
I solved this, In onFocusChanged() i first deleted the whole fields of tab1 by using tabManager1.deleteAll() and after that i added.

Child field event handling issue in custom HorizontalFieldManager

I am trying to create a customized list field where, I have more then 2 clickable buttons in each row. For that i have customized the HorizontalFieldManager and created own manager to align the field elements. Now UI is perfectly fine.
But, I am struggling to handle the events work for both.
Step-1 I have used fieldChangedListener for buttons added in row. It is working fine
public void fieldChanged(Field field, int context) {}
step-2 have used navigation click to handle event on the parent manager.
protected boolean navigationClick(int status, int time) {
Field field = getFieldWithFocus();
Dialog.alert("shops field clicked");
return super.navigationClick(status, time);
}
Now, even the navigationClick event works. But as the button is the child field added to VFM. When i click on the button both the VFM and button event comes together.
How could i restrict only to the button while it is clicked on the ButtonField.
If I understood your question correctly, you want the navigationClick() to be called only for the child field (clickable button) without being called for the manager. Sorry to disappoint you, but you can't.The navigation click event will always be called first for the manager and only than the manager will propagate the event to the child field. The same hold for keys events, touch events, focus events and etc...
Describe what you are trying to achieve, add a code snippet and I am sure we will find a solution.

How to set trackball click listener for EditField

I want to set an listener for EditField so that whenever user clicks on the EditField (Not a touch screen) it redirects to a page and i perform some operations on it. Thank you
Actually, we cant set trackball listener for editfield. If you want it i think there is a method. Use navigationClick() method along with trackwheel events. But there are no trackball events.

How can i implement an interface like BB Messenger?

How can i implement an interface like BB Messenger showing a tree with a list of complex field items that are shown only if the tree item expands.??
Use a ListField for the contents of the collapsible area (you control how each row is painted), and use some other focusable field for the header. Add both to a VerticalFieldManager. When you click on the header once, remove the ListField from the Manager. When you click on it again, add it back.
I think you are talking about tree view. for that you can try this.
Create a field to display a tree view

ButtonField click event

i am not implementing touch event. i am using FieldChangeListener the problem which i am facing is , if i am clicking outside the CustomButtonField then also the click event is generated how should i restrict only to the CustomButtonField.
Thanks alot
The listener will be invoked on all change events but you also get the field that changed (in the fieldChanged function), so why not use that to make sure it is your field that was "changed"?

Resources