Re: Why does this MessageDialog not work?



Hi,

this is just a shot in the dark as it's been ages since I've done any
gtkmm work but I think you're testing for the wrong response ID. Since
you have a yes-no dialog you should test for the yes/no response IDs.

enum  	ResponseType {
  RESPONSE_NONE = -1,
  RESPONSE_REJECT = -2,
  RESPONSE_ACCEPT = -3,
  RESPONSE_DELETE_EVENT = -4,
  RESPONSE_OK = -5,
  RESPONSE_CANCEL = -6,
  RESPONSE_CLOSE = -7,
  RESPONSE_YES = -8,
  RESPONSE_NO = -9,
  RESPONSE_APPLY = -10,
  RESPONSE_HELP = -11
}

-Bartek


> Hi, i thought about creating a simple Question function, wich gets a
> question and a explanation passed and returns a bool
> However the function seems to return true always and only the first cout
> << appears in the console, so I gues the whole switch is not executed
> and maybee the run() not as well.
> 
> However this compiles fine without errors (Visual Studio 2008 Express
> Edition)
> 
> 
> bool Updater::AreyouSure(string question,string explanation){
> cout << "Question " << question << " " << explanation << " \n";
> Gtk::MessageDialog
> questiondialog(question,false,MESSAGE_ERROR,BUTTONS_YES_NO,true);
> questiondialog.set_secondary_text(explanation);
> int result = questiondialog.run();
> //Handle the response:
> switch(result){
> case(Gtk::RESPONSE_OK):{
> cout << red << "RESPONSE_OK" << "\n";
> return true;
> break;
> }
> case(Gtk::RESPONSE_CANCEL):{
> cout << red << "RESPONSE_CANCEL" << "\n";
> return false;
> break;
> }
> default:{
> cout << red << "default" << "\n";
> return false;
> break;
> }
> }
> cout << red << "end" << "\n";
> }
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]