[gtkmm] Return information, how?



I have a problem. I once posted how can I get the data from another window. So I
made this:

-------------------------------------------------------------
#include <gtkmm.h>
#include <iostream>

class WindowHello : public Gtk::Window
{
	Gtk::Label label1;
	Gtk::Entry entry1;
	Gtk::Button button_send;
	Gtk::VBox vbox1;
	
	void button_clicked() {
		/*
		 * How can I now set the text in MainWindow to 
		 * have the value of entry1.get_text() ?
		 */
	}

public:
	WindowHello() {
		label1.set_text("Hello, gtkmm World!");
		button_send.set_label("Send data");
		button_send.signal_clicked().connect(sigc::mem_fun(this,
&WindowHello::button_clicked));

		vbox1.pack_start(label1);
		vbox1.pack_start(entry1);
		vbox1.pack_start(button_send);

		add(vbox1);
		show_all();
	}
};

class MainWindow : public Gtk::Window
{
	Gtk::Button button_exit, button_reply;
	Gtk::Entry  entry1;
	WindowHello window_hello;
	void button_clicked() {
		window_hello.show();
	}
public:
	Glib::ustring text; /* Recieved text from the hello window. */

	MainWindow() {
		button_exit.set_label("Exit");
		button_exit.signal_clicked().connect(sigc::mem_fun(this,
&MainWindow::button_clicked));
		add(button_exit);
		window_hello.hide();
		show_all();
	}
};

int main(int argc, char **argv)
{
	Gtk::Main kit(argc, argv);
	MainWindow main_window;

	Gtk::Main::run(main_window);
	
	return 0;
}
-------------------------------------------------

Please help.

Greets,
Luka

____________________
http://www.email.si/



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