Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Obtain combo box key from its value(Obtain combo box key by using its value)
Obtain combo box key from its value [message #1468881] Tue, 11 November 2014 05:58 Go to next message
girish arvin is currently offline girish arvinFriend
Messages: 1
Registered: November 2014
Junior Member
Hello! I'm current using SWT's Combo Box by setting key/value pairs as follows:
combo.add(<key>);
combo.setData(<key>,<value>);


When saving, the value is correctly saved into the database.
However, how do I do the "reverse" when editing a record and when I need to get the key from the value?
Note: My combo box is already populated with the key/pair values.
Re: Obtain combo box key from its value [message #1505692 is a reply to message #1468881] Wed, 10 December 2014 08:27 Go to previous message
Niraj Modi is currently offline Niraj ModiFriend
Messages: 48
Registered: November 2013
Member
You can achieve this as below :
Map map = new HashMap();
map.put("key", "value");
combo.setData(map);
From combo.getData() call you can get the map object and the corresponding key/value pair back.
Previous Topic:OwnerDrawLabelProvider and GC.drawText() issue
Next Topic:CSS animations in SWT.Browser not working
Goto Forum:
  


Current Time: Tue Jan 19 06:35:38 GMT 2021

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

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

Back to the top