[Glade-users] Timing out a dialog
- From: balakkvj at gmail.com (His Majesty)
- Subject: [Glade-users] Timing out a dialog
- Date: Fri, 6 Mar 2009 13:27:24 +0000
Hi Tristan,
I am not sure how to implement your solution.
I have a function that takes in an argument for use as the message in
the dialog.
Here is the function
========================================
void mainWindow::on_command_show_action(Glib::ustring object)
{
Glib::ustring message= object;
Gtk::MessageDialog dialog(*this, message);
Glib::ustring comment= "Action performed.";
dialog.set_secondary_text(comment);
int result = dialog.run();
}
========================================
This function is called when a button is pressed using
initiateCommand->signal_clicked().connect(sigc::bind(sigc::mem_fun(*this,
&mainWindow::on_command_take_action),"!S5101 Fired"));
I have tried using g_timeout_add in main, but there I cannot use
dialog as my user data.
If I put this at the dialog, it does not like MessageDialog,
typecasting mismatch errors (Says cannot cast MessageDialog as void*).
I have also tried g_signal_emit_by_name + timer, but strangely it is
not doing the job at all. I still have to click the dialog.
Any hints as to where I call the g_timeout_add?
Thanks ever so much!
Regards,
B
2009/3/5 Tristan Van Berkom <tvb at gnome.org>:
When you launch the dialog initially then use g_timeout_add()
to register a timeout callback, give it the dialog as user data
(and hold on to the return value of g_timeout_add()...), then
quit the dialog/reset the source_id from the callback ... and/or
when gtk_dialog_run() returns:
if (source_id > 0) source_id = (g_source_remove (source_id), 0);
Cheers,
? ? ? ? ? ?-Tristan
On Thu, Mar 5, 2009 at 11:00 AM, His Majesty <balakkvj at gmail.com> wrote:
Hello people,
? ? ? ? ? ? ? ? ? ? For sometime now, I have been trying to timeout a
dialog. To illustrate,
imagine you have a button A and when it is clicked, it responds "A clicked".
Now, what I am trying to do is close the dialog window without any
further click after a pre-determined period, say 2 seconds.
Any ideas how to go about it?
PS: I am using debian-2.6.26-1 i686 with glade-3
Thanks in advance for any ideas.
B
_______________________________________________
Glade-users maillist ?- ?Glade-users at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/glade-users
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]