[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.swt] Re: Checkbox trees and disabled nodes
|
Hi Alex,
Unfortunately a color constant for this does not currently exist, the
request for it is https://bugs.eclipse.org/bugs/show_bug.cgi?id=22782 .
The only way I can think of determining this is to add a PaintItem listener
to a disabled Table/Tree and seeing what the foreground colour of its GC is,
as shown in the snippet below:
public static void main (String [] args) {
Display display = new Display ();
final Shell shell = new Shell (display);
shell.setLayout(new FillLayout());
Tree tree = new Tree(shell, SWT.NONE);
//tree.setEnabled(false);
new TreeItem(tree, SWT.NONE).setText("item");
tree.addListener(SWT.PaintItem, new Listener() {
public void handleEvent(Event event) {
System.out.println(event.gc.getForeground().getRGB());
}
});
shell.open();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}
HTH,
Grant
"Alex Fernandes" <afernand@xxxxxxxxxx> wrote in message
news:fsb2ud$q9o$1@xxxxxxxxxxxxxxxxxxxx
> Hi all,
>
> I want to represent disabled nodes on a checkbox tree. Looks like the
> way to go is to grey out the node label, since grey out checkboxes
> represent third states (partially selected nodes).
> How can I get the system color for disabled text so I can apply it to my
> node label?
>
> Thanks,
> Alex