1/10/2009

Message Box With Gtk

I want a simple function showing Message box in gtk like Windows'API.
Therefore I make next code.





/**
* This method's work is like Windows' MessageBox
* @date 2009-1-10
* @version 1.0
*/
bool ShowMessageBox(std::string title, std::string message)
{
GlobalParameter* gp = GlobalParameter::getInstance();
GtkDialogFlags flag=(GtkDialogFlags(GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT);
GtkWidget* dialog = gtk_dialog_new_with_buttons(title.c_str(),GTK_WINDOW(gp->getM_main_window()),flag,NULL);
GtkWidget* label = gtk_label_new(message.c_str());
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox),label);
gtk_widget_show_all(dialog);
gint response = gtk_dialog_run(GTK_DIALOG(dialog));
return true;
}



3 comments:

Anonymous said...

Could not find a suitable section so I written here, how to become a moderator for your forum, that need for this?

Anonymous said...

Sorry for my post .Where i can watch more info about?

Anonymous said...

Nice dispatch and this mail helped me alot in my college assignement. Say thank you you for your information.