GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Wed Nov 26, 2014 8:50 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: How to use gtk_main_iteration_do() ???
PostPosted: Thu Oct 27, 2011 3:43 pm 
Offline
Familiar Face

Joined: Mon Oct 17, 2011 10:18 am
Posts: 26
Hello All,

I am a new GTK user and I need help, I would be grateful if you could find time to answer.

I have read the documentation of "gtk_main_iteration_do()" here (http://developer.gnome.org/gtk3/stable/ ... eration-do), but it is not clear for me, to be more precise:

1. What is the main loop? Should I create the code of it?
* I am working with ROS, and there is also an event loop, so I canĀ“t just write a "regular" GTK loop (actually this is the reason
I want to "use gtk_main_iteration_do").

2. What is the right way to use gtk_main_iteration_do()?
I could not find anything better that this in the internet:
while ( !gtk_main_iteration_do(0) )
{
a_non_blocking_function();
}


I am really stuck, so I would be more than happy to receive an answer.
Thanks in advance,
Felix.


Top
 Profile  
 
 Post subject: Re: How to use gtk_main_iteration_do() ???
PostPosted: Sat Oct 29, 2011 9:46 am 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 780
Location: UK
Hi,

I would also read the documentation on the GLib main loop which is what the GTK main loop is based on, this is at http://developer.gnome.org/glib/stable/glib-The-Main-Event-Loop.html. This explains a fair bit more on what happens within the loop.

You do not need to create code, just call gtk_main() to enter it.

Using gtk_main_iteration_do() is really a hack and should only be used sparingly and certainly not to run your application from.

You might be able to run your ROS code in another thread and use interprocess communication (IPC) to send messages back to your GTK code.

E.

_________________
E.


Top
 Profile  
 
 Post subject: Re: How to use gtk_main_iteration_do() ???
PostPosted: Fri Nov 04, 2011 5:56 pm 
Offline
Familiar Face

Joined: Mon Oct 17, 2011 10:18 am
Posts: 26
errol wrote:
Hi,

I would also read the documentation on the GLib main loop which is what the GTK main loop is based on, this is at http://developer.gnome.org/glib/stable/glib-The-Main-Event-Loop.html. This explains a fair bit more on what happens within the loop.

You do not need to create code, just call gtk_main() to enter it.

Using gtk_main_iteration_do() is really a hack and should only be used sparingly and certainly not to run your application from.

You might be able to run your ROS code in another thread and use interprocess communication (IPC) to send messages back to your GTK code.

E.


Hi Errol,
Just wanted to thank you for the answer. I have found a way to use it with ROS in the same process.
F.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Yahoo [Bot] and 7 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group