Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[pde-dev] RE: Getting the Value from a org.eclipse.swt.widgets.Combo

Try something on the lines of:

final CCombo combo = new CCombo( parent, SWT.FLAT );
combo.setLayoutData( new GridData() );
combo.setText( initialValue );
combo.setItems( array );
combo.addModifyListener( new ModifyListener() {
	public void modifyText(ModifyEvent e) {
      	String text = combo.getText().trim();
		System.out.println("your selection is "  + text );
      }
}

Have fun with SWT...

Mike E.


-----Original Message-----
From: pde-dev-admin@xxxxxxxxxxx [mailto:pde-dev-admin@xxxxxxxxxxx] On Behalf
Of pde-dev-request@xxxxxxxxxxx
Sent: 01 September 2004 17:00
To: pde-dev@xxxxxxxxxxx
Subject: pde-dev digest, Vol 1 #191 - 1 msg

Send pde-dev mailing list submissions to
	pde-dev@xxxxxxxxxxx

To subscribe or unsubscribe via the World Wide Web, visit
	http://dev.eclipse.org/mailman/listinfo/pde-dev
or, via email, send a message with subject or body 'help' to
	pde-dev-request@xxxxxxxxxxx

You can reach the person managing the list at
	pde-dev-admin@xxxxxxxxxxx

When replying, please edit your Subject line so it is more specific than
"Re: Contents of pde-dev digest..."


Today's Topics:

   1. Getting the Value from a org.eclipse.swt.widgets.Combo (Mark Drew)

--__--__--

Message: 1
Date: Wed, 1 Sep 2004 16:02:06 +0200
From: Mark Drew <mark.drew@xxxxxxxxx>
To: pde-dev@xxxxxxxxxxx
Subject: [pde-dev] Getting the Value from a org.eclipse.swt.widgets.Combo
Reply-To: pde-dev@xxxxxxxxxxx

Hi there
first post from a newby

I am (trying) to develop a ComboBox drop down widnow that popsup and creates
a Combo. All is working, and I am populating the drop down with

combo.add(items[i]); 

I have also added a method
protected void buttonPressed(int buttonId) {
       if (buttonId == IDialogConstants.OK_ID) {
           
           System.out.println("your selection is "  +
combo.getSelectionIndex()+  "somthing");
        }
       super.buttonPressed(buttonId);
       
   }
        }
       super.buttonPressed(buttonId);
       
   }

But when I run this, I get an error in the System.out.println that:
Unhandled event loop exception
Reason:
java.lang.NullPointerException


What is the correct way to get data from a dropdown in a combo?

Any help greatly apreciated
--
Mark Drew
mailto:mark.drew@xxxxxxxxx
coldfusion and cfeclipse blog:http://cybersonic.blogspot.com/


--__--__--

_______________________________________________
pde-dev mailing list
pde-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/pde-dev


End of pde-dev Digest





Back to the top