Re: gtkmm : program without a main window



On Thu, 2008-03-13 at 06:54 +0100, Helfer Thomas wrote:
> gtkmm seems to require a call to Gtk::Main::run.
> 
> I am coding a little gnuplot-like program. The main interface will be <<
> text based >> using readline. My (probably very basic) question is how
> to make a call to Gtk::Main::run and still be able to enter some command
> interactively.
> 
> To make my question clearer, the following code does nothing because
> Gtk::Main::run is blocking.
> 
> #include<iostream>
> #include<cstdlib>
> #include<limits>
> 
> #include<gtkmm.h>
> 
> int
> main(int argc,
>      char** argv)
> {
>   using namespace std;
>   Gtk::Main kit(argc, argv);
>   Gtk::Main::run(); //< This is blocking !

there seems to be some confusion. of course this is blocking - GTK is an
event-driven GUI framework, and so the core part of your program is a
loop that sits and waits for events and asks your code to respond to
them. Gtk::Main::run() makes this easy for you.

in your case, you seem to want the code part the program to be a loop
that waits for readline/tty input and then responds to it.

not going to work (without some odd hacking). you're mashing up two
different styles of programming.

--p




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