Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] Tri-state Checkbox

Hi Conrad,

Thank you for this information. I have implemented it similarly, but wonder why there is no method in SWT's Button class to set the listeners. Something along the lines:

public void installTriStateToggling() {
	addListener (SWT.Selection, e -> {
		if (button.getSelection()) {
			if (!button.getGrayed()) {
				button.setGrayed(true);
			}
		} else {
			if (button.getGrayed()) {
				button.setGrayed(false);
				button.setSelection (true);
			}
		}
	});
}

--
Best regards,
Thomas Singer
=============
syntevo GmbH
http://www.syntevo.com
http://www.syntevo.com/blog


On 2017-07-24 20:57, Conrad Groth wrote:
Hi Thomas,

there is a SWT snippet showing the desired behaviour:
http://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/examples/org
.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet315.java

Best regards
Conrad

-----Ursprüngliche Nachricht-----
Von: platform-swt-dev-bounces@xxxxxxxxxxx
[mailto:platform-swt-dev-bounces@xxxxxxxxxxx] Im Auftrag von Thomas Singer
Gesendet: Montag, 24. Juli 2017 20:13
An: platform-swt-dev@xxxxxxxxxxx
Betreff: [platform-swt-dev] Tri-state Checkbox

Hi,

It looks like a checkbox can work in 2 different modes, either toggling
between selected and unselected, and toggling between tri-state and
unselected. So my understanding it that to set it programmatically to the
tri-state mode, I have to invoke

    checkbox.setGrayed(true);
    checkbox.setSelection(true);

How can I make it switch between selected - unselected - tri-state using the
mouse? Or should I simulate it myself using mouse-click-listeners?

--
Best regards,
Thomas Singer
=============
syntevo GmbH
http://www.syntevo.com
http://www.syntevo.com/blog
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from
this list, visit https://dev.eclipse.org/mailman/listinfo/platform-swt-dev

_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev



Back to the top