You can use a dynamic_cast.
Pointer style:
Gtk::Entry *ent(dynamic_cast<Gtk::Entry*>(widget_ptr));
if (ent)
{
…
}
Reference style (I'm not 100% sure):
try
{
Gtk::Entry &ent(dynamic_cast<Gtk::Entry&>(widget_ref));
…
}
catch (std::bad_cast &)
{ }
Another way could be to user Gtk's functions to retrieve the inner GType…
yann
On 05/03/11 09:58, Ming-ching Chiu wrote:
Hi,
In my program I need to determine if the focused widget is an entry so that I
can set its text.
I use get_focus() to get the focused object, but I don't know how to determine
if it is an entry. Is there any way to tell if the returned widget is an entry?
thanks!
Best,
Ming-ching
_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list
_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list