PDA

View Full Version : [SOLVED] GTK popup



dargaud
November 22nd, 2011, 02:14 PM
Hello all,
a very basic question. I have to do some support on an oldish C++ program that uses GTK (which I've never used before). In particular I need to add some modal popup windows. On my usual environment I simply do MessagePopup("Title", "Message") and it appears until the user clicks the only button available ("OK").

How do I do that in GTK ? I found this page (http://developer.gnome.org/gtk3/stable/GtkDialog.html) which seems overly complicated... Do I really need external XML resources for such a simple task ?!?
Thanks.

PaulM1985
November 22nd, 2011, 02:30 PM
Is this what you are after?

http://www.gtk.org/api/2.6/gtk/GtkMessageDialog.html

Paul

dargaud
November 22nd, 2011, 02:57 PM
Yes, thank you. Just what is this "main_application_window" parameter ? Can it default safely to NULL ?

Liiiim
November 22nd, 2011, 05:49 PM
It would be the main window of your program. You can call it with NULL with no problems though.

crdlb
November 22nd, 2011, 09:50 PM
That link is pretty old; the current reference for gtk2 is: http://developer.gnome.org/gtk/stable/GtkMessageDialog.html

nvteighen
November 23rd, 2011, 03:19 PM
Hello all,
a very basic question. I have to do some support on an oldish C++ program that uses GTK (which I've never used before). In particular I need to add some modal popup windows. On my usual environment I simply do MessagePopup("Title", "Message") and it appears until the user clicks the only button available ("OK").

How do I do that in GTK ? I found this page (http://developer.gnome.org/gtk3/stable/GtkDialog.html) which seems overly complicated... Do I really need external XML resources for such a simple task ?!?
Thanks.

Read the page more carefully... (example 44, e.g.). There you'll see that you don't need an XML GtkBuilder definition.

However, in time you'll see that using GtkBuilder is way more practical than doing these things by hand.