Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How associate a combo in a TableItem in a Table
How associate a combo in a TableItem in a Table [message #640928] Tue, 23 November 2010 15:13 Go to next message
kkt8 Mising name is currently offline kkt8 Mising nameFriend
Messages: 27
Registered: November 2010
Junior Member
Hello,

I've a Table with 3 columns.
All cells are TableItem.
In the third column, some cells can contain Combo, but how associate combo and TableItem ?
       Table table = new Table(form.getBody(), SWT.NO_SCROLL|SWT.BORDER_SOLID);   
       TableColumn tc;
        tc = new TableColumn(table, SWT.RIGHT);
        tc.setWidth(115);
        tc = new TableColumn(table, SWT.RIGHT);
        tc.setWidth(220);
        tc = new TableColumn(table, SWT.RIGHT);
        tc.setWidth(240);
               
        table.pack();
        TableItem t1 = new TableItem(table, SWT.NONE);
        t1.setText(0, "1 col");
        TableItem t1 = new TableItem(table, SWT.NONE);
        t1.setText(0, "2 col");
.... TableItem with combo ???


Thank you Razz
Re: How associate a combo in a TableItem in a Table [message #640933 is a reply to message #640928] Tue, 23 November 2010 15:23 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/23/2010 16:14, kkt8 wrote:
> Hello,
>
> I've a Table with 3 columns.
> All cells are TableItem.
> In the third column, some cells can contain Combo, but how associate
> combo and TableItem ?
>
> Table table = new Table(form.getBody(), SWT.NO_SCROLL|SWT.BORDER_SOLID);
> TableColumn tc;
> tc = new TableColumn(table, SWT.RIGHT);
> tc.setWidth(115);
> tc = new TableColumn(table, SWT.RIGHT);
> tc.setWidth(220);
> tc = new TableColumn(table, SWT.RIGHT);
> tc.setWidth(240);
> table.pack();
> TableItem t1 = new TableItem(table, SWT.NONE);
> t1.setText(0, "1 col");
> TableItem t1 = new TableItem(table, SWT.NONE);
> t1.setText(0, "2 col");
> ... TableItem with combo ???

I suggest that you store a reference to the corresponding combo in the
property-bag of the item (look for member data, which is overloaded. I
suggest to use the overload with a specific key, e.g. "combo" or some such).

HTH & Greetings from Bremen,

Daniel Krügler
Re: How associate a combo in a TableItem in a Table [message #640934 is a reply to message #640933] Tue, 23 November 2010 15:33 Go to previous messageGo to next message
kkt8 Mising name is currently offline kkt8 Mising nameFriend
Messages: 27
Registered: November 2010
Junior Member
euh .. I don't understand what you mean?
Can you give me an example please ?

Thank you Embarrassed
Re: How associate a combo in a TableItem in a Table [message #640940 is a reply to message #640934] Tue, 23 November 2010 15:50 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/23/2010 16:33, kkt8 wrote:
> euh .. I don't understand what you mean?
> Can you give me an example please ?

From your original question I understood that you have already created
the combo, but that you want the combo associated to the TableItem. That
is easy:

Combo c = ..;
TableItem t = ...;
t.setData("combo", c);

If you ask, how to *integrate* a combo in a TableItem, just look at this
example:

http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org. eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet126 .java

HTH & Greetings from Bremen

- Daniel Krügler
Re: How associate a combo in a TableItem in a Table [message #640950 is a reply to message #640940] Tue, 23 November 2010 16:11 Go to previous message
kkt8 Mising name is currently offline kkt8 Mising nameFriend
Messages: 27
Registered: November 2010
Junior Member
THANK YOU Laughing
the link you send me answer my question !
Previous Topic:Long cells in table/tree - truncate from left?
Next Topic:Tableviewer reset
Goto Forum:
  


Current Time: Sat Oct 21 14:25:38 GMT 2017

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

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