2011-04-28 2 views
0

뭔가가 나를 BlackBerry dev에 미치게 만듭니다. 나는 EditField을 가지고있다. 코드는 다음과 같습니다.Blackberry 사용자 정의 EditField - 포커스 처리

private EditField m_Txt=new EditField(EditField.FOCUSABLE | 
             EditField.FILTER_DEFAULT) { 
    protected void layout(int width, int height) 
    { 
     setExtent(Display.getWidth(), m_TxtHeight); 
    } 
    public boolean isFocusable() 
    { 
     return true; 
    } 

    protected void onFocus(int direction) 
    { 
     super.onFocus(direction); 
     invalidate(); 
    } 

    protected void onUnfocus() { 
     super.onUnfocus(); 
     invalidate(); 
    } 
}; 

문제는 초점을 맞출 수 없다는 것입니다. 사실 그것은 isFocusable 등을 호출하지만 커서가 표시되지 않으며 아무것도 쓸 수 없습니다. 나는 BlackBerry dev에 익숙하지 않기 때문에 나는 확실히 뭔가를 놓치고있다. 그러나 무엇?

고마워요

답변

1

나는 실제로 해답을 찾았습니다. super.layout 메서드를 호출하는 것을 완전히 잊어 버렸습니다. 레이아웃 방법은 다음과 같아야합니다.

protected void layout(int width, int height) 
{ 
    super.layout(Display.getWidth(), m_TxtHeight); 
    setExtent(Display.getWidth(), m_TxtHeight); 
} 
1

어떤 OS로 테스트하나요? 최근 OS6 릴리스 인 경우 I've found in those versions은 선택 모드를 활성화 할 때까지 텍스트 편집 필드에 커서를 표시하지 않습니다.