how do i listen on events on a radiobutton in scala? i have the following code, but for some reason the reaction is not executed. this is a Dialog, and i am looking to listen on radiobutton selection, and to change the Dialog window's title accordingly.
val dirFileSelector = {
List(
new RadioButton("Directory"){
name = "dir"
},
new RadioButton("File"){
name = "file"
}
)
}
val buttonGroup = new ButtonGroup
dirFileSelector map { button=>
listenTo(button)
buttonGroup.buttons.add(button)
}
contents = new BorderPanel{
add(new BoxPanel(Orientation.Horizontal) {contents ++= dirFileSelector}, BorderPanel.Position.North)
}
reactions += {
case SelectionChanged(buttonSelect) => {
println("buttonSelect selection changed")
buttonSelect.name match {
case "dir" => title = "Add Directory"
case "file" => title = "Add File"
}
}
}