You are not logged in.
Pages: 1
I just did this:
Started Anjuta --> Created an GTKmm Project
and i got this main.cc:
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
* main.cc
* Copyright (C) test 2010 <vamp898@>
*
* test is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* test is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <gtkmm.h>
#include <iostream>
/* For testing propose use the local (not installed) ui file */
/* #define UI_FILE PACKAGE_DATA_DIR"/test/ui/test.ui" */
#define UI_FILE "src/test.ui"
int
main (int argc, char *argv[])
{
Gtk::Main kit(argc, argv);
//Load the Glade file and instiate its widgets:
Glib::RefPtr<Gtk::Builder> builder;
try
{
builder = Gtk::Builder::create_from_file(UI_FILE);
}
catch (const Glib::FileError & ex)
{
std::cerr << ex.what() << std::endl;
return 1;
}
Gtk::Window* main_win = 0;
builder->get_widget("main_window", main_win);
if (main_win)
{
kit.run(*main_win);
}
return 0;
}
Did i understand anything wrong or what? There is a main (no Class or something else, just a function) and in this the Window gets created. How should i interact with the Window? i cant acces the window outside the main() isnt it?
Offline
ok nevermind, i throw Anjuta away from my computer
Sometimes he translates C++ stuff like public on
class Window : public Gtk::Window
into the german word "öffentlich"
class Window : öffentlich Gtk::Window
-.-
Offline
you don't have to use that template file
anyway for GTK development I'd recommend vala over C++, since even though i think C++ is the better language, vala better integrates with GLib/GObject etc.
"You can watch for your administrator to install the latest kernel with watch uname -r" - From the watch man page
Offline
For Gtk development I'd recommend PyGtk, at least for most inexperienced users. It's a lot easier to see and understand the class hierarchy and relationships between objects in Python.
Offline
im using Eclipse for C++ from now on and it just works fine. It works awesome^^
i had to set up some include paths but then it works awesome
But now i have a problem
I have a file called UI.glade and in this File i have an window1 (created with Glade for sure).
When im doing this
Window *w;
Builder b;
b.create_from_file( "UI.glade" );
b.get_widget( "window1", w );
im getting this error
(Main:24635): gtkmm-CRITICAL **: gtkmm: object `window1' not found in GtkBuilder file.
(Main:24635): gtkmm-CRITICAL **: gtkmm: Gtk::Buidler: widget `window1' was not found in the GtkBuilder file, or the specified part of it.
that gives no sense
Offline
Ah ok i got it xD it was an typing error -.-
Offline
Pages: 1