Index: trunk/MultiChannelUSB/UserInterface.tcl
===================================================================
--- trunk/MultiChannelUSB/UserInterface.tcl	(revision 167)
+++ trunk/MultiChannelUSB/UserInterface.tcl	(revision 168)
@@ -7,5 +7,5 @@
 package require zlib
 
-wm minsize . 990 660
+wm minsize . 990 680
 
 namespace eval ::mca {
@@ -513,7 +513,11 @@
         frame ${config}.spc6 -width 170 -height 30
 
-
         button ${config}.register -text Register \
             -bg lightblue -activebackground lightblue -command [myproc register]
+
+        frame ${config}.spc7 -width 170 -height 30
+
+        button ${config}.recover -text {Read file} \
+            -bg lightblue -activebackground lightblue -command [myproc recover]
 
         grid ${config}.axis_check -sticky w
@@ -533,4 +537,6 @@
         grid ${config}.spc6
         grid ${config}.register -sticky ew -pady 3 -padx 5
+        grid ${config}.spc7
+        grid ${config}.recover -sticky ew -pady 3 -padx 5
 
         grid ${graph} -row 0 -column 0 -sticky news
@@ -871,6 +877,41 @@
 # -------------------------------------------------------------------------
 
+    HstDisplay instproc open_data {} {
+        set types {
+            {{Data Files}       {.dat}     }
+            {{All Files}        *             }
+        }
+
+        set fname [tk_getOpenFile -filetypes $types]
+        if {[string equal $fname {}]} {
+            return
+        }
+
+        set x [catch {
+            set fid [open $fname r+]
+            fconfigure $fid -translation binary -encoding binary
+            [myvar yvec] set [split [read $fid] \n]
+            close $fid
+        }]
+
+        if { $x || ![file exists $fname] || ![file isfile $fname] || ![file readable $fname] } {
+            tk_messageBox -icon error \
+                -message "An error occurred while reading \"$fname\""
+        } else {
+            tk_messageBox -icon info \
+                -message "File \"$fname\" read successfully"
+        }
+    }
+
+# -------------------------------------------------------------------------
+
     HstDisplay instproc register {} {
         my save_data [join [[myvar yvec] range 0 4095] \n]
+    }
+
+# -------------------------------------------------------------------------
+
+    HstDisplay instproc recover {} {
+        my open_data
     }
 
@@ -1001,4 +1042,9 @@
         button ${config}.register -text Register \
             -bg lightblue -activebackground lightblue -command [myproc register]
+
+        frame ${config}.spc8 -width 170 -height 30
+
+        button ${config}.recover -text {Read file} \
+            -bg lightblue -activebackground lightblue -command [myproc recover]
 
         grid ${config}.axis_check -sticky w
@@ -1019,4 +1065,6 @@
         grid ${config}.spc7
         grid ${config}.register -sticky ew -pady 3 -padx 5
+        grid ${config}.spc8
+        grid ${config}.recover -sticky ew -pady 3 -padx 5
 
         grid ${graph} -row 0 -column 0 -sticky news
@@ -1331,6 +1379,41 @@
 # -------------------------------------------------------------------------
 
+    CntDisplay instproc open_data {} {
+        set types {
+            {{Data Files}       {.dat}     }
+            {{All Files}        *             }
+        }
+
+        set fname [tk_getOpenFile -filetypes $types]
+        if {[string equal $fname {}]} {
+            return
+        }
+
+        set x [catch {
+            set fid [open $fname r+]
+            fconfigure $fid -translation binary -encoding binary
+            [myvar yvec] set [split [read $fid] \n]
+            close $fid
+        }]
+
+        if { $x || ![file exists $fname] || ![file isfile $fname] || ![file readable $fname] } {
+            tk_messageBox -icon error \
+                -message "An error occurred while reading \"$fname\""
+        } else {
+            tk_messageBox -icon info \
+                -message "File \"$fname\" read successfully"
+        }
+    }
+
+# -------------------------------------------------------------------------
+
     CntDisplay instproc register {} {
         my save_data [join [[myvar yvec] range 0 9999] \n]
+    }
+
+# -------------------------------------------------------------------------
+
+    CntDisplay instproc recover {} {
+        my open_data
     }
 
@@ -1464,5 +1547,5 @@
             -bg yellow -activebackground yellow
 
-        frame ${config}.spc6 -width 170 -height 10
+        frame ${config}.spc6 -width 170 -height 30
 
         button ${config}.recover -text {Read file} \
