![]() G_signal_connect(button, "clicked", G_CALLBACK(printFunc), "2") Gtk_grid_attach(GTK_GRID(grid), button, 0, 0, 2, 1) īutton = gtk_button_new_with_label("Test 2") * Place the first button in the grid cell (0, 0), and make it fill Span 2 columns */ G_signal_connect_swapped(grid, "clicked", G_CALLBACK(gtk_widget_destroy), button) G_signal_connect(button, "clicked", G_CALLBACK(printFunc), "1") Gtk_container_add(GTK_CONTAINER(window), grid) īutton = gtk_button_new_with_label("Test 1") * Here we construct the container that is going pack our buttons */ Gtk_container_set_border_width(GTK_CONTAINER(window), 100) Gtk_window_set_title(GTK_WINDOW(window), "Test Program") Window = gtk_application_window_new(app) ![]() * create a new window, and set its title */ Static void activate(GtkApplication *app, gpointer user_data) Gtk_window_set_title(GTK_WINDOW(window), "NewWindow") Static void NewCallback(GtkWidget *grid, gpointer user_data) G_signal_connect_swapped(button, "clicked", G_CALLBACK(NewCallback), grid)Īnd trying to create a new grid using my self defined function NewCallback() to no avail.įrom what I understand from the documentation, the order is roughly 1 Container > 1 Window > 1 Grid > Multiple Widgets. G_signal_connect(button, "clicked", G_CALLBACK(gtk_widget_destroy), grid) I have also tried deleting the grid itself using: G_signal_connect(button, "clicked", G_CALLBACK(gtk_widget_destroy), button) ![]() I currently am only able to delete the button that was clicked on, but not all the buttons with the code: ![]() I wanted to know if there was a way for me to remove all children on existing grid, and subsequently repopulate by creating new buttons to the same grid. I just learned GTK3 yesterday because of a project I'm currently doing for school, I have a bit of knowledge in C but none in GTK. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |