Search code examples
c++user-interfacegtkmm

How to check whether a widget is currently clicked with the mouse?


I am looking for a way to check whether a Gtkmm entry is currently clicked with the mouse and if it is it should return true and otherwise false.

For example in the following image the widget in the middle should return true.

Middle entry should return true and others should return false


Solution

  • I would use the property has_focus. I cannot think of a situation in which the Gtk::Entry is being edited and it does not have focus. This property is not specific to Gtk::Entry, it is already present in Gtk::Widget.