Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Super Contributor
Posts: 425
Registered: ‎01-02-2013
My Device: BOLD 9900
My Carrier: sdvsdvsd
Accepted Solution

object choice field issue

hi,look at the last two object choice fields
  in  the screen shot , i have to object choice field as you can see in the my first object choice field is having two option
ON and OFF
now when i select the OFF option and i want to set unfocusble my second object choice filed of DAILY UPDATE in the pic. and when i select ON option i', able to focus to my second object choice filed of DAILY UPDATE

9700-01.png

 

Highlighted
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: object choice field issue

Two options:

 

1) Extend the second ObjectChoiceField to support a setFocusable(boolean flag) method, and set this in a Field ChangeListener for the the first ObjectChoiceField

 

2) Extend the second ObjectChoiceField to have it check in its isFocusable() method, the current setting of the first ObjectChoiceField. 

Super Contributor
Posts: 425
Registered: ‎01-02-2013
My Device: BOLD 9900
My Carrier: sdvsdvsd

Re: object choice field issue

hi, i have  confusion about my question.
here i have my first object choice filed and i have set focusable method but not able to set unfousable the second choice filed when i select OFF option in my first object choice field

String[] updateapp = {"On","off"};
Update = new ObjectChoiceField(" AUTO UPDATE", updateapp, 0);
add(Update);

Update.setChangeListener(new FieldChangeListener() {

public void fieldChanged(Field field, int context) {
// TODO Auto-generated method stub
if(field == Update){
int on_offIndex = Update.getSelectedIndex();
String on_off = (String) Update.getChoice(Update.getSelectedIndex());
System.out.println("ssssssssss="+on_off);

}


}
});

 here is my second object choice field

String st_ar[]={"Select Time"};
        	
choiceField=new ObjectChoiceField(" DAILY UPDATE ", st_ar){
public boolean isFocusable() {
// TODO Auto-generated method stub
	return true;
	}
}

 

 

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: object choice field issue

As I described above, you need to extend the second Field.  Extend is the normal word used in Object Oriented programming to mean that you create your own class which has some extra facilities.  In this case you need to add the following two facilities to a standard ObjectChoiceField:

 

a) create a setFocusable(...) method that will allow you to determine if the Field should accept focus (or not) by calling this from another Field

 

b) override the isFocusable() method to return the value you have specified in the setFocusable(..).

 

Helpfully this is clear.