caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* GWindow message_dialog
@ 2007-10-31  5:21 Angela Zhu
  2007-10-31  7:58 ` [Caml-list] " Jacques Garrigue
  0 siblings, 1 reply; 4+ messages in thread
From: Angela Zhu @ 2007-10-31  5:21 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 1144 bytes --]

Dear all,

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?

Thanks,
Angela
------------------------------------------
Dept. of CS, Rice Unitersity
http://www.cs.rice.edu/~yz2/
------------------------------------------


[-- Attachment #2: Type: text/html, Size: 4517 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] GWindow message_dialog
  2007-10-31  5:21 GWindow message_dialog Angela Zhu
@ 2007-10-31  7:58 ` Jacques Garrigue
  2007-10-31 12:25   ` Angela Zhu
  0 siblings, 1 reply; 4+ messages in thread
From: Jacques Garrigue @ 2007-10-31  7:58 UTC (permalink / raw)
  To: angela.zhu; +Cc: caml-list

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re:  Re: [Caml-list] GWindow message_dialog
  2007-10-31  7:58 ` [Caml-list] " Jacques Garrigue
@ 2007-10-31 12:25   ` Angela Zhu
  0 siblings, 0 replies; 4+ messages in thread
From: Angela Zhu @ 2007-10-31 12:25 UTC (permalink / raw)
  To: Jacques Garrigue; +Cc: caml-list

>
THanks a lot!

Angela
------------------------------------------
Dept. of CS, Rice Unitersity
http://www.cs.rice.edu/~yz2/
------------------------------------------


> 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
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* GWindow message_dialog
@ 2007-10-31  4:19 Angela Zhu
  0 siblings, 0 replies; 4+ messages in thread
From: Angela Zhu @ 2007-10-31  4:19 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 1144 bytes --]

Dear all,

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?

Thanks,
Angela
------------------------------------------
Dept. of CS, Rice Unitersity
http://www.cs.rice.edu/~yz2/
------------------------------------------


[-- Attachment #2: Type: text/html, Size: 7859 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-10-31 12:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-31  5:21 GWindow message_dialog Angela Zhu
2007-10-31  7:58 ` [Caml-list] " Jacques Garrigue
2007-10-31 12:25   ` Angela Zhu
  -- strict thread matches above, loose matches on Subject: below --
2007-10-31  4:19 Angela Zhu

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).