Skip to main content



      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 15:35 Go to next message
Eclipse UserFriend
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 02:30 Go to previous messageGo to next message
Eclipse UserFriend
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 02:51 Go to previous messageGo to next message
Eclipse UserFriend
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 02:59 Go to previous messageGo to next message
Eclipse UserFriend
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 10:31 Go to previous messageGo to next message
Eclipse UserFriend
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 07:52 Go to previous message
Eclipse UserFriend
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: Tue Jul 22 20:04:58 EDT 2025

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

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

Back to the top