Re: scrolledview



Selon James Scott Jr <skoona verizon net>:

An idle handler would be a good fit here.  I assumed that you are
creating and filling textviews during the startup of your program and
possibly before you enter the main_loop or gtk_main.  Or possibly in a
routine that does everything at once.  Here is the potential problem:
your create and populate actions require some additional gtk messages to
be processed, which are waiting to get serviced by the gtk_main() loop.
So thing s will not appear to settle down until after the gtk_main has
been allowed to run.  Using an idle handler puts your call to a
Position/Size routine at the back of the waiting queue of needed
messages, so by the time it's processed the other messages have done
their job and all the textviews/scrollbars/gtkvboxes, and scrolled
windows have settled down.  -- wait, this assumes you issued a
gtk_widget_show{_all} on the main window containing all this stuff!  Its
the gtk_widget_show that starts the cascade of messages which includes
the size and realize messages.

g_idle_add() or g_timeout_add(250,...) show do the trick.

Thank you... you seem to be right.
Due to the nature of Gtk I should wait all events/messages to be consumed before
trying to do anything with widgets.

Mehmet



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