GTK+ zeigt nichts an
-
Hallo!
Ich habe folgendes (Grundgerüst) Programme geschrieben:#include <stdlib.h> #include <gtk/gtk.h> //#include <hashlibpp.h> static void OkOkButtonClick(GtkWidget *button, gpointer data) { } int main (int argc, char *argv[]) { ///Init Application gtk_init(&argc, &argv); ///Seed rand srand(time(0)); ///Predeclare widget variables //Windows, Sizers GtkWidget *window; GtkWidget *fixed; //Labels GtkWidget *algorithmLabel; GtkWidget *inputLabel; //Entrys GtkWidget *inputEntry; //Toggle Buttons GtkWidget *stringToggleButton; //Buttons GtkWidget *okButton; /* Initialize GTK+ */ ///Init Widgets //Windows, sizers window = gtk_window_new(GTK_WINDOW_TOPLEVEL); fixed = gtk_fixed_new (); //Buttons okButton = gtk_button_new_with_label("OK"); stringToggleButton = gtk_toggle_button_new_with_label("String input"); //Labels algorithmLabel = gtk_label_new("Algorithm:"); inputLabel = gtk_label_new("Input:"); //Entrys inputEntry = gtk_entry_new(); ///Set widget parameters gtk_entry_set_text(GTK_ENTRY(inputEntry), "abcdefc"); //Set inputEntry text to abcdefg gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(stringToggleButton), TRUE); //Set string toggle button active ///Put widgets on sizer and show gtk_fixed_put(GTK_FIXED(fixed), inputLabel, 5, 5); gtk_fixed_put(GTK_FIXED(fixed), inputEntry, 35, 5); //gtk_fixed_put(GTK_FIXED(fixed), inputLabel, 5, 5); //gtk_fixed_put(GTK_FIXED(fixed), inputLabel, 5, 5); gtk_widget_show(inputLabel); gtk_widget_show(inputEntry); ///Connect close function to application close g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL); ///Show sizer on window gtk_widget_show_all(fixed); gtk_container_add (GTK_CONTAINER(window), fixed); gtk_widget_show(fixed); gtk_window_set_default_size(GTK_WINDOW(window), 210, 200); gtk_widget_show(window); gtk_main(); return 0; }
Wenn ich es compiliere, zeigt GTK+ mir im Fenster nichts an. Was mache ich falsch?
Danke, Golem
-
Hi,
ich weiß nicht, bei mir (Debian, gtk-version: 2.12.5-2) funktioniert es. Ein Fenster mit 'nem Label und einem Textfeld halt.
Wie und wo kompilierst du? Welche GTK+-Versionen hast du installiert?
Cheers
GPC
-
Hi,
für diese Entwicklung benutze ich Code::Blocks (den aktuellen Nightly build vom 18. Februar), MinGW und eine relativ aktuelle Version von GTK+/GLib usw. Mit dem Testcode von CodeBlocks hat noch alles funktioniert. Ich werde jetzt mal meine Bibliotheken auf den neuesten Stand bringen, vielleicht liegts ja daran!mfg, Hans
-
Hi nochmal,
es lag anscheinend doch an der Version (vielleicht an den DLLs). Jetzt funktioniert es wieder!Danke, Golem