GtkEntry focus out

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

 



Hi,

I have a simple GTK (2.2.4) app with a GtkEntry and GtkWidget, the entry
field has a focus out event handler:

gboolean
on_entry1_focus_out_event              (GtkWidget       *widget,
                                        GdkEventFocus   *event,
                                        gpointer         user_data)
{
GtkWidget *dialog = gtk_message_dialog_new
(GTK_WINDOW(lookup_widget(widget,"window1")),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE, "hello");

gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
return FALSE;
}

When the message dialog starts, the app abort with an error from the
"blink_cb" function in gtkentry.c.

I can stop the error by adding the following code in the focus out
callback:

    GtkEntry *entry = GTK_ENTRY(widget);
    if (entry->blink_timeout) {
        gtk_timeout_remove (entry->blink_timeout);
        entry->blink_timeout = 0;
    }
                      
    entry->cursor_visible = TRUE;

Interestingly, it works fine if you call a message dialog from either
the focus in or key press events.

Can anyone tell me if this is a bug, or should I not call a dialog from
the focus out event. (The reason I want to call a dialog is, for
example, if only certain stuff can be entered in the GtkEntry, I want to
alert the user).

Thanks,

Bryan

_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux