Disable editing checkboxes in a Table [message #542522] |
Fri, 25 June 2010 03:59  |
Eclipse User |
|
|
|
I have a table with checkboxes in my application. However, they only show information from my model and letting the user check or uncheck them doesn't make sense.
Unfortunately, TableColumn doesn't have setEnabled method. I've tried to wrap the table into an extra Composite and call setEnabled(false) on it, but this prevents me from scrolling the table as well.
Is there a way to do this?
|
|
|
|
|
Re: Disable editing checkboxes in a Table [message #542590 is a reply to message #542562] |
Fri, 25 June 2010 07:42   |
Eclipse User |
|
|
|
On 25.06.2010 12:40, Daniel Krügler wrote:
> On 25.06.2010 11:55, Daniel Krügler wrote:
>> On 25.06.2010 09:59, Alexey Romanov wrote:
>>> I have a table with checkboxes in my application. However, they only
>>> show information from my model and letting the user check or uncheck
>>> them doesn't make sense.
>>>
>>> Unfortunately, TableColumn doesn't have setEnabled method. I've tried to
>>> wrap the table into an extra Composite and call setEnabled(false) on it,
>>> but this prevents me from scrolling the table as well.
>>>
>>> Is there a way to do this?
>>
>> AFAIK there is no "clean" solution. You may want to try the workaround
>> suggested in:
>>
>> http://tom-eclipse-dev.blogspot.com/2008/10/disable-parts-sw t-tabletree-with.html
>>
I just recognize that on the jface-level a solution seems possible by
defining a ICheckStateProvider implementation. You could check-out what
this implementation does internally to realize the same on the pure
SWT level.
> Alternatively you might want to experiment with custom drawing in
> tables. This would mean that you would just use icons (e.g. via the
> jface TableViewer API or by manually) instead of native check-boxes.
>
> See e.g.
>
> http://www.eclipse.org/articles/article.php?file=Article-Cus tomDrawingTableAndTreeItems/index.html
>
>
> If working on the jface level, this is so-called owner drawing, as shown in
>
> http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.s nippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippet s/viewers/Snippet010OwnerDraw.java?view=markup
>
>
> You could also try-out faked native checkboxes as described in
>
> http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.s nippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippet s/viewers/Snippet061FakedNativeCellEditor.java?view=markup
HTH & Greetings from Bremen,
Daniel Krügler
|
|
|
Re: Disable editing checkboxes in a Table [message #542605 is a reply to message #542590] |
Fri, 25 June 2010 08:18  |
Eclipse User |
|
|
|
> I just recognize that on the jface-level a solution seems possible by
> defining a ICheckStateProvider implementation. You could check-out what
> this implementation does internally to realize the same on the pure
> SWT level.
Actually, I am using an ICheckStateProvider on a CheckboxTableViewer, and this doesn't disable toggling checkboxes. Am I missing something?
After thinking some more, I can use ICheckStateListener...
|
|
|
Powered by
FUDForum. Page generated in 0.03915 seconds