Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GTK+ (2.0) - signal "clicked" on GtkEntry?

I'm testing some signals with GTK+ 2.0. I'm looking for a way to get a signal emitted when I click on a GtkEntry.

if (widgets_info[i].action & IG_INPUT)
    {
      widget->frame[i] = gtk_entry_new_with_max_length(MAX_INPUT_LENGTH);
      gtk_entry_set_text(widget->frame[i], widgets_info[i].text);
      catch_signal(widget->frame[i], MY_SIGNAL, &change_entry, widget);
    }

I have a pre-selected text in my entry (widgets_info[i].text) and i want this text to disappear if the user click on my GtkEntry.

Does someone know what is this signal?

(Sorry for my English)

like image 450
GeoffreyB Avatar asked Apr 16 '12 11:04

GeoffreyB


2 Answers

Try focus-in-event, note that you must enable focus-tracking as described in the documentation.

like image 66
unwind Avatar answered Sep 22 '22 04:09

unwind


The button-press-event signal should do what you need: http://developer.gnome.org/gtk3/stable/GtkWidget.html#GtkWidget-button-press-event

However, in GTK+ 3, GtkEntry now supports this idea of placeholder text, so you don't need to implement it yourself: http://developer.gnome.org/gtk3/stable/GtkEntry.html#gtk-entry-set-placeholder-text

like image 38
murrayc Avatar answered Sep 18 '22 04:09

murrayc



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!