Blame browser/jg_entry.ml

Packit bd2e5d
(*************************************************************************)
Packit bd2e5d
(*                                                                       *)
Packit bd2e5d
(*                         OCaml LablTk library                          *)
Packit bd2e5d
(*                                                                       *)
Packit bd2e5d
(*            Jacques Garrigue, Kyoto University RIMS                    *)
Packit bd2e5d
(*                                                                       *)
Packit bd2e5d
(*   Copyright 1999 Institut National de Recherche en Informatique et    *)
Packit bd2e5d
(*   en Automatique and Kyoto University.  All rights reserved.          *)
Packit bd2e5d
(*   This file is distributed under the terms of the GNU Library         *)
Packit bd2e5d
(*   General Public License, with the special exception on linking       *)
Packit bd2e5d
(*   described in file ../../../LICENSE.                                 *)
Packit bd2e5d
(*                                                                       *)
Packit bd2e5d
(*************************************************************************)
Packit bd2e5d
Packit bd2e5d
(* $Id$ *)
Packit bd2e5d
Packit bd2e5d
open Tk
Packit bd2e5d
Packit bd2e5d
let create ?command ?width ?textvariable parent =
Packit bd2e5d
  let ew = Entry.create parent ?width ?textvariable in
Packit bd2e5d
  Jg_bind.enter_focus ew;
Packit bd2e5d
  begin match command with Some command ->
Packit bd2e5d
    bind ew ~events:[`KeyPressDetail "Return"]
Packit bd2e5d
      ~action:(fun _ -> command (Entry.get ew))
Packit bd2e5d
  | None -> ()
Packit bd2e5d
  end;
Packit bd2e5d
  ew