Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » tableviewer selections(how to make a tableviewer non-selectable)
tableviewer selections [message #642339] Tue, 30 November 2010 20:35 Go to next message
fran81 Missing name is currently offline fran81 Missing nameFriend
Messages: 27
Registered: November 2010
Junior Member
Hello,

I have a tableviewer with cells that are not-editable.
BY default cells in the first column can be selected. How do I make the table completely not selectable?

I can only find ways to select the entire row, or to select also other columns....(using SWT.FULL_SELECTION...etc..)

Thanks!!
Re: tableviewer selections [message #642392 is a reply to message #642339] Wed, 01 December 2010 07:30 Go to previous messageGo to next message
Daniel Krügler is currently offline Daniel KrüglerFriend
Messages: 853
Registered: July 2009
Senior Member
On 11/30/2010 21:35, fran81 wrote:
> Hello,
>
> I have a tableviewer with cells that are not-editable.
> BY default cells in the first column can be selected. How do I make the
> table completely not selectable?

The intuitive choice would be to set the enablement property of the
underlying widget to false.

> I can only find ways to select the entire row, or to select also other
> columns....(using SWT.FULL_SELECTION...etc..)

If viewer.getTable().setEnabled(false) does not what you want to might
consider to effectively stop selection by transforming them in empty
selections, see e.g.

http://wiki.eclipse.org/index.php/JFaceSnippets#Snippet004Hi deSelection

for an example to start with (To realize what you want: Just call

v.setSelection(StructuredSelection.EMPTY);


*unconditionally* within the mouse-listener, i.e. remove the if-part.).

HTH & Greetings from Bremen,

Daniel Krügler
Re: tableviewer selections [message #642393 is a reply to message #642392] Wed, 01 December 2010 07:51 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Am 01.12.10 08:30, schrieb Daniel Krügler:
> On 11/30/2010 21:35, fran81 wrote:
>> Hello,
>>
>> I have a tableviewer with cells that are not-editable.
>> BY default cells in the first column can be selected. How do I make the
>> table completely not selectable?
>
> The intuitive choice would be to set the enablement property of the
> underlying widget to false.
>


This would have the draw back that you can't even scroll the widget
which is very often not the desired behavior.

Tom
Re: tableviewer selections [message #642397 is a reply to message #642393] Wed, 01 December 2010 07:59 Go to previous messageGo to next message
Daniel Krügler is currently offline Daniel KrüglerFriend
Messages: 853
Registered: July 2009
Senior Member
On 12/1/2010 08:51, Tom Schindl wrote:
> Am 01.12.10 08:30, schrieb Daniel Krügler:
>> On 11/30/2010 21:35, fran81 wrote:
>>> Hello,
>>>
>>> I have a tableviewer with cells that are not-editable.
>>> BY default cells in the first column can be selected. How do I make the
>>> table completely not selectable?
>>
>> The intuitive choice would be to set the enablement property of the
>> underlying widget to false.
>>
> This would have the draw back that you can't even scroll the widget
> which is very often not the desired behavior.

<nod>, I understand that, but the exact use-case of the OP was not clear
to me (which is often the case, if people are not describing more
precisely their intentions). Sometimes this is exactly what you want,
sometimes not. Therefore, and with the second situation in mind, I added
the

"If viewer.getTable().setEnabled(false) does not what you want"

part ;-)

- Daniel
Re: tableviewer selections [message #642496 is a reply to message #642397] Wed, 01 December 2010 15:31 Go to previous messageGo to next message
fran81 Missing name is currently offline fran81 Missing nameFriend
Messages: 27
Registered: November 2010
Junior Member
Thank you both, that was so helpful.

So since my table needed scroll behavior and
viewer.getTable().setEnabled(false) works but it also locks the scrollbar I used
v.setSelection(StructuredSelection.EMPTY);
inside a mouselistener, which works with no problem

Thanks again!
Francesca

Re: tableviewer selections [message #1232661 is a reply to message #642496] Fri, 17 January 2014 12:52 Go to previous message
Melwyn Jensen is currently offline Melwyn JensenFriend
Messages: 15
Registered: January 2014
Junior Member
Hi,

Can you please give me the code snippet to create tableviewer with cells that are not-editable??

Guess you have done that already.

Thanks.
Previous Topic:Xulrunner 25 with Eclipse
Next Topic:Missing dialog title bar with Fedora 20
Goto Forum:
  


Current Time: Thu Apr 18 03:32:32 GMT 2024

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

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

Back to the top