Re: [gtk-list] Re: Center a window



> 
> csmall@scooter.o.i.net writes:
> 
> > > 
> > > > BTW: What exactly do gtk_widget_map and gtk_widget_realize do ?
> > > >     In which situations do I absolutely need them ?
> > > 
> > >   It's explained in the gtk tutorial (chapter creating a widget from
> > > scratch). Excellent job btw.
> > 
> > "WIDGETNAME_realize() is responsible for creating an X window for the widget
> > if it has one."
> > Not exactly that helpful, unless it is mentioned in another place as well.
> 
> Well, the widget writing section is meant to be used by people who
> are fairly experienced with GTK and is a bit terse in places. That
> being said - I think the above is quite accurate and reasonably clear.
The original poster was asking what do these things do.  I assume as a user
of a widget rather than a creator.  Then someone replied look in the widget
making area for an explanation.  I still say that, for a widget users 
perspective, there is no information about why we should use it.  In fact
reading the documentation implies, to me, that a widget user should never call
it.

> Unfortunately, the Text widget is still rough in many ways - there is
> a definite need for an adoptive parent to take over maintenance /
> enhancement. I wouldn't say it _crashes_ - it dies with a descriptive
> message saying what you did wrong. (However, to be consistent with the
> rest of GTK
** ERROR **: file gtktext.c: line 537 (gtk_text_insert): "GTK_WIDGET_REALIZED (text)"
Aborted (core dumped)

Admittedly it does give you some idea of what is going on.  Interestingly this
problem only occurs if you attempt to add text, before something else happens.
I haven't quite worked out what this something else is, but it is probably
showing the window that the text appears on.

> A slighly better description of the function of gtk_widget_realize
> from the user's point of view would be:
> 
> gtk_widget_realize(widget) fills in widget->window with a pointer to
> the window in which the widget draws. If the widget has it's own
> window, it is created, otherwise widget->window will point to the
> widget's parent's window. (The parent is realized if necessary).  If
> the widget has its own window, it will also receive events generated
> for that window.

That is the what, now the when.. here goes.

You need to realise the widget if you want to do "some things" to it before
the parent window is created (by a show).  A reasonable guess perhaps.  I'm not
sure what is part of the "some things".. I'm just some huy trying to write
a program using gtk.

  - Craig



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