forked from garrigue/lablgtk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
progressbar.ml
43 lines (31 loc) · 1.56 KB
/
progressbar.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
(**************************************************************************)
(* Lablgtk - Examples *)
(* *)
(* This code is in the public domain. *)
(* You may freely copy parts of it in your application. *)
(* *)
(**************************************************************************)
(* $Id$ *)
open GMain
let main () =
let window = GWindow.window ~border_width: 10 () in
window#connect#destroy ~callback:Main.quit;
let table = GPack.table ~rows:3 ~columns:2 ~packing: window#add () in
GMisc.label ~text:"Progress Bar Example" ()
~packing:(table#attach ~left:0 ~right:2 ~top:0 ~expand:`X ~shrink:`BOTH);
let pbar =
GRange.progress_bar ~pulse_step:0.01 ()
~packing:(table#attach ~left:0 ~right:2 ~top:1
~expand:`BOTH ~fill:`X ~shrink:`BOTH) in
let ptimer = Timeout.add ~ms:50 ~callback:(fun () -> pbar#pulse(); true) in
let button = GButton.button ~label:"Reset" ()
~packing:(table#attach ~left:0 ~top:2
~expand:`NONE ~fill:`X ~shrink:`BOTH) in
button#connect#clicked ~callback:(fun () -> pbar#set_fraction 0.);
let button = GButton.button ~label:"Cancel" ()
~packing:(table#attach ~left:1 ~top:2
~expand:`NONE ~fill:`X ~shrink:`BOTH) in
button#connect#clicked ~callback:Main.quit;
window#show ();
Main.main ()
let _ = main ()