diff options
author | Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> | 1999-12-16 08:37:38 +0000 |
---|---|---|
committer | Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> | 1999-12-16 08:37:38 +0000 |
commit | 607772a16356084f724b7b4d8f29907def715ff1 (patch) | |
tree | 207c813ba86751631a7970b3c424db9b481e537c /otherlibs/labltk/browser/jg_box.ml | |
parent | fd6165164bf3ca6631e3b2b12a0f25ba3f5dd97a (diff) |
drastic clean up of the code. slice .cmo size by 2!
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2692 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/labltk/browser/jg_box.ml')
-rw-r--r-- | otherlibs/labltk/browser/jg_box.ml | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/otherlibs/labltk/browser/jg_box.ml b/otherlibs/labltk/browser/jg_box.ml index e7add1139..21a05829d 100644 --- a/otherlibs/labltk/browser/jg_box.ml +++ b/otherlibs/labltk/browser/jg_box.ml @@ -37,20 +37,22 @@ let add_completion ?:action ?:wait ?:nocase lb = Jg_bind.enter_focus lb; - bind lb events:[[], `KeyPress] - action:(`Set([`Char], fun ev -> + bind lb events:[`KeyPress] fields:[`Char] action: + begin fun ev -> (* consider only keys producing characters. The callback is called even if you press Shift. *) if ev.ev_Char <> "" then - recenter lb index:(`Num (comp#add ev.ev_Char)))); + recenter lb index:(`Num (comp#add ev.ev_Char)) + end; begin match action with Some action -> - bind lb events:[[], `KeyPressDetail "Return"] - action:(`Set ([], fun _ -> action `Active)); - bind lb events:[[`Double], `ButtonPressDetail 1] - action:(`Setbreakable ([`MouseY], fun ev -> - action (Listbox.nearest lb y:ev.ev_MouseY); break ())) + bind lb events:[`KeyPressDetail "Return"] + action:(fun _ -> action `Active); + bind lb events:[`Modified([`Double], `ButtonPressDetail 1)] + breakable:true fields:[`MouseY] + action:(fun ev -> + action (Listbox.nearest lb y:ev.ev_MouseY); break ()) | None -> () end; |