Re: Realizing windows.




"Curtiss Howard" <po_boxx_823@hotmail.com> writes:

>~ You're basically right.  From what I gather, realizing a widget will
> basically allow GTK+ to gather information about a widget without
> having to show it.  This is actually useful.  Whenever I write an app
> that uses pixmaps (ie in toolbar buttons), naturally I want to be able
> to "show" the buttons before showing the window.  However, if I don't
> realize the window first, there's no associated colormap for it, and
> thus I get a slew of warnings about a NULL colormap.  Realizing the
> window and THEN making the toolbar with pixmap buttons gets rid of
> this problem.
 
Actually, the nicer way (in terms of efficiency) of doing
this is:

 gdk_pixmap_colormap_create_from_xpm (NULL, 
                                      gtk_widget_get_colormap (widget),
                                      &mask, NULL, my_file);

By using the _colormap version you can avoid realizing widget
ahead of time, since gtk_widget_get_colormap() always works.

It's good to avoid force-realizing whenever possible -
if you make GTK+ realize a widget before it is ready, then
GTK+ will need to do some work related to size allocation
twice, once when you force-realize, and then later when it would
have realized normally. Plus there is some danger of
triggering obscure GTK+ bugs if it first realizes at a
bogus size then corrects.

Regards,
                                        Owen







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