2012-09-22 4 views
1

Opal에서 제공하는 위젯을 사용하려고합니다.이클립스 4 응용 프로그램에 사용자 정의 위젯이 표시되지 않습니다.

@PostConstruct 
public void createControls(Composite parent){ 
    System.out.println("PROP3"); 

    parent.setLayout(new GridLayout(1, false));   
    Composite propertyContainer = new Composite(parent, SWT.NONE); 
    propertyContainer.setLayout(new GridLayout(1, false)); 

    GridData gd = new GridData(GridData.FILL, GridData.FILL, true, true); 
    propertyContainer.setLayoutData(gd); 

    propertyTable = new PropertyTable(propertyContainer, SWT.NONE); 
    propertyTable.showButtons(); 
    propertyTable.viewAsCategories(); 

    propertyTable.addProperty(new PTProperty("id", "Identifier", "Description for identifier", "My id")).setCategory("General"); 

    propertyTable.addProperty(new PTProperty("text", "Description", "Description for the description field", "blahblah...")).setCategory("General");   

} 

@Focus 
private boolean setFocus(){ 
    return true; 
} 

코드는 Part과 관련된하고 실행하고 다른 위젯에 아무런 문제가 없지만 PropertyTable가 표시되지 않습니다
나는 다음을 수행하고있다.
PropertyTable을 작성하는 코드는 tutorial입니다.
내가 여기서 엉망이되어 PropertyTable이 표시되지 않습니까?

+0

그 이유가 확실치 않지만 'propertyTable'에 레이아웃 데이터를 설정하지 않았습니다. –

+0

@AlexeyRomanov : 당신 말이 맞아요! 이것으로 해결할 수 있습니다. 대답으로 넣고 받아 들일 것입니다 .BTW 튜토리얼 스 니펫에서 'Tab'을 사용하여 데이터를 설정할 필요가없는 이유는 무엇입니까? 'PropertyTable'에 여전히 작동합니까? – Cratylus

+1

@Cratylus setFocus()는 해당하는 경우 적절한 위젯에 포커스를 위치시켜야하며, 그렇지 않으면 파트 탭을 클릭해도 키보드 초점이 사용자의 시야에 들어 가지 않을 수도 있습니다. –

답변

2

GridLayout의 복합체 아래에서 모든 컨트롤의 레이아웃 데이터를 설정해야합니다. TabFolder은 레이아웃 데이터가 필요없는 자체 레이아웃을 사용합니다.

관련 문제