13 class bar bar = object
14 val bar : progress_bar obj = bar
15 val mutable pstat = true
17 let pvalue = Progress.get_percentage bar in
19 if pvalue >= 1.0 || not pstat then (pstat <- true; 0.0)
22 ProgressBar.update bar percent:pvalue;
30 let window = Window.create `TOPLEVEL in
31 GtkSignal.connect sig:Object.Signals.destroy window callback:Main.quit;
32 Container.set_border_width window 10;
34 let table = Table.create rows:3 columns:2 in
35 Container.add window table;
37 let label = Label.create "Progress Bar Example" in
38 Table.attach table label left:0 right:2 top:0 expand:`X shrink:`BOTH;
40 let pbar = ProgressBar.create () in
41 Table.attach table pbar left:0 right:2 top:1 fill:`X shrink:`BOTH;
43 let bar = new bar pbar in
44 let ptimer = Timeout.add 100 callback:(fun () -> bar#progress) in
46 let button = Button.create label:"Reset" in
47 GtkSignal.connect sig:Button.Signals.clicked button
48 callback:(fun () -> bar#progress_r);
49 Table.attach table button left:0 top:2 expand:`NONE fill:`X shrink:`BOTH;
51 let button = Button.create label:"Cancel" in
52 GtkSignal.connect sig:Button.Signals.clicked button callback:Main.quit;
53 Table.attach table button left:1 top:2 expand:`NONE fill:`X shrink:`BOTH;
55 Widget.show_all window