Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » CTabItem change foreground when tab was selected
CTabItem change foreground when tab was selected [message #463182] Fri, 28 October 2005 12:03 Go to next message
Eclipse User
Originally posted by: murley.murley.murley

Hi,

I have severals CTabItem in my gui. Now i want do something like eclipse
edior:
When the CTabItem is selected, the foreground color change to white (that
mean i want the word of selected CTabItem change to white in color). While
the other un-selected CTabItem foreground is black in color.

---------------------------------------
| tab1 | tab2 | tab3 |
---------------------------------------
If i click 'tab1', the color of 'tab1' will change to white color.

Therefore i write following code...

CTabFolder tabFolder = new CTabFolder(shell, SWT.BORDER);

// create 3 CTabItem..
CTabItem item1 = xxx
CTabItem item2 = xxx
CTabItem item3 = xxx

tabFolder.addSelectionListener(new SelectionListener(){
public void widgetSelected(SelectionEvent event){
tabFolder.setForeground(new Color(display, 255, 255, 255));
}
public void widgetDefaultSelected(SelectionEvent event){
widgetSelected(event);
}
});

But it not works...

Thanks in advance
Re: CTabItem change foreground when tab was selected [message #463209 is a reply to message #463182] Sun, 30 October 2005 15:02 Go to previous messageGo to next message
Eclipse User
Originally posted by: kbgrant.interchange.ubc.ca

Try this

CTabFolder tabFolder = new CTabFolder (shell, SWT.TOP);
tabFolder.setSelectionForeground (display.getSystemColor (SWT.COLOR_WHITE));

Kevin
Re: CTabItem change foreground when tab was selected [message #463212 is a reply to message #463209] Mon, 31 October 2005 02:34 Go to previous message
Eclipse User
Originally posted by: murley.murley.murley

thanks, i got it :-)
Previous Topic:pie chart
Next Topic:Parsing, retrieving and displaying via custom tags
Goto Forum:
  


Current Time: Sat Apr 19 08:55:00 EDT 2014

Powered by FUDForum. Page generated in 0.01505 seconds