开发者

Gtk_entry mouse click signal

开发者 https://www.devze.com 2022-12-17 10:34 出处:网络
I want to do a g_signal_connect to capture a mouse click in a gtk_entry widget. Something like this: entry = gtk_entry_new ( );

I want to do a g_signal_connect to capture a mouse click in a gtk_entry widget.

Something like this:

entry = gtk_entry_new ( );
gtk_box_pack_end ( GTK_BOX ( hBox ), entry, TRUE, TRUE, 1 );
gtk_widget_show ( entry );

// This is the one I'm not sure about
g_signal_connect (开发者_JAVA百科 GTK_OBJECT ( entry ), "????????????", 
GTK_SIGNAL_FUNC ( EntryClicked ), entry );

I just can't seem to find it in the gtk documentation.

I've tried using the "focus-in-event", but it is not working as I spect.

Thanks for the assistance.


Mouse clicks are reported using the button-press-event signal, that's what you should connect:

g_signal_connect(G_OBJECT(entry), "button-press-event", G_CALLBACK(evt_entry_button_press), NULL);

This of course assumes you've defined a compatible function to handle the function. The "evt_" prefix on the handler's name is a simple convention I use personally.

This event is defined by the base GtkWidget class, which might be why you had problems finding it in the documentation for the GtkEntry widget.

0

精彩评论

暂无评论...
验证码 换一张
取 消