Announcement

Collapse
No announcement yet.

Another GTK+ 3.0 Pre-Release Arrives

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #31
    Originally posted by srg_13 View Post
    Ummm... I think you're wrong about Windows... Have you seen Hello World in Win32? It's not easy!

    And then there's MFC - http://pastebin.com/xmUgiKvr - 94 lines.

    It's a little easier in the crippled .Net languages, but only because the visual designer creates all of the UI code for you...

    In Gtkmm (the C++ port - I'm not familiar with the C API), on the other hand;
    Code:
    #include <gtkmm.h>
    
    int main(int argc, char * argv[])
    {
        Gtk::Main kit(argc, argv);
    
        Gtk::Window win;
        Gtk::Label hello("Hello World!");
    
        win.add(hello);
    
        win.show_all();
    
        Gtk::Main::Run(win);
    
        return 0;
    }
    Not hard... In my opinion it's actually better to develop for Windows with Gtkmm than the Windows APIs themselves...
    You'll probably want to use Builder, that's even easier (in Vala for bonus points):
    Code:
    using Gtk;
    
    int main(string[] args) {     
        Gtk.init(ref args);
    
        try {
            var builder = new Builder();
            builder.add_from_file("hello.ui");
            builder.connect_signals(null);
            Gtk.main();
        } catch(Error e) { return 1; } 
    
        return 0;
    }

    Compile with: valac --pkg gtk+-2.0 hello.vala

    Now you can design your GUI in the Glade editor.

    Comment

    Working...
    X