Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Binding a set of radio buttons to an int property
Binding a set of radio buttons to an int property [message #497090] Thu, 12 November 2009 13:50 Go to next message
Damien Mising name is currently offline Damien Mising nameFriend
Messages: 7
Registered: July 2009
Junior Member
Hello everybody,

I am trying to bind a set of radio buttons to an int property. Is there a short way of doing that? Every solution I have found on the Web was quite long.

Damien
Re: Binding a set of radio buttons to an int property [message #497146 is a reply to message #497090] Thu, 12 November 2009 16:03 Go to previous messageGo to next message
Matthew Hall is currently offline Matthew HallFriend
Messages: 368
Registered: July 2009
Senior Member
Damien wrote:
> Hello everybody,
>
> I am trying to bind a set of radio buttons to an int property. Is there
> a short way of doing that? Every solution I have found on the Web was
> quite long.
>
> Damien

RadioGroup is a good fit for this, although I have not written any
databinding properties for that widget yet. If you will file a bugzilla
I can get that done within a day or two.

Otherwise you can use SelectObservableValue:

SelectObservableValue select = new SelectObservableValue(int.class);

IValueProperty selectionProp = WidgetProperties.selection();
for (int i = 0; i < buttons.length; i++)
select.addOption(
Integer.valueOf(i),
selectionProp.observe(buttons[i]) );

bindingContext.bind(
select,
BeanProperties.value("myProperty").observe(myModel) );

Matthew
Re: Binding a set of radio buttons to an int property [message #497155 is a reply to message #497146] Thu, 12 November 2009 17:24 Go to previous message
Damien Mising name is currently offline Damien Mising nameFriend
Messages: 7
Registered: July 2009
Junior Member
Thanks a lot Matthew, SelectObservableValue was exactly what I was looking for (I am new to databindings). It works perfectly.

Damien
Previous Topic:Byte Order Mark ( BOM ) and Editor
Next Topic:Resource doesn't exist
Goto Forum:
  


Current Time: Fri Apr 19 11:33:41 GMT 2024

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

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

Back to the top