diff options
author | Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> | 2000-02-12 23:19:35 +0000 |
---|---|---|
committer | Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> | 2000-02-12 23:19:35 +0000 |
commit | 1e84be9cd56b5466befa3f7b1957f7421b32f417 (patch) | |
tree | a36e55c8c311fe6b68ad7e36668332cd506ba567 /otherlibs/labltk/browser/editor.ml | |
parent | 34068509c888623640b140b7aaa8299d285c21d9 (diff) |
label related fixes
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2809 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/labltk/browser/editor.ml')
-rw-r--r-- | otherlibs/labltk/browser/editor.ml | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/otherlibs/labltk/browser/editor.ml b/otherlibs/labltk/browser/editor.ml index e7ee627ac..ade7712b0 100644 --- a/otherlibs/labltk/browser/editor.ml +++ b/otherlibs/labltk/browser/editor.ml @@ -473,14 +473,16 @@ class editor :top :menus = object (self) method close_file () = self#close_window (List.hd windows) method quit () = - try List.iter windows - fun:(fun txt -> + try + List.iter windows fun: + begin fun txt -> if Textvariable.get txt.modified = "modified" then match Jg_message.ask master:top title:"Quit" ("`" ^ Filename.basename txt.name ^ "' modified. Save it?") with `yes -> self#save_text txt | `no -> () - | `cancel -> raise Exit); + | `cancel -> raise Exit + end; bind top events:[`Destroy]; destroy top; break () with Exit -> break () @@ -511,18 +513,19 @@ class editor :top :menus = object (self) action:(fun _ -> act (); break ()) end; - bind top events:[`Destroy] breakable:true fields:[`Widget] - action:(fun ev -> + bind top events:[`Destroy] breakable:true fields:[`Widget] action: + begin fun ev -> if Widget.name ev.ev_Widget = Widget.name top - then self#quit ()); + then self#quit () + end; (* File menu *) file_menu#add_command "Open File..." command:self#open_file; file_menu#add_command "Reopen" command:(fun () -> self#load_text [(List.hd windows).name]); file_menu#add_command "Save File" command:self#save_file accelerator:"M-s"; - file_menu#add_command "Save As..." underline:5 - command:begin fun () -> + file_menu#add_command "Save As..." underline:5 command: + begin fun () -> let txt = List.hd windows in Fileselect.f title:"Save as File" action:(fun name -> self#save_text txt :name) |