main form hide()



Hello!

I want to write a program that first show a main form, then pops up a login form. Then, if the person click OK (and the login was successful), the login form closes and the main form remains, if the person click Cancel, the main form also closes. I tried something like that below (only mainform.cc):

#include "loginform.h"
#include "mainform.h"
#include <gtkmm/main.h>

MainForm::MainForm()
{
    set_border_width(10);
    set_size_request(800, 600);
    set_position(Gtk::WIN_POS_CENTER);
    ...
}

void MainForm::on_show()
{
    Gtk::Window::on_show();
    LoginForm loginform;
    if( ! loginform.run() )
    {
        hide();
        exit(0);
    }
}

MainForm::~MainForm()
{
}

It works, but I think, that calling exit(0) directly from the main loop is a bit rude. My problem is that hide() only closes the window, but does not exit the main loop. Gtk::Main::quit() is not good, because I started with Gtk::Main::run(mainform). Is there another way to do that?

Thanks for any help

Kelemen István



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