File: entry2.ml

package info (click to toggle)
lablgtk3 3.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,796 kB
  • sloc: ml: 40,890; ansic: 22,312; makefile: 133; sh: 17
file content (19 lines) | stat: -rw-r--r-- 886 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
(**************************************************************************)
(*    Lablgtk - Examples                                                  *)
(*                                                                        *)
(*    This code is in the public domain.                                  *)
(*    You may freely copy parts of it in your application.                *)
(*                                                                        *)
(**************************************************************************)

let _ = GMain.init ()
let w = GWindow.window ~show:true ()
let e = GEdit.entry ~packing:w#add ()

let () =
  e#connect#after#insert_text
    (fun _ ~pos ->
      if e#text_length > 5 then e#set_secondary_icon_stock `DIALOG_WARNING
      else e#set_secondary_icon_name "");
  w#event#connect#delete (fun _ -> GMain.quit (); true);
  GMain.main ()