question about gtk_window_do_modal and gtk_main



I use multi gtk_main() call in my app.
I made a message box function, which use the gtk_main as the following
void ShowMessageBox(GtkWidget *parent)
{
            GtkWidget *box;
            box=CreateMessageBox(...);


gtk_window_set_transient_for(GTK_WINDOW(box),GTK_WINDOW(parent));
            gtk_widget_show(box);

            gtk_main();
}

in the main.cpp, I create another window with a button as the following
int main(....)
{
        ....
        window=CreateWindow(....);

        gtk_signal_connect(GTK_OBJECT(button)......);
        //when click button, it will brings up the MessageBox

      gtk_widget_show(window);
      gtk_widget_main();
}

In the call back function of clicking button in the window, the code is
as the following
void ButtonClicked(.....)
{
           gtk_winow_set_modal(GTK_WINDOW(window),true);
           ShowMessageBox(window);
}

but what happened is after I click the button, GTK didn't set the modal
of the window, instead, it set the modal of the message box.  That is
strange, anybody knows why?





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