[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform] [DataBinding] Strange Behavior when binding to a combo
|
- From: Ali Naddaf <ali@xxxxxxxxxx>
- Date: Sun, 25 Nov 2007 00:43:00 -0600
- Newsgroups: eclipse.platform
- Organization: EclipseCorner
- User-agent: Thunderbird 2.0.0.9 (Windows/20071031)
Hello All.
I posted a question a day ago and later on noticed that in fact the
issue was had a different nature so here is my new problem. Let say I
have the following snippet where I am binding the "name" field of the
bean "ss" to a Combo called combo: ("dbc" is my databinding context)
-------------------
ss.setName("one");
combo= new Combo(group, SWT.NONE);
combo.setItems(new String[]{"", "one", "two"});
dbc.bindValue(SWTObservables.observeSelection(combo),
BeansObservables.observeValue(ss, "name"), null, null);
------------------
When I run this, I will see "one" in the combo, as expected. However, at
this moment, if I select "" (i.e. the empty selection) in the combo, the
model (i.e. the "name" field in ss) doesn't get updated. If, on the
other hand, I add the following line to the end of the above snippet,
then all works as expected:
combo.setText(ss.getName());
Could someone please tell me what I am missing here?
Many thanks
Ali.