Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Button in a table
Button in a table [message #456730] Wed, 08 June 2005 00:36 Go to next message
Eclipse UserFriend
Originally posted by: doug-list.threepenny.net

I'd like to insert a button in a table.

Here's the code I'm using:

m_Button = new Button(table, SWT.PUSH) ;
m_Button.setText(first) ;

m_Button.addSelectionListener(new SelectionAdapter() {
public void widgetSelection(SelectionEvent e) {
// Do something here
} } ) ;

TableEditor editor = new TableEditor (table);
editor.grabHorizontal = true;
editor.setEditor(m_Button, item, 1);

The button appears perfectly in the table but I just can't get the
selection event to fire.

Am I doing something dumb? Is there another way to do this?

Doug
Re: Button in a table [message #456849 is a reply to message #456730] Fri, 10 June 2005 21:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: doug-list.threepenny.net

I figured out a solution -- switching from addSelectionListener() to
addListener(SWT.Selection,...).

Don't understand yet why these are different.

Anyone know?

Doug

Doug Pearson wrote:

> I'd like to insert a button in a table.
>
> Here's the code I'm using:
>
> m_Button = new Button(table, SWT.PUSH) ;
> m_Button.setText(first) ;
>
> m_Button.addSelectionListener(new SelectionAdapter() {
> public void widgetSelection(SelectionEvent e) {
> // Do something here
> } } ) ;
>
> TableEditor editor = new TableEditor (table);
> editor.grabHorizontal = true;
> editor.setEditor(m_Button, item, 1);
>
> The button appears perfectly in the table but I just can't get the
> selection event to fire.
>
> Am I doing something dumb? Is there another way to do this?
>
> Doug
>
Re: Button in a table [message #456896 is a reply to message #456849] Sat, 11 June 2005 14:57 Go to previous messageGo to next message
Stefan Zeiger is currently offline Stefan ZeigerFriend
Messages: 102
Registered: July 2009
Senior Member
Doug Pearson wrote:

> I figured out a solution -- switching from addSelectionListener() to
> addListener(SWT.Selection,...).
>
> Don't understand yet why these are different.

>> m_Button.addSelectionListener(new SelectionAdapter() {
>> public void widgetSelection(SelectionEvent e) {

The method is called widgetSelected, not widgetSelection. You can avoid
this kind of typo if you use Content Assist to create method stubs.

--
Stefan Zeiger - Developer of Novocode Application Framework
Build SWT-based MVC GUIs via XML: http://www.novocode.com/naf/
Re: Button in a table [message #456897 is a reply to message #456896] Sat, 11 June 2005 17:53 Go to previous message
Eclipse UserFriend
Originally posted by: doug-list.threepenny.net

Haha -- just a typo. I love it. Death by Adapter()...should have used
Listener() :)

Doug

Stefan Zeiger wrote:

> Doug Pearson wrote:
>
>> I figured out a solution -- switching from addSelectionListener() to
>> addListener(SWT.Selection,...).
>>
>> Don't understand yet why these are different.
>
>
>>> m_Button.addSelectionListener(new SelectionAdapter() {
>>> public void widgetSelection(SelectionEvent e) {
>
>
> The method is called widgetSelected, not widgetSelection. You can avoid
> this kind of typo if you use Content Assist to create method stubs.
>
Previous Topic:LwVCL Embedding
Next Topic:Mainwindow with subwindows in it
Goto Forum:
  


Current Time: Tue Apr 16 12:55:22 GMT 2024

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

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

Back to the top