CheckboxTableViewer: set the checkboxes programmatically [message #466563] |
Wed, 11 January 2006 12:29  |
Eclipse User |
|
|
|
I know, this might be a posting for the group eclipse.platform, but I
didn't receive any replies over there and thus hope that you might give
me some hints for my problem:
I want to set the checkboxes within a 4 column table when initialising
its contents (or on update). Therefore I set up a table with the style
property SWT.CHECK and instantiate a CheckboxTableViewer with this table:
table = new Table(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL |
SWT.FULL_SELECTION | SWT.MAX | SWT.CHECK);
viewer = new CheckboxTableViewer(table);
Then, I thought it should work if I use the method
LabelProvider.getColumnText(Object element, int columnIndex) of
theviewer to set the checkboxes according to the element:
element.
viewer.setChecked(element, true);
This method returns "true" and as I check the state of the element, it
is set to "checked". But nevertheless, the checkboxes within the table
don't show any changes.
I have already tried to call the table.repaint() and table.update() but
without success.
How is the workflow and the communication of a Viewer and its table. I
think, there might be my problem.
Thanks.
|
|
|
Re: CheckboxTableViewer: set the checkboxes programmatically [message #466591 is a reply to message #466563] |
Wed, 11 January 2006 15:37   |
Eclipse User |
|
|
|
The style SWT.CHECK is for the first column only and has nothing to do with
the LabelProvider. It works by the user clicking in the box or the
application calling TableItem.setChecked(true).
CheckboxTableViewer is a JFace feature and you will get a better response to
questions about its use in the eclipse.platform newsgroup.
"Flo" <huberfl@in.tum.de> wrote in message
news:dq3f91$8eo$1@utils.eclipse.org...
>I know, this might be a posting for the group eclipse.platform, but I
> didn't receive any replies over there and thus hope that you might give
> me some hints for my problem:
>
> I want to set the checkboxes within a 4 column table when initialising
> its contents (or on update). Therefore I set up a table with the style
> property SWT.CHECK and instantiate a CheckboxTableViewer with this table:
>
> table = new Table(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL |
> SWT.FULL_SELECTION | SWT.MAX | SWT.CHECK);
> viewer = new CheckboxTableViewer(table);
>
> Then, I thought it should work if I use the method
> LabelProvider.getColumnText(Object element, int columnIndex) of
> theviewer to set the checkboxes according to the element:
> element.
> viewer.setChecked(element, true);
>
> This method returns "true" and as I check the state of the element, it
> is set to "checked". But nevertheless, the checkboxes within the table
> don't show any changes.
>
> I have already tried to call the table.repaint() and table.update() but
> without success.
>
> How is the workflow and the communication of a Viewer and its table. I
> think, there might be my problem.
> Thanks.
|
|
|
Re: CheckboxTableViewer: set the checkboxes programmatically [message #466703 is a reply to message #466591] |
Fri, 13 January 2006 17:40   |
Eclipse User |
|
|
|
Thank you, Veronika.
I already tried the other group but didn't get a response yet.
Cheers,
F.
Veronika Irvine wrote:
> The style SWT.CHECK is for the first column only and has nothing to do with
> the LabelProvider. It works by the user clicking in the box or the
> application calling TableItem.setChecked(true).
>
> CheckboxTableViewer is a JFace feature and you will get a better response to
> questions about its use in the eclipse.platform newsgroup.
>
>
> "Flo" <huberfl@in.tum.de> wrote in message
> news:dq3f91$8eo$1@utils.eclipse.org...
>
>>I know, this might be a posting for the group eclipse.platform, but I
>>didn't receive any replies over there and thus hope that you might give
>>me some hints for my problem:
>>
>>I want to set the checkboxes within a 4 column table when initialising
>>its contents (or on update). Therefore I set up a table with the style
>>property SWT.CHECK and instantiate a CheckboxTableViewer with this table:
>>
>>table = new Table(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL |
>>SWT.FULL_SELECTION | SWT.MAX | SWT.CHECK);
>>viewer = new CheckboxTableViewer(table);
>>
>>Then, I thought it should work if I use the method
>>LabelProvider.getColumnText(Object element, int columnIndex) of
>>theviewer to set the checkboxes according to the element:
>>element.
>>viewer.setChecked(element, true);
>>
>>This method returns "true" and as I check the state of the element, it
>>is set to "checked". But nevertheless, the checkboxes within the table
>>don't show any changes.
>>
>>I have already tried to call the table.repaint() and table.update() but
>>without success.
>>
>>How is the workflow and the communication of a Viewer and its table. I
>>think, there might be my problem.
>>Thanks.
>
>
>
|
|
|
Re: CheckboxTableViewer: set the checkboxes programmatically [message #466820 is a reply to message #466563] |
Tue, 17 January 2006 17:36  |
Eclipse User |
|
|
|
Problem solved. Just had to move the Method setChecked outside of the
LabelProvider. Don't know exactly why, but it does work now.
Flo wrote:
> I know, this might be a posting for the group eclipse.platform, but I
> didn't receive any replies over there and thus hope that you might give
> me some hints for my problem:
>
> I want to set the checkboxes within a 4 column table when initialising
> its contents (or on update). Therefore I set up a table with the style
> property SWT.CHECK and instantiate a CheckboxTableViewer with this table:
>
> table = new Table(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL |
> SWT.FULL_SELECTION | SWT.MAX | SWT.CHECK);
> viewer = new CheckboxTableViewer(table);
>
> Then, I thought it should work if I use the method
> LabelProvider.getColumnText(Object element, int columnIndex) of
> theviewer to set the checkboxes according to the element:
> element.
> viewer.setChecked(element, true);
>
> This method returns "true" and as I check the state of the element, it
> is set to "checked". But nevertheless, the checkboxes within the table
> don't show any changes.
>
> I have already tried to call the table.repaint() and table.update() but
> without success.
>
> How is the workflow and the communication of a Viewer and its table. I
> think, there might be my problem.
> Thanks.
|
|
|
Powered by
FUDForum. Page generated in 0.04855 seconds