Gtk Perl:在不使用占位符的情况下删除文本输入中的默认文本
Gtk Perl : remove default text in Text Entry without using a placeholder
虽然我知道 set_placeholder_text("I am the placeholder")
可以解决我的问题,但此功能仅适用于 Gtk+ 3.2 及更高版本。
我想知道在用户单击文本输入框中删除默认文本的最简单方法。
这里使用'focus-in-event'
信号是一个令人满意的解决方案。
在回调中,将 Text Entry 框中的文本设置为 ""
,以便在单击时清除它(即,当 Text Entry 框获得 focus 时)。
https://developer.gnome.org/gtk3/stable/GtkWidget.html#GtkWidget-focus
虽然我知道 set_placeholder_text("I am the placeholder")
可以解决我的问题,但此功能仅适用于 Gtk+ 3.2 及更高版本。
我想知道在用户单击文本输入框中删除默认文本的最简单方法。
这里使用'focus-in-event'
信号是一个令人满意的解决方案。
在回调中,将 Text Entry 框中的文本设置为 ""
,以便在单击时清除它(即,当 Text Entry 框获得 focus 时)。
https://developer.gnome.org/gtk3/stable/GtkWidget.html#GtkWidget-focus