Hiding the Message Dialog
- From: mike lear <mikeofthenight2003 yahoo com>
- To: "gtkmm-list gnome org" <gtkmm-list gnome org>
- Subject: Hiding the Message Dialog
- Date: Tue, 15 Apr 2014 00:20:06 -0700 (PDT)
Hello All,
I am using gtkmm messagedialog windows in a project that I
am writing. My problem relates to using a timeout function
with the dialogs. I am using a signal handler to provide a
visual 10 second countdown of the message window. The timer
works fine and displays the countdown in the dialog message
window. But when it reaches it's timeout of 0 seconds. I am
unable to get the dialog window to hide. The only way I can
hide the window is by using the exit(0); command in place of
the return false; command. Below is the section of code in
question. I am using the boost library to provide shared
pointers and lexical casts in this function.
bool funkeys::on_timeout(int seconds) { // seconds = 10
shared_ptr<string> timer(new string);
shared_ptr<string> timestr(new string("#~#")); // position to insert seconds
static int i = seconds;
Format fmt; // A class that format strings to contain markup
// Markup & insrepAt part of the Format class
try {
if (i == 0) {
on_button_quit(); // does not work it calls hide()
hide(); // does not hide the dialog window
// return false; // this just disconnect's the
timer
exit(0); // this works but its not nice
}
*timer = boost::lexical_cast<string>(i--); // convert int to string
Markup tis(*timer); // tis time in seconds
*timer = Bold(Italic(tis))->dataStr(); // add markup to string
fmt->insrepAt("blue",10.5,*timer,*timestr); // add text colour and size
Timer.set_text(*timestr); // Timer is the gtk label
Timer.set_markup(*timestr); // timestr is the markup string
Timer.set_use_markup(true); // containing the timer seconds
Timer.get_use_markup();
} catch(boost::bad_lexical_cast& e) {
cerr << e.what() << "\nlexical_cast error in function on_timeout\n";
exit(1);
}
return true;
}
Any help or ideas will be most appreciated.
Thanks Mike Lear
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]