Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Single Selection of the cell in Tree component(Single Selection of the cell in Tree component)
Single Selection of the cell in Tree component [message #525655] Wed, 07 April 2010 11:51 Go to next message
No real name is currently offline No real nameFriend
Messages: 11
Registered: March 2010
Junior Member
How to implement the Single selection of the cell in SWT Tree component. I have two four column in tree and want to select the on cell and attache event to it

Re: Single Selection of the cell in Tree component [message #525672 is a reply to message #525655] Wed, 07 April 2010 12:36 Go to previous messageGo to next message
Daniel Krügler is currently offline Daniel KrüglerFriend
Messages: 853
Registered: July 2009
Senior Member
On 07.04.2010 13:51, atmohsin@gmail.com wrote:
> How to implement the Single selection of the cell in SWT Tree component.
> I have two four column in tree and want to select the on cell and
> attache event to it

You may be successful, if you test either of these approaches (adapted
to tree instead of table):

http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet110.java?view=co
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet3.java?view=co

Read the comment in the snippet carefully, because the second
approach works only for SWT.FULL_SELECTION.

You may also try this one:

http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet90.java?view=co

HTH & Greetings from Bremen,

Daniel Krügler
Re: Single Selection of the cell in Tree component [message #525934 is a reply to message #525672] Thu, 08 April 2010 10:42 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 11
Registered: March 2010
Junior Member
Thanks for the replay

In My Screen i have tree component which has around 4 columns in it. User should able to select any cell and corresponding action should fired. I mean when i select cell from second row and second column. That particular cell should highlighted and new window should get open.

Thanks
Re: Single Selection of the cell in Tree component [message #525960 is a reply to message #525934] Thu, 08 April 2010 11:27 Go to previous messageGo to next message
Daniel Krügler is currently offline Daniel KrüglerFriend
Messages: 853
Registered: July 2009
Senior Member
On 08.04.2010 12:42, atmohsin@gmail.com wrote:
> In My Screen i have tree component which has around 4 columns in it.
> User should able to select any cell and corresponding action should
> fired. I mean when i select cell from second row and second column. That
> particular cell should highlighted and new window should get open.

Did you try any of the suggested approaches? IMO it should be possible
to deduce both the row and column coordinates of a given cell.

If you are working on a jface level, you could also use the method
ColumnViewer.getCell(Point). The current coordinates provided via
the Point object are typically available within a mouse-event (e.g.
MouseListener) and the returned ViewerCell instance provides the
column and row information. This is basically the same information
as obtained from SWT level, but you can do that with less code writing.

If you want to realize that a *single* cell is selected, you may
consider to use a cell editor in read-only mode to realize this. Search
for "celleditor" in

http://wiki.eclipse.org/index.php/JFaceSnippets

or look at what the focus cell manager does (search for "cellnavigation"
in the same page).

HTH & Greetings from Bremen,

Daniel Krügler
Re: Single Selection of the cell in Tree component [message #525977 is a reply to message #525960] Thu, 08 April 2010 13:06 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 11
Registered: March 2010
Junior Member
We have the application which used SWT Tree component, with that single cell selection is not working. need to make it work with the minimum changes. Just want to know what is the best way i can implement this in my scenario.

Yes i have gone through the example.

Thanks
Re: Single Selection of the cell in Tree component [message #526003 is a reply to message #525977] Thu, 08 April 2010 14:10 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
See http://www.eclipse.org/forums/index.php?t=msg&th=163693& amp;#msg_518092 .
For an example of using TableCursor, which provides the functionality that
you want for Tables, see
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org. eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet96. java .

Grant


<atmohsin@gmail.com> wrote in message news:hpkkd4$1m9$1@build.eclipse.org...
> We have the application which used SWT Tree component, with that single
cell selection is not working. need to make it work with the minimum
changes. Just want to know what is the best way i can implement this in my
scenario.
>
> Yes i have gone through the example.
>
> Thanks
>
Re: Single Selection of the cell in Tree component [message #526016 is a reply to message #526003] Thu, 08 April 2010 14:35 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 11
Registered: March 2010
Junior Member

Is it possible for org.eclipse.swt.widgets.Tree component. Because we are using Tree component right now i dont want to change the basic control.
Re: Single Selection of the cell in Tree component [message #526080 is a reply to message #526016] Thu, 08 April 2010 15:52 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
See the first link. There's currently no TreeCursor class, but if you make
a copy of the TableCursor class and do a Find/Replace of "able" with "ree",
you'll get somewhat close to having a TreeCursor class.

To be notified of progress on the the request to add a TreeCursor class in
swt you should CC yourself to the linked bug report.

Grant


<atmohsin@gmail.com> wrote in message news:hpkpj0$h6n$1@build.eclipse.org...
>
> Is it possible for org.eclipse.swt.widgets.Tree component. Because we are
using Tree component right now i dont want to change the basic control.
Re: Single Selection of the cell in Tree component [message #526170 is a reply to message #526080] Fri, 09 April 2010 06:08 Go to previous message
No real name is currently offline No real nameFriend
Messages: 11
Registered: March 2010
Junior Member
Hi,

There is jar file which has TreeCursor implementation and relative classes. Find the URL

http://www.java2s.com/Code/Jar/DEF/Downloadorgeclipsedebugui 330v200706071800jar.htm

I tested it is working fine with this. Only the problem with this is the selected cell color and selected row color is different. The selected row color is Grey and selected cell is white how to control the colors.

Thanks
Mohsin
Previous Topic:SWT Browser Widget, no mouse events while loading
Next Topic:org.eclipse.swt.widgets.Tracker
Goto Forum:
  


Current Time: Mon Dec 16 13:34:58 GMT 2019

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

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

Back to the top