|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Member
Iscritto dal: Oct 2009
Messaggi: 157
|
[C++] GTKmm e Glade3
Salve a tutti!
Qualcuno di voi è mai riuscito a creare un interfaccia grafica con Glade e caricarla in un programma con le GTKmm?? Come diavolo si fa?? Io ho trovato diversi tutorial, quasi tutti per GTK e non GTKmm, ma in compilazione ho errori.... Mi basta saperlo fare anche con le GTK e non perforza con le GTK per il c++, basta che riesco a creare delle interfacce grafiche in Linux... Grazie a chi mi risponderà!! |
|
|
|
|
|
#2 | |
|
Senior Member
Iscritto dal: Dec 2005
Città: Istanbul
Messaggi: 1817
|
Quote:
http://library.gnome.org/devel/gtkmm...uilder.html.en
__________________
One of the conclusions that we reached was that the "object" need not be a primitive notion in a programming language; one can build objects and their behaviour from little more than assignable value cells and good old lambda expressions. —Guy Steele |
|
|
|
|
|
|
#3 |
|
Member
Iscritto dal: Oct 2009
Messaggi: 157
|
Il problema è che quando compilo il programma d'esempio riportato nel tutorial mi restituisce errori... Sapete come configurare il Makefile??
|
|
|
|
|
|
#4 |
|
Senior Member
Iscritto dal: Jun 2002
Città: Dublin
Messaggi: 5989
|
Che errori?
__________________
C'ho certi cazzi Mafa' che manco tu che sei pratica li hai visti mai! |
|
|
|
|
|
#5 |
|
Senior Member
Iscritto dal: Dec 2005
Città: Istanbul
Messaggi: 1817
|
Se non riporti gli errori non possiamo aiutarti. Posso ipotizzare che non hai impostato correttamente gli include path e le librerie. Ci riporti anche il makefile che stai usando ?
__________________
One of the conclusions that we reached was that the "object" need not be a primitive notion in a programming language; one can build objects and their behaviour from little more than assignable value cells and good old lambda expressions. —Guy Steele |
|
|
|
|
|
#6 |
|
Member
Iscritto dal: Oct 2009
Messaggi: 157
|
Con le GTK sono riuscito a caricare il tutto senza errori compilando il seguente codice:
#include <gtk/gtk.h> int main(int argc, char **argv) { GtkBuilder *builder; GtkWidget *window; GError *error = NULL; gtk_init( &argc, &argv ); builder = gtk_builder_new(); if( ! gtk_builder_add_from_file( builder, "prova.glade", &error ) ) { g_warning( "%s", error->message ); g_free( error ); return( 1 ); } window = GTK_WIDGET( gtk_builder_get_object( builder, "window1" ) ); gtk_builder_connect_signals( builder, NULL ); g_object_unref( G_OBJECT( builder ) ); gtk_widget_show( window ); gtk_main(); return(0); } Compilando con: gcc -o app main.c `pkg-config --cflags --libs gtk+-2.0` L'unico problema è che nella finestra non ho la barra del titolo, quindi per chiudere la finestra devo andare sul Monitor di Sistema, perchè non mi si chiude nemmeno dal pannello di Gnome... Cosa strana, ma non è per ora un gran problema, magari non ho impostato qualcosa in Glade.. Quello che voglio chiedervi adesso più che altro è caricare il .glade con le GTKmm ... Nei tutorial presenti in gnome.org dice che i file .glade si caricano con: Glib::RefPtr<Gtk::Builder> builder = Gtk::Builder::create_from_file("basic.glade"); E' dopo cosa ci dico al compilatore?? Gli esempi presenti in gnome.org non caricano file .glade ma .ui, è non so cosa sono In poche parole, sono riuscito oggi a caricare il .glade con le GTK, ma non riesco con le GTKmm... |
|
|
|
|
|
#7 |
|
Member
Iscritto dal: Oct 2009
Messaggi: 157
|
Ce qualcuno che lo sa fare ???????
|
|
|
|
|
|
#8 | |
|
Senior Member
Iscritto dal: Dec 2005
Città: Istanbul
Messaggi: 1817
|
Quote:
con pkg-config --list-all vedi l'elenco di quelli disponibili e aggiusti di conseguenzqa
__________________
One of the conclusions that we reached was that the "object" need not be a primitive notion in a programming language; one can build objects and their behaviour from little more than assignable value cells and good old lambda expressions. —Guy Steele Ultima modifica di marco.r : 18-05-2010 alle 19:08. |
|
|
|
|
|
|
#9 |
|
Senior Member
Iscritto dal: Jun 2002
Città: Dublin
Messaggi: 5989
|
Ehm, intendevi CODE?
__________________
C'ho certi cazzi Mafa' che manco tu che sei pratica li hai visti mai! |
|
|
|
|
|
#10 |
|
Senior Member
Iscritto dal: Dec 2005
Città: Istanbul
Messaggi: 1817
|
ovviamente
__________________
One of the conclusions that we reached was that the "object" need not be a primitive notion in a programming language; one can build objects and their behaviour from little more than assignable value cells and good old lambda expressions. —Guy Steele |
|
|
|
|
|
#11 |
|
Member
Iscritto dal: Oct 2009
Messaggi: 157
|
Il codice che vi ho mostrato sono riuscito a farlo funzionare, ma è in GTK per il C...
A me serve saperlo fare in GTKmm con il C++... |
|
|
|
|
|
#12 |
|
Senior Member
Iscritto dal: Dec 2005
Città: Istanbul
Messaggi: 1817
|
Si ma se non riporti ne' il codice che stai usando ne' gli errori che ti torna come facciamo ad aiutarti ?
__________________
One of the conclusions that we reached was that the "object" need not be a primitive notion in a programming language; one can build objects and their behaviour from little more than assignable value cells and good old lambda expressions. —Guy Steele |
|
|
|
|
|
#13 |
|
Member
Iscritto dal: Oct 2009
Messaggi: 157
|
No il problema è che non ho alcun codice per le GTKmm.. Ho solo la seguente documentazione che non riesco a capire come possa aiutarmi:
http://library.gnome.org/devel/gtkmm...e-file.html.en |
|
|
|
|
|
#14 | |
|
Senior Member
Iscritto dal: Dec 2005
Città: Istanbul
Messaggi: 1817
|
Quote:
Comunque puoi provare con l'esempio riportato qui: http://library.gnome.org/devel/gtkmm...xample-loading e compilarlo con la riga Codice:
g++ ` pkg-config --libs --cflags gtkmm-2.4` test.cpp
__________________
One of the conclusions that we reached was that the "object" need not be a primitive notion in a programming language; one can build objects and their behaviour from little more than assignable value cells and good old lambda expressions. —Guy Steele |
|
|
|
|
|
|
#15 |
|
Member
Iscritto dal: Oct 2009
Messaggi: 157
|
Era quello l'esempio che avevo provato, ma li non carica il .glade, carica basic.ui che non so che sia, e dall'editor di Glade non fa esportare alcun .ui ...
Chiaramente se eseguo quel codice mi esce scritto basic.ui non trovato |
|
|
|
|
|
#16 |
|
Member
Iscritto dal: Oct 2009
Messaggi: 157
|
Ma nessuno conosce queste librerie???
|
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 18:32.




















