Do not allow to check grayed checkboxes in CheckboxTableViewer [message #465929] |
Fri, 23 December 2005 02:15 |
Vladimir Grishchenko Messages: 7 Registered: July 2009 |
Junior Member |
|
|
Howdy,
Not exactly a SWT question but I thought I'd ask it here. What is the best
way to prevent checking of grayed elements when using a CheckboxTableViewer?
My solution below which seem to work is to revert the state to unchecked for
grayed elements. Is there a more elegant way of doing it? I want to avoid
subclassing CheckboxTableViewer as "it is not intended to be subclassed
outside the viewer framework".
cbTableViewer.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
if (cbTableViewer.getGrayed(event.getElement()) && event.getChecked()) {
cbTableViewer.setChecked(event.getElement(), false);
return;
}
//process check state change
}
});
Thanks,
Vlad.
|
|
|
Powered by
FUDForum. Page generated in 0.05896 seconds