From: Axel S. <Axe...@en...> - 2009-03-17 20:30:19
|
On Mar 17, 2009, at 20:56, Maurí cio wrote: >>> I see that widget classes have a 'castTo' member, >>> like, say, castToPaned or castToWidget.(...) >> >> If the widget is a Paned then it's ok. If not, the resulting value is >> a call to error. >> >>> Is it possible to >>> check if such cast is possible before calling that >>> function? >> >> Yes, there is a function called 'isA' in System.Glib.GObject (...) > > Checking your sugestion, I also found the function below that > also uses GType. But, as in 'isA', I could not found (even > in Gtk+) how to get values of GType for a given class. The > code below mentions 'gTypeBox' as a GType for Box, but it has > no link and haddock index have nothing begging with 'gType'. > How can I get those? Uh, yes, these are not exported by default. They can be found in Graphics.UI.Gtk.Types Cheers, Axel. > widgetGetAncestor > :: WidgetClass self > => self > -> GType widgetType - ancestor type > -> IO (Maybe Widget) returns the ancestor widget, or Nothing > if not found > Gets the first ancestor of widget with type widgetType. For > example, widgetGetAncestor > widget gTypeBox gets the first Box that's an ancestor of widget. > See note about checking > for a toplevel Window in the docs for widgetGetToplevel. > > Thanks, > Maurício > > > ---------------------------------------------------------------------- > -------- > Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) > are > powering Web 2.0 with engaging, cross-platform capabilities. > Quickly and > easily build your RIAs with Flex Builder, the Eclipse(TM)based > development > software that enables intelligent coding and step-through debugging. > Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com > _______________________________________________ > Gtk2hs-users mailing list > Gtk...@li... > https://lists.sourceforge.net/lists/listinfo/gtk2hs-users |