proper input event handling;
authorwenzelm
Tue, 26 Mar 2013 14:38:44 +0100
changeset 51538 637e64effda2
parent 51537 abcd6d5f7508
child 51539 625d2ec0bbff
proper input event handling;
src/Tools/jEdit/src/timing_dockable.scala
--- a/src/Tools/jEdit/src/timing_dockable.scala	Tue Mar 26 14:14:39 2013 +0100
+++ b/src/Tools/jEdit/src/timing_dockable.scala	Tue Mar 26 14:38:44 2013 +0100
@@ -11,7 +11,7 @@
 
 import scala.actors.Actor._
 import scala.swing.{FlowPanel, Label, ListView, Alignment, ScrollPane, Component, TextField}
-import scala.swing.event.{EditDone, MouseClicked}
+import scala.swing.event.{MouseClicked, ValueChanged}
 
 import java.lang.System
 import java.awt.{BorderLayout, Graphics2D, Insets, Color}
@@ -134,15 +134,16 @@
 
   private val threshold_value = new TextField(Time.print_seconds(timing_threshold)) {
     reactions += {
-      case EditDone(_) =>
+      case _: ValueChanged =>
         text match {
           case Properties.Value.Double(x) if x >= 0.0 => timing_threshold = x
           case _ =>
         }
-        text = Time.print_seconds(timing_threshold)
         handle_update()
     }
     tooltip = "Threshold for timing display (seconds)"
+    verifier = ((s: String) =>
+      s match { case Properties.Value.Double(x) => x >= 0.0 case _ => false })
   }
 
   private val controls = new FlowPanel(FlowPanel.Alignment.Right)(threshold_label, threshold_value)