Re: Something to triger



Two ways to do this (that I can think of)

Add a timeout to populate the list.
ie.
$timer = Glib::Timeout->add($interval, \&populate_list)
or put

while (Gtk2->events_pending) {
   Gtk2->main_iteration;
}

Just before the &populate_list() to finish displaying the window before populating.

Chris

Beast wrote:

I have simple apps that search ldap and display in the SimpleList rows.
Basically, I want to display the main window _first_ then automatically put the search results into the rows.

Unfortunately, if I call populate_list before Gtk2->main, window will wait untill the search finished, if I put after Gtk2->main, it never called because it sit there waiting for events.

Any idea how to call populate_list 'automatically' without user input?

...
my $slist = Gtk2::SimpleList->new (
              'Name'     => 'text',
              'Address'     => 'text',
              'Extention'     => 'text',
           );

$window->add($slist);
$window->show_all;

#&populate_list();

Gtk2->main;


#############
sub populate_list {
  # do serach on ldap
  ...
  push @{$slist->{data}}, [ $name, $addrs, $ext ];

}




--
Was Today Really Necessary?



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