Results 1 to 5 of 5
Hmm, the button btnQuit;Is not showing up on the main window.. Can somebody explain why?? Code below.. I don't want no functionality yet, just displaying it on the form..
Code:
...
- 02-22-2011 #1Just Joined!
- Join Date
- May 2008
- Posts
- 34
GTK+ Button not showing.
Hmm, the button btnQuit;Is not showing up on the main window.. Can somebody explain why?? Code below.. I don't want no functionality yet, just displaying it on the form..
Code:#include <stdio.h> #include <gtk/gtk.h> static gboolean kill_window(GtkWidget *widget, GdkEvent *event, gpointer data) { gtk_main_quit(); return FALSE; } int main(int argc, char * argv[]) { gtk_init(&argc, &argv); GtkWidget *window; GtkWidget *quitBtn; window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window), "App 1"); gtk_window_set_default_size(GTK_WINDOW(window), 800, 700); gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); quitBtn = gtk_button_new_with_label("Quit"); gtk_widget_set_size_request(GTK_WIDGET(quitBtn), 125, 25); gtk_widget_show_all(window); g_signal_connect(window, "delete_event", G_CALLBACK(kill_window), NULL); gtk_main(); return 0; }
- 02-23-2011 #2
I think you forgot to put the button in the window. At some point you need to call gtk_container_add().
"I'm just a little old lady; don't try to dazzle me with jargon!"
- 02-23-2011 #3Just Joined!
- Join Date
- May 2008
- Posts
- 34
- 02-23-2011 #4
Maybe this will refresh your memory.
"I'm just a little old lady; don't try to dazzle me with jargon!"
- 02-23-2011 #5Just Joined!
- Join Date
- May 2008
- Posts
- 34
Actually, I got it showing, but it appears to be taking up the entire window, I don't want that to happen.. I even tried to put it in a Layout, it fills up the entire Y Axis, but only a little bit of the X Axis.. Hmm, not sure what to do about this now.. I even went to gtk.org -> Documentation, went by that, still same thing.. I even tried the gtk_fixed_put and I was getting errors, and it still filled up the entire window.. Hmm.. What to do, what to do, LOL..


Reply With Quote
