blackberryj2mepolish

Datefield not editable


I'm using J2ME polish 2.1.2 and trying to add a net.rim.device.api.ui.component.DateField from Blackberry to a tableItem. It displays correctly, but even after setting it to editable, I can't change anything on it. Has anyone else had this experience?

this = tableItem

 tfInput = new DateField(_meta.Title, System.currentTimeMillis(), mode);
 //#style textInputCell
    this.set(0, 0, tfInput);      
    this.setSelectionMode(TableItem.SELECTION_MODE_CELL);

EDIT: The reason for doing this is because of issues with the Datefield.TIME inputmode on Blackberry if you use J2ME polish's DateField.


Solution

  • Workaround for the problem was to extend J2ME Polish's DateField and intercept when setting mode to TIME as follows :

    public class MyDateField extends DateField{
    
        public MyDateField (String title, int mode){
            super(title, mode);
            // Blackberry has bug in time mode, so going for date time instead and formatting date
            if (mode == DateField.TIME){
                super.setInputMode(DateField.DATE_TIME);
                super.setDateFormatPattern("HH:mm");
            }
        }
    }
    

    Now you can effectively use DATE_TIME as TIME.