Re: how do I find out if the focused object is an Gtk::Entry?
- From: Guillaume Brocker <guillaume brocker digital-trainers com>
- To: gtkmm-list gnome org
- Subject: Re: how do I find out if the focused object is an Gtk::Entry?
- Date: Tue, 03 May 2011 10:52:53 +0200
Le 03/05/2011 09:58, Ming-ching Chiu a écrit :
> 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!
I would have used a C++ dynamic cast like in the example below :
Gtk::Entry * entry;
entry = dynamic_cast< Gtk::Entry * >( myWindow->get_focus() );
if( entry )
{
// set the text
}
> Best, Ming-ching
Best regards.
Guillaume
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]