Re: Mixed pixbuf and text



On Fri, 2005-07-01 at 10:49 +0200, A. Pagaltzis wrote:
* 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.

Well, I think I understand how Gtk2 works and I don't understand how
calling events pending and main_iteration helps at all.

Consider a typical sequence of statements to query a database:

  my $sth = $dbh->prepare($sql);
  my $rc  = $sth->execute(@args);
  while ( @row = $sth->fetchrow_array ) {
    print "@row\n";
  }

If we have a complex query that takes 2 minutes to execute, then 
the second line of code will take two minutes from when it begins 
executing to when the execute method returns.  

Sure, we can call main_iteration before calling execute and we 
can call it again after execute returns, but if execute takes 2 
minutes to return then out GUI will be unresponsive for 2 minutes.

Or am I missing something?

Regards
Grant




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