Re: does being inside a grid make an entry more editable?



Hello Dan,

I don't think this issue is related to entries being placed inside a
grid. I created this minimal example and it's working fine for me:

    #include <gtk/gtk.h>
    
    static void activate(GApplication* app, gpointer user_data)
    {
        GtkWidget* window = gtk_application_window_new(
            GTK_APPLICATION(app));
        gtk_window_set_title(GTK_WINDOW(window), "GridTest");
        gtk_container_set_border_width(GTK_CONTAINER(window), 10);
    
        GtkWidget* entry1 = gtk_entry_new();
        GtkWidget* entry2 = gtk_entry_new();
        GtkWidget* entry3 = gtk_entry_new();
        GtkWidget* entry4 = gtk_entry_new();
    
        gtk_editable_set_editable(GTK_EDITABLE(entry1), FALSE);
        gtk_editable_set_editable(GTK_EDITABLE(entry3), FALSE);
    
        GtkWidget* grid = gtk_grid_new();
        gtk_grid_set_row_spacing(GTK_GRID(grid), 10);
        gtk_grid_set_column_spacing(GTK_GRID(grid), 10);
        gtk_grid_attach(GTK_GRID(grid), entry1, 0, 0, 1, 1);
        gtk_grid_attach(GTK_GRID(grid), entry2, 0, 1, 1, 1);
        gtk_grid_attach(GTK_GRID(grid), entry3, 1, 0, 1, 1);
        gtk_grid_attach(GTK_GRID(grid), entry4, 1, 1, 1, 1);
    
        gtk_container_add(GTK_CONTAINER(window), grid);
        gtk_widget_show_all(window);
    }
    
    int main(int argc, char** argv)
    {
        GtkApplication* app = gtk_application_new(
            "de.codemusings.GridTest", G_APPLICATION_FLAGS_NONE);
        g_signal_connect(app, "activate", G_CALLBACK(activate), NULL);
        int retval = g_application_run(G_APPLICATION(app), argc, argv);
        g_object_unref(app);
    
        return retval;
    }

Compiled with:

    gcc -Wall -Werror -pedantic -std=c99 \
        `pkg-config --cflags --libs gtk+-3.0` grid-test.c -o grid-test

The entries in the first row are not editable this way. What GTK
version are you using?

--Tilo

Am Donnerstag, den 09.03.2017, 19:43 -0800 schrieb Dan Hitt:
I have some entries that are inside a grid (all gtk3 stuff).

I cannot seem to make them uneditable with a call to
gtk_editable_set_editable().

I also have an entry outside the grid, which
gtk_editable_set_editable() certainly can make uneditable.

So i think the difference between the two cases is the grid, and i'm
wondering if putting an entry inside a grid somehow makes it more
editable.  (Maybe this is obvious from some piece of documentation,
and i'm just being really opaque.)

Anyhow, thanks in advance for any info, one way or another, on how
being inside a grid would affect the editability of an entry!

dan
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]