Newbie Question - reg display of windows in an App



Hi All

This a newbie question. Not sure if I can ask this in this group. Plz
direct me if I am supposed to ask such simple questions elsewhere.

I am using Gtkmm on Linux and I have this application where I need to
display the following (I am NOT using glade):

The main window (starting point of application) is the login window and
when the user enters details and clicks "Login" button, he needs to be
taken to the next window where he enters some other information and
clicks some other button. He does a series of things by clicking on the
buttons in the windows displayed.

Can someone please suggest how to show one window on click on the button
in the previous window. I couldn't find any examples in the tutorial
regarding this navigation. Not sure how to connect one window with the
next window.


I developed the app like this:

BaseForm.cpp
----------------
class BaseForm : public Gtk::Window
{
	//Base form with all common fields defined here
	Gtk::Button m_button1, m_button2,m_button3,m_button4;
}
//the following were defined as virtual methods in the BaseForm.h file 
//to allow overriding in the derived classes.
void BaseForm :: button1Action() {}
void BaseForm :: button2Action() {}
void BaseForm :: button3Action() {}
void BaseForm :: button4Action() {}



LoginForm.cpp
---------------
class LoginForm : public BaseForm 
{
	//define relevant fields here
	
	//Constructor (displaying only button3 and button4)
	//Destructor

	//associate call back functions with the buttons.
m_button3.signal_clicked().connect( sigc::mem_fun(*this,&LoginForm::button3Action) );	m_button4.signal_clicked().connect( sigc::mem_fun(*this,&LoginForm::button4Action) );  
}

//Overriding the methods from the base class

void LoginForm :: button1Action() { // no action }
void LoginForm :: button2Action() { // no action }


//This method is showing the window along with the login window.
//But I want only one window to be shown at a time.

void LoginForm :: button3Action() { 
	DataEntryForm dataform =Gtk::manage(new DataEntryForm);
	dataform->show();
	std::cout << "From Button3" << std::endl; //hide();
}//end of method button3Action()

void LoginForm :: button4Action() { // some action }





DataEntryForm.cpp
-------------------
class DataEntryForm : public BaseForm 
{
	//define relevant fields here
	
	//Constructor (display all 4 buttons)
	//Destructor
	//associate callback methods with the buttons

}
//over ride the methods button1Action() button2Action() 
//button3Action() button4Action()


MainProgram.cpp
------------------
#include "LoginForm.h"

int main(int argc, char *argv[]);

int main (int argc, char *argv[])
{
	Gtk::Main kit(argc, argv);
	LoginForm* main_window = new LoginForm

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


All your inputs are highly appreciated.

Thanks
Sirisha




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