gnope php gtk gui gnope.org  

launch function after gtk::main();

 
Post new topic   Reply to topic    gnope.org Forum Index -> PHP GTK2 Beginners
View previous topic :: View next topic  
Author Message
zedzed



Joined: 23 Jan 2006
Posts: 1

PostPosted: Mon Jan 23, 2006 2:03 pm    Post subject: launch function after gtk::main(); Reply with quote

Hello,

I want start function after php-aplication has started.
My apps show data in clist and refresh data regulary.
If i use timeout_add before main, the window freez.

what am i supose to do ?

Thanks


ps: Sorry for my very bad english ...
Back to top
clange



Joined: 24 Jan 2006
Posts: 14

PostPosted: Tue Jan 24, 2006 9:15 am    Post subject: Reply with quote

Can you make an example or show your code?

<?PHP
....

function bla() {
while(1) {
//updateing
}
}

gtk::timeout_add(1000,"bla");
gtk::main();
?>

now the app will hang, until the while is breaking.
i think your timout function doesn't return.

mfg clange
Back to top
karlbowden



Joined: 18 Dec 2005
Posts: 21
Location: Taree, NSW, Australia

PostPosted: Wed Jan 25, 2006 4:38 pm    Post subject: Reply with quote

Also might like to try a slightly less invasive method.

Code:
function bla () {
  // do one update loop
  return true;
}
gtk::timeout_add (1000, "bla");
gtk::main ();


If bla () does not return true, it will not be called again. bla () needs to return control back to gtk as quickly as possible, and from memory timeouts will not start until you make a call to gtk::main (), so i'm pretty sure clange's on the right track. If you need it updating quicker, just set the timeout delay lower.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    gnope.org Forum Index -> PHP GTK2 Beginners All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Templates enhanced by DigiWiki. Hosting by Tradebit.