Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Set focus on specific tab
Set focus on specific tab [message #444065] Wed, 06 October 2004 13:22 Go to next message
Henrik Skovgaard is currently offline Henrik SkovgaardFriend
Messages: 84
Registered: July 2009
Member
Hi

How do I set the focus (or activate) a specific tab in a cTabFolder ?

/Henrik
Re: Set focus on specific tab [message #444067 is a reply to message #444065] Wed, 06 October 2004 13:38 Go to previous message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
Select the tab using setSelection and then use forceFocus.

public static void main (String [] args) {
Display display = new Display ();
Shell shell = new Shell (display);
shell.setLayout(new FillLayout());
final CTabFolder folder = new CTabFolder(shell, SWT.BORDER);
for (int i = 0; i < 10; i++) {
CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText("item "+i);
Text t = new Text(folder, SWT.NONE);
item.setControl(t);
}
Button b = new Button(shell, SWT.PUSH);
b.setText("put focus on tab for item 2");
b.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
folder.setSelection(2);
folder.forceFocus();
}
});
shell.open ();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}

"Henrik Skovgaard" <hsk@reklamedata.dk> wrote in message
news:ck0ra5$rrj$1@eclipse.org...
> Hi
>
> How do I set the focus (or activate) a specific tab in a cTabFolder ?
>
> /Henrik
>
Previous Topic:ScrolledComposite problems!!!
Next Topic:Dynamicly Adding and Removing CoolItems
Goto Forum:
  


Current Time: Mon Oct 26 08:04:40 GMT 2020

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

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

Back to the top