文字GtkEntry中变化信号 [英] GtkEntry text change signal

查看:273
本文介绍了文字GtkEntry中变化信号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何连接的信号回调在GtkEntry中的缓冲区任何改变,包括字符添加,删除文字粘贴或削减?我看过的文档为GtkWidget的,并G​​tkEntry中没有GtkEntryBuffer找到这个。

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.

请注意:如果我的问题是严重的措辞,认为HTML DOM的变更事件的除了的,它的每一个键$后,贪婪地解雇p $ PSS或事件引起的改变,而不是只在检查无焦点。

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.

推荐答案

有是<一个href=\"http://library.gnome.org/devel/gtk/unstable/GtkEditable.html#GtkEditable-changed\"><$c$c>changed信号( GtkEditable 接口)

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

的::改变信号被发射时在GtkEditable的内容的单个用户可见的操作结束。

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).

(我发现通过检查<一个href=\"http://library.gnome.org/devel/gtk/unstable/GtkEntry.html#GtkEntry.implemented-interfaces\">implemented接口部分。)

(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).

也有<一个href=\"http://library.gnome.org/devel/gtk/unstable/GtkEntry.html#GtkEntry-$p$pedit-changed\"><$c$c>$p$pedit-changed信号:

如果被使用的输入方法,该键入的文本将不会立即被提交到缓冲器。所以,如果你有兴趣的文字,连接到该信号。

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.

这篇关于文字GtkEntry中变化信号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆