2011-01-21 7 views
0

次のコードは、Blackberry OS 4および5でうまくいきます。しかし、OS 6では「女性」ラジオボタンオプションは表示されません。誰もがこれを理由に、すべてのブラックベリーOSのために働く解決策を提案できますか?OS6でのRadioButtonGroupの問題

LabelField genderLabelField = new LabelField("Gender:"); 
RadioButtonGroup radioButtonGroup = new RadioButtonGroup(); 

RadioButtonField maleRadioField = new RadioButtonField("Male"); 
RadioButtonField femaleRadioField = new RadioButtonField("Female"); 

private VerticalFieldManager createUI() 
{  
    VerticalFieldManager vfmForm = new VerticalFieldManager(); 

    vfmForm.add(joinf2fLabelField); 

    firstNameEditField.setMargin(0, 0, 5, 0); 
    vfmForm.add(firstNameLabelField); 
    vfmForm.add(firstNameEditField); 

    lastNameEditField.setMargin(0, 0, 5, 0); 
    vfmForm.add(lastNameLabelField); 
    vfmForm.add(lastNameEditField); 

    emailEditField.setMargin(0, 0, 5, 0); 
    vfmForm.add(emailLabelField); 
    vfmForm.add(emailEditField); 

    passwordEditField.setMargin(0, 0, 5, 0); 
    vfmForm.add(passwordLabelField); 
    vfmForm.add(passwordEditField); 

    confirmPasswordEditField.setMargin(0, 0, 5, 0); 
    vfmForm.add(confirmPasswordLabelField); 
    vfmForm.add(confirmPasswordEditField); 

    vfmForm.add(genderLabelField); 

    radioButtonGroup.add(maleRadioField); 
    radioButtonGroup.add(femaleRadioField); 

    HorizontalFieldManager hfmGender = new HorizontalFieldManager(); 

    maleRadioField.setMargin(new XYEdges(0, 5, 0, 0)); 
    hfmGender.add(maleRadioField); 
    hfmGender.add(femaleRadioField); 

    hfmGender.setMargin(new XYEdges(5, 0, 10, 0)); 
    vfmForm.add(hfmGender); 

    vfmForm.add(dateField); 

    HorizontalFieldManager hfmButtons = new HorizontalFieldManager(FIELD_HCENTER | FIELD_VCENTER); 

    hfmButtons.add(submitButton); 
    submitButton.setMargin(new XYEdges(0, 10, 0, 0)); 

    hfmButtons.add(cancelButton); 
    hfmButtons.setMargin(new XYEdges(10, 0, 5, 0)); 

    vfmForm.add(hfmButtons);   

    return vfmForm; 
} 

答えて

0

私はそれを働かせました。これはBlackberry OS 6のバグで、Horizo​​ntalFieldManagerに2つのラジオボタンがある場合、2つ目のラジオボタンは表示されません。 RadioButtonFieldを拡張してオリジナルの代わりに使用するだけです。

class RadioButtonFieldPatch extends RadioButtonField 
{ 
    RadioButtonFieldPatch(String label) 
    { 
     super(label); 
    } 

    RadioButtonFieldPatch(String label, RadioButtonGroup group, boolean selected) 
    { 
     super(label, group, selected); 
    } 

    protected void layout(int width, int height) 
    { 
     int pWidth = this.getPreferredWidth(); 
     setExtent(pWidth, height); 
     super.layout(pWidth, height); 
    } 
} 
関連する問題