Re: gtkmm-list Digest, Vol 78, Issue 5



Yes, I thought so, but when I run the program from command shell window, I see that the form closes, but the program does not terminate. My main loop is exactly the same as yours.

2010/10/8 <gtkmm-list-request gnome org>
Send gtkmm-list mailing list submissions to
       gtkmm-list gnome org

To subscribe or unsubscribe via the World Wide Web, visit
       http://mail.gnome.org/mailman/listinfo/gtkmm-list
or, via email, send a message with subject or body 'help' to
       gtkmm-list-request gnome org

You can reach the person managing the list at
       gtkmm-list-owner gnome org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of gtkmm-list digest..."

Today's Topics:

  1. Re: main form hide() (Jim Orcheson)


---------- Továbított levél ----------
From: Jim Orcheson <jim va3hj ca>
To: gtkmm-list gnome org
Date: Thu, 07 Oct 2010 07:11:18 -0400
Subject: Re: main form hide()
Does your main loop look like this?:

int main(int argc, char *argv[]) {
    Gtk::Main kit(argc, argv);
   
    MainForm mainform;
    Gtk::Main::run(mainform);

    return 0;
}

If it does, then your hide() call should close MainForm and terminate the loop. The call to exit(0) is not needed.

Jim

On 06/10/2010 4:36 PM, István Kelemen wrote:
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

_______________________________________________ gtkmm-list mailing list gtkmm-list gnome org http://mail.gnome.org/mailman/listinfo/gtkmm-list

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list




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