1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | “focus-in-event” signal gboolean user_function (GtkWidget *widget, GdkEventFocus *event, gpointer user_data); widget : the object which received the signal. event : user_data : user data set when the signal handler was connected. Returns : TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further. “focus-out-event” signal gboolean user_function (GtkWidget *widget, GdkEventFocus *event, gpointer user_data); widget : the object which received the signal. event : user_data : user data set when the signal handler was connected. Returns : TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | static gboolean entry_focus_in_handler (GtkWidget *widget, GdkEventFocus *event, gpointer user_data) { //当该GtkEntry收到focus_in_event时,选中其所有内容 gtk_editable_select_region(GTK_EDITABLE(widget), 0, -1); return FALSE; } static void initEntry() { GtkWidget* entry = gtk_entry_new(); g_signal_connect(G_OBJECT(entry), “focus_in_event”, G_CALLBACK (entry_focus_in_handler), 0); ……… } |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |