tags:

views:

30

answers:

1

How can I connect a signal callback for any kind of change in a GtkEntry's buffer, including character added, deleted, text pasted or cut? I've looked in the docs for GtkWidget, GtkEntry and GtkEntryBuffer without finding this.

Note: if my question was badly worded, think of the HTML DOM's change event, except that it's fired greedily after every single keypress or event that causes a change, and not only checked on unfocus.

+1  A: 

There is the changed signal (of the GtkEditable interface):

The ::changed signal is emitted at the end of a single user-visible operation on the contents of the GtkEditable.

E.g., a paste operation that replaces the contents of the selection will cause only one signal emission (even though it is implemented by first deleting the selection, then inserting the new content, and may cause multiple ::notify::text signals to be emitted).

(I found that by checking the implemented interfaces section.)

This indicates that you can also connect to the notify signal of the text property (specifically, notify::text).

There is also the preedit-changed signal:

If an input method is used, the typed text will not immediately be committed to the buffer. So if you are interested in the text, connect to this signal.

detly
Aaah, so it's from `GtkEditable`. Thanks!
Delan Azabani
@Delan Azabani - no worries... I added a note about the `notify::text` signal too.
detly