Tab between fields in TableViewer

前端 未结 5 666
广开言路
广开言路 2020-12-19 10:20

What I\'d like to do is be able to tab between elements in table.

I currently am creating my table like this.

this.tableViewer = 
            new T         


        
5条回答
  •  有刺的猬
    2020-12-19 10:32

    You need to add a KeyListener and set the selection or focus to the next cell:

    tableViewer.getTable().addKeyListener(new KeyListener(){
    
       public void keyPressed(KeyEvent e) {
    
           System.out.println("Key Pressed");
           if (e.keycode == SWT.TAB)
           {
               System.out.println("Detected TAB key");
               // set table viewer selection
           }
       }
    
       public void keyReleased(KeyEvent e) {
    
           System.out.println("Key Released");
       }}
    );
    

提交回复
热议问题