Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » how to move focus between two views with tab key press
how to move focus between two views with tab key press [message #460818] Thu, 08 September 2005 05:49 Go to next message
Eclipse UserFriend
Originally posted by: sendtanmoy.yahoo.co.in

in a perspective i have 2 views, one in the left and the other in the right.
the left view contains different text boxes and the right view displays pdf documents.

i want to move focus from the left view to the right view (displaying pdfs) by key press (tab key).

Kindly help me to implement it.
Re: how to move focus between two views with tab key press [message #460834 is a reply to message #460818] Thu, 08 September 2005 13:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ddana78ar.yahoo.com.ar

you have to implement the traverseListener and try this:
if (event.character == SWT.TAB){
//you have to do:
rightView.setFocus();
event.doIt(false);
}
Re: how to move focus between two views with tab key press [message #460865 is a reply to message #460834] Fri, 09 September 2005 05:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tanmoy.chakraborty.gmail.com

i tried to attach both traverseListener or keyListener(to catch key events) with the tabfolder.

the code is used is something like this:
for traverseListener (i was trying to move between two views with tab key press),
tabfolder.addTraverseListener(new TraverseListener () {
public void keyTraversed(TraverseEvent e) {
if(e.character == SWT.TAB) {
{
-- action
}}}});

and for keyListener (i was trying to move between different tab menus with key press) :
tabfolder.addKeyListener(new KeyAdapter(){
public void keyPressed(KeyEvent e){

switch(e.keyCode){
case SWT.F2:
tabfolder.setSelection(0);
break;
case SWT.F3:
tabfolder.setSelection(1);
break;
case SWT.F4:
tabfolder.setSelection(2);
break;

}}});

but i am not able to catch the key events in the tab folder.

kindly help to correct my error.
Re: how to move focus between two views with tab key press [message #460883 is a reply to message #460865] Fri, 09 September 2005 12:48 Go to previous message
Eclipse UserFriend
Originally posted by: ddana78ar.yahoo.com.ar

may be, you have the focus in any other widget instead of the tabFolder. You have to set the traverseListener to the widget that you want to traverse from.
e.g. a button inside the tabFolder. So, button.addTraverseListener...
Previous Topic:CTabFolder: tabs sideways
Next Topic:ToolBar with Text widget
Goto Forum:
  


Current Time: Mon Sep 23 11:53:36 GMT 2019

Powered by FUDForum. Page generated in 0.02190 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top