From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 822DEBC6B for ; Wed, 31 Oct 2007 08:58:44 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAN/SJ0eFBoIFh2dsb2JhbACOZAIBCAopgRM X-IronPort-AV: E=Sophos;i="4.21,350,1188770400"; d="scan'208";a="18791651" Received: from rabbit.math.nagoya-u.ac.jp ([133.6.130.5]) by mail4-smtp-sop.national.inria.fr with ESMTP; 31 Oct 2007 08:58:43 +0100 Received: from localhost (millas [172.16.30.29]) by rabbit.math.nagoya-u.ac.jp (8.12.11/3.7W) with ESMTP id l9V7wMTc029123; Wed, 31 Oct 2007 16:58:22 +0900 (JST) Date: Wed, 31 Oct 2007 16:58:38 +0900 (JST) Message-Id: <20071031.165838.28790725.garrigue@math.nagoya-u.ac.jp> To: angela.zhu@cs.rice.edu Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] GWindow message_dialog From: Jacques Garrigue In-Reply-To: References: X-Mailer: Mew version 4.0.69 on Emacs 22.0.50 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; gwindow:01 gwindow:01 gmain:01 lablgtk:01 lablgtk:01 angela:98 angela:98 caml-list:01 callback:02 defining:02 garrigue:03 garrigue:03 jacques:03 jacques:03 let:03 From: Angela Zhu > 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