Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » CheckboxTableViewer: set the checkboxes programmatically
CheckboxTableViewer: set the checkboxes programmatically [message #466563] Wed, 11 January 2006 17:29 Go to next message
Florian Huber is currently offline Florian HuberFriend
Messages: 15
Registered: July 2009
Junior Member
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 20:37 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
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 22:40 Go to previous messageGo to next message
Florian Huber is currently offline Florian HuberFriend
Messages: 15
Registered: July 2009
Junior Member
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 22:36 Go to previous message
Florian Huber is currently offline Florian HuberFriend
Messages: 15
Registered: July 2009
Junior Member
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.
Previous Topic:Trouble with margins when printing
Next Topic:SWT Combo scroll area
Goto Forum:
  


Current Time: Sun Dec 08 15:56:06 GMT 2024

Powered by FUDForum. Page generated in 0.05553 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top