Re: key press events and gtk_dialog_new_with_buttons()



On Wed, Jan 11, 2006 at 06:54:46PM +1100, Richard Gipps wrote:
I applied this function to the three entries but it only works on one of 
them (the first entry I apply it to).  Note that I have tried them all on 
their own (by commenting out the other two) and they work fine.  Any ideas?

#include <gtk/gtk.h>

int
main(int argc, char *argv[])
{
    GtkWidget *dialog, *entry;
    gint response;

    gtk_init(&argc, &argv);
    dialog = gtk_dialog_new_with_buttons("Entry Activate", NULL, 0,
                                         GTK_STOCK_CANCEL,
                                         GTK_RESPONSE_CANCEL,
                                         GTK_STOCK_OK,
                                         GTK_RESPONSE_OK,
                                         NULL);
    gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);
    gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK);

    entry = gtk_entry_new();
    gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
    gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), entry);

    entry = gtk_entry_new();
    gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
    gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), entry);

    entry = gtk_entry_new();
    gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
    gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), entry);

    gtk_widget_show_all(dialog);
    response = gtk_dialog_run(GTK_DIALOG(dialog));
    g_print("Response: %d\n", response);
    gtk_widget_destroy(dialog);

    return 0;
}

This works.

Yeti


--
That's enough.



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