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: Thu Apr 25 02:32:45 GMT 2024

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

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

Back to the top