Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On TabFolder, Foreground and Background colors are not getting applied inspite of setting. #1388

Open
deepika-u opened this issue Aug 7, 2024 · 4 comments

Comments

@deepika-u
Copy link
Contributor

On TabFolder, when trying to change Foreground and Background colors, they are not getting applied.

To Reproduce
I am able to see the same problem via the below snippet, via ControlExample or via SWT Controls.

Snippet to reproduce the behavior

package org.eclipse.swt.snippets;

/*
 * TabFolder example snippet: create a tab folder (six pages)
 *
 * For a list of all SWT example snippets see
 * http://www.eclipse.org/swt/snippets/
 */
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;

public class Snippet76 {

public static void main (String [] args) {
	Display display = new Display ();
	final Shell shell = new Shell (display);
	shell.setText("Snippet 76");
	final TabFolder tabFolder = new TabFolder (shell, SWT.BORDER);
	Rectangle clientArea = shell.getClientArea ();
	tabFolder.setLocation (clientArea.x, clientArea.y);
	tabFolder.setBackground(display.getSystemColor(SWT.COLOR_YELLOW));
	tabFolder.setForeground(display.getSystemColor(SWT.COLOR_RED));
	for (int i=0; i<6; i++) {
		TabItem item = new TabItem (tabFolder, SWT.NONE);
		item.setText ("TabItem " + i);
		Button button = new Button (tabFolder, SWT.PUSH);
		button.setText ("Page " + i);
		item.setControl (button);
	}
	//tabFolder.setSelection(4);
	tabFolder.pack ();
	shell.pack ();
	shell.open ();
	while (!shell.isDisposed ()) {
		if (!display.readAndDispatch ()) display.sleep ();
	}
	display.dispose ();
}
}

Expected behavior
Like how CTabFolder, color changes should be applied even on TabFolder.

Environment:

  1. Select the platform(s) on which the behavior is seen:
    • All OS
    • Windows
    • Linux
    • macOS

Seeing the problem on below environment:
Eclipse SDK
Version: 2024-09 (4.33)
Build id: I20240805-1800
OS: Windows 11, v.10.0, x86_64 / win32
Java vendor: Eclipse Adoptium
Java runtime version: 21.0.1+12-LTS
Java version: 21.0.1

@elsazac
Copy link
Member

elsazac commented Aug 7, 2024

Setting foreground and background colour on Tabfolder works fine on MacOS.

This is how it is in Mac :

Screenshot 2024-08-07 at 2 59 08 PM

@elsazac
Copy link
Member

elsazac commented Aug 7, 2024

Could someone verify the behavior on Linux?

@elsazac elsazac added the Windows Happens on Windows OS label Aug 8, 2024
@iloveeclipse
Copy link
Member

Here how TabFolder looks like on RHEL 9.2:

image

Here CTabFolder used in your snippet:

image

Obviously they differ, but the one is created by native widget toolkit, other one is "faked".

I believe this could be difficult to get consistent behavior on all platforms without breaking existing code. But if you want consistency, please provide patches...

@elsazac elsazac removed the Windows Happens on Windows OS label Aug 8, 2024
@deepika-u
Copy link
Contributor Author

deepika-u commented Aug 21, 2024

When checked further on windows apis, i am not able to find anything specifically to set foreground or background on tabfolder on windows from below api list like tabctrl_set....
=> https://learn.microsoft.com/en-us/windows/win32/api/commctrl/nf-commctrl-tabctrl_setcurfocus

So as of now this issue can be closed as an windows limitation.
Can someone add labels as limitation, windows and close this issue please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants