[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Jacques Garrigue <garrigue@m...> |
| Subject: | Re: [Caml-list] GWindow message_dialog |
From: Angela Zhu <angela.zhu@cs.rice.edu> > I want to create a GWindow.message_dialog with the following > functionality in my GUI: > > If I click on a button "reset" or "run", > it prompt out a message " program is running, please wait..." > And it disappear after, say, 3 seconds. > (I want this message here is to let the user know the program is > responding, but it will take a while before getting the result. ) > > I am defining a function like this: > > let print_sim_wait str win () = > let my_message = if (str="run") then "Program running, please > wait ... " > else "System state resetting, please wait ... " > in > let diag = GWindow.message_dialog ~message_type:`INFO > ~buttons:GWindow.Buttons.ok > ~message: my_message > ~destroy_with_parent: true ~parent:win () in > let res = diag#run () = `OK in > diag#destroy () > > However, this requires the user to click on "OK" every time to close > the window. > Can we set a timeline, such that the window will destroy itself after > a while, without requiring any action? Very easy: just add the following line before diag#run. GMain.Timeout.add ~ms:3000 ~callback:(fun () -> diag#activate_default(); false); Jacques Garrigue By the way, there is a mailing list devoted to LablGTK, http://yquem.inria.fr/cgi-bin/mailman/listinfo/lablgtk