Re: Mixed pixbuf and text
- From: "A. Pagaltzis" <pagaltzis gmx de>
- To: gtk-perl-list gnome org
- Subject: Re: Mixed pixbuf and text
- Date: Fri, 1 Jul 2005 10:49:17 +0200
* The Saltydog <thesaltydog gmail com> [2005-07-01 10:35]:
On 7/1/05, Jan Hudec <bulb ucw cz> wrote:
Wow, that's complex! Simply running Gtk2->main_iteration
while Gtk2->events_pending; between reading the lines is
easier and does the job just as well.
Yes, but I needed the user to be free to start using all
program features, even while the treeview is growing. So he can
open trees, doubleclick, use menu items and even stop the scan.
You are programming by coincidence[1]. If you actually understood
how Gtk2 works, youâd know that the loop Jan mentioned enables
exactly the behaviour you want, and you could avoid a lot of
complexity.
By way of an explanation: a GUI program works by having a
mainloop which runs indefinitely and checks whether the user did
anything. For anything the user does, it registers an âevent,â
then calls handlers to react to that event. Gtk2->main_iteration
does that for exactly one event. If there was no event pending
processing, it blocks (so you donât want to call it if there are
none). Gtk2->event_pending checks whether thereâs anything in the
queue. That means that the loop Jan mentioned will process any
clicks, redraws, etc which were queued up when the program was
busy, any time it has a moment to spare.
[1] http://www.pragmaticprogrammer.com/ppbook/extracts/coincidence.html
Hope this helps,
--
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1};
&Just->another->Perl->hacker;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]