Re: typecast from Gtk::Widget to Gtk::Toolbar?



There's probably not much difference here practically speaking. 
Theoretically dynamic_cast might be safer since it does some run-time
type-checking to make sure that the cast is legal.  dynamic_cast is
"the C++ way", but the other way is still valid.

Jonner

On 1/10/06, ZeeGeek <zeegeek gmail com> wrote:
> On 1/11/06, Bob Caryl <bob fis-cal com> wrote:
> > You should be able to write something like:
> >
> > Gtk::UIManager ui;
> > // ui has been initialized somewhere in between
> > Gtk::Toolbar *mytoolbar =  (Gtk::Toolbar *)ui.get_widget("/Toolbar");
> >
> > since Gtk::Toolbar is descended from Gtk::Widget, but be sure to check
> > that the returned pointer is not NULL before using it.
> >
>
> B.Hakvoort <bart hakvoort be> wrote:
> > maybe with a Gtk::Toolbar * p_toolbar =
> > dynamic_cast<Gtk::Toolbar
> > *>( Gtk::UIManager::get_widget("/Toolbar") ) ; ?
>
> Both method work, thank you all!
> Is there any differences between these two methods?
>
> --
> My blog: http://ihome.ust.hk/~cs_snx/blog/
>
> Dell Inspiron 600m
> Pentium-M 1.6G
> 512MB, 60G
> ATI 9000 Mobility
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>



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