Skip to main content


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 16:03 Go to next message
Eclipse UserFriend
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 20:02 Go to previous messageGo to next message
Eclipse UserFriend
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 07:34 Go to previous message
Eclipse UserFriend
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: Fri Apr 19 19:45:45 GMT 2024

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

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

Back to the top