2012-02-23 2 views
0

하나의 열로 구성된 SWT 테이블을 사용 중이며 SWT TableEditor를 사용하여 열 값을 편집하고 있습니다.TableEditor를 사용할 때 전체 테이블 항목을 선택하는 방법

특정 행을 편집하려고하면 특정 TableItem의 텍스트 만 선택됩니다.

해당 테이블 항목의 전체 선택을 활성화하는 방법이 있습니까? 테이블에 대한

내 selectionListner 코드는 다음과 같습니다

final TableEditor editor1 = new TableEditor(table); 
    //The editor must have the same size as the cell and must 
    //not be any smaller than 50 pixels. 
    editor1.horizontalAlignment = SWT.LEFT; 
    editor1.grabHorizontal = true; 
    editor1.minimumWidth = 130; 
    final int keyEditableColumn = 0; 
    table.addSelectionListener(new SelectionAdapter() 
    { 
     public void widgetSelected(SelectionEvent e) 
     { 
      // Clean up any previous editor control 
      Control oldEditor = editor1.getEditor(); 
      if (oldEditor != null) oldEditor.dispose(); 

      // Identify the selected row 
      final TableItem item = (TableItem)e.item; 

      if (item == null) 
      { 
       return; 
      } 

      // The control that will be the editor must be a child of the Table 
      Text newEditor = new Text(table, SWT.NONE); 

      //Adding the list of Text Widgets that have been created for a component. 
      textWidgetsList.add(newEditor); 

      newEditor.setText(item.getText(keyEditableColumn)); 
      newEditor.addModifyListener(new ModifyListener() 
      { 
       public void modifyText(ModifyEvent me) 
       { 
       ..... 
       ..... 
       ..... 
       ..... 
       ..... 
            } 
      }); 
      newEditor.selectAll(); 
      newEditor.setFocus(); 
      editor1.setEditor(newEditor, item, keyEditableColumn);    
     } 
    }); 

나를 당신의 제안을 알려 주시기 바랍니다 ....

답변

1

당신은 만들 필요가 당신의 스타일 SWT.FULL_SELECTIONTable.

+0

예 SWT.FULL_SELECTION 스타일로 테이블을 만들었습니다. 하지만 여전히 같은 문제로 끝납니다. 내가 놓친 게있어? – user1168608

+0

그러면 분명히 당신의 문제가 정확히 무엇인지, 그리고 무엇을 성취하려고하는지 이해하지 못했습니다. – p12t

관련 문제