Re: Widget type name



On Wed, 2005-03-30 at 00:16 +0200, Bo Lorentsen wrote:
> Hi ...
> 
> I have been playing a little with the "glademm", and I ended up looking 
> all over th doc. for at widget type string, to identify a widget found 
> in a glade file.
> 
> I hoped for something like :
> 
> Gtk::Widget *pWidget;
> m_refGlade->get_widget( "test_widget", pWidget );
> if( pWidget->get_typename() == "GtkEntry" ) {
>     // Attach relevant code
> }
> 
> Is this somehow possible, or is dynamic casting the only possible solution ?

Normal C++ RTTI can give you a string, but dynamic_cast<> is the only
sensible way to do this.

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]