RE: Cleaning up text from a GtkEntry
- From: <martyn 2 russell bt com>
- To: <znnalx yahoo it>, <gtk-app-devel-list gnome org>
- Subject: RE: Cleaning up text from a GtkEntry
- Date: Thu, 16 Oct 2003 12:28:48 +0100
I've got a GtkEntry showing some text after a button
being pressed. How can I remove that text from
GtkEntry after x (configurable) seconds?
Set up a timeout:
static gboolean timeout_cb(gpointer user_data);
static void entry_delete_text();
static entry_delete_text()
{
gint timeout_id = 0;
/* 5000 ms, NULL is the user data */
timeout_id = g_timeout_add(5000, timeout_cb, NULL);
/* can use the timeout id to remove it later if you want */
}
static gboolean timeout_cb(gpointer user_data)
{
gtk_entry_set_text(GTK_ENTRY(myentry), "");
/* return TRUE to continue timeout repeatedly */
return FALSE;
}
Either use:
gtk_entry_set_text(GTK_ENTRY(myentry), "");
or
gtk_editable_delete_chars(GTK_EDITABLE(myentry), 0, -1);
Regards,
Martyn
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]