chiark / gitweb /
where-vessels: break out info-toplevel-create
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 19 Feb 2012 15:01:43 +0000 (15:01 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 19 Feb 2012 15:01:43 +0000 (15:01 +0000)
yarrg/where-vessels

index eacde3a..6b1b0e2 100755 (executable)
@@ -1155,6 +1155,18 @@ proc draw {} {
 }
 
 
+#---------- info toplevel ----------
+
+proc info-toplevel-create {info title} {
+    toplevel $info
+    wm withdraw $info
+    wm title $info "where-vessels - $title"
+    wm protocol $info WM_DELETE_WINDOW [list wm withdraw $info]
+
+    button $info.close -text Close -command [list wm withdraw $info]
+    pack $info.close -side bottom
+}
+
 #---------- parser error reporting ----------
 
 proc parser-control-create {w base invokebuttontext etl_title} {
@@ -1171,17 +1183,11 @@ proc parser-control-create {w base invokebuttontext etl_title} {
     pack $w.resframe -side top -expand y -fill both
 
     set eb .err_$base
-    toplevel $eb
-    wm withdraw $eb
-    wm title $eb "where-vessels - $etl_title"
-    wm protocol $eb WM_DELETE_WINDOW [list wm withdraw $eb]
+    info-toplevel-create $eb $etl_title
 
     label $eb.title -text $etl_title
     pack $eb.title -side top
 
-    button $eb.close -text Close -command [list wm withdraw $eb]
-    pack $eb.close -side bottom
-
     frame $eb.emsg -bd 2 -relief groove
     label $eb.emsg.lab -anchor nw -text "Error:"
     text $eb.emsg.text -height 1