caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <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
Date: Wed, 31 Oct 2007 16:58:38 +0900 (JST)	[thread overview]
Message-ID: <20071031.165838.28790725.garrigue@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <AB70E2EF-0B35-44F3-B35D-35E3C6D1619A@cs.rice.edu>

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


  reply	other threads:[~2007-10-31  7:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-31  5:21 Angela Zhu
2007-10-31  7:58 ` Jacques Garrigue [this message]
2007-10-31 12:25   ` Re: [Caml-list] " Angela Zhu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071031.165838.28790725.garrigue@math.nagoya-u.ac.jp \
    --to=garrigue@math.nagoya-u.ac.jp \
    --cc=angela.zhu@cs.rice.edu \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).