Name: Anonymous 2006-12-18 12:18
Ok... I've taken two semesters of Java courses at Uni, and was thinking for marketability purposes, I better learn another, probably better, language. So I decided to try learning C++ since I heard they are pretty closely related, and I decided to use gtkmm for my GUI needs. However, I am running into difficulties, and I do not know if it is because I am a gigantic faggot, or what, I can't get this to work.
My idea was to try to write a very simple program that would basically allow me to add two numbers typed into two different text boxes, and output the answer. In my naiveté, I believe that once I overcome programming something that basic, that programming something more sophisticated should only then require that I can imagine it.
The problem is, the button that I try to add to the window does not appear to show up. I am wondering if I need to instantiate a container first, or what...
Below is a copy of my super simple source. Please ignore the inefficacy of including a whole one megabyte library for now, and help explain what I am doing wrong if you are able.
Thank you.
...
#include <gtkmm.h>
int main(int argc, char *argv[])
{
Gtk::Main kit(argc, argv); //This creates the GTK main.
Gtk::Window window; //This creates a window.
Gtk::Button mButton;
mButton.set_label("_Add"); //This creates a Button and labels it "Add" with an underline for A.
window.add(mButton); //puts m_button into window.
Gtk::Main::run(window); //This runs the window in the GTK main.
return 0;
}
...
A picture of the resultant window:
http://img508.imageshack.us/img508/175/screenshotaddinged6.png
My idea was to try to write a very simple program that would basically allow me to add two numbers typed into two different text boxes, and output the answer. In my naiveté, I believe that once I overcome programming something that basic, that programming something more sophisticated should only then require that I can imagine it.
The problem is, the button that I try to add to the window does not appear to show up. I am wondering if I need to instantiate a container first, or what...
Below is a copy of my super simple source. Please ignore the inefficacy of including a whole one megabyte library for now, and help explain what I am doing wrong if you are able.
Thank you.
...
#include <gtkmm.h>
int main(int argc, char *argv[])
{
Gtk::Main kit(argc, argv); //This creates the GTK main.
Gtk::Window window; //This creates a window.
Gtk::Button mButton;
mButton.set_label("_Add"); //This creates a Button and labels it "Add" with an underline for A.
window.add(mButton); //puts m_button into window.
Gtk::Main::run(window); //This runs the window in the GTK main.
return 0;
}
...
A picture of the resultant window:
http://img508.imageshack.us/img508/175/screenshotaddinged6.png