[Gtk-sharp-list] Modal property of Dialog not working

vanosten rick@vanosten.net
10 Jan 2003 20:25:36 +0100


Hi
The modal property of dialog seems not to be working. Even if I set
"dialog.Modal = true" the code in my method goes on, i.e. the appliation
is not freezed. I might be missing some general GTK behaviour?

The follwoing code snippets show that I call a general method within the
same class that shows a dialog and returns a value representing the
chosen option in the dialog. However, instead of the dialog being shown,
then the ShowDialog(...) method returning and finally the
Console.WriteLine(...) further on being called, the code in the method
continues as if there was no modal dialog :-(

private MyMethod() {
    boolean goOn = true;
    int i = ShowQuestionDialog(...);
    switch (i) {
        case Constants.DIALOG_YES_OPTION:
           goOn = false;
           break;
        case Constants.DIALOG_NO_OPTION:
            goOn = true;
            break;
    }
    if (goOn) {
        Console.WriteLine("FileSel");
        ...
    }
}

private int ShowQuestionDialog(...) {
    dialog = new Dialog();
    dialog.Title = aTitle;
    dialog.SetDefaultSize(400, 400);
            
    //The container holding the icon and the message
    ...
    //Add the main widget representing the message
    hbox.PackStart(message, false, false, 0);
            
    //Add the response buttons
    ...
    dialog.Response += new ResponseHandler(OnDialogResponse);
                
    //show
    dialog.Modal = true;
    dialog.ShowAll();
    return dialogResponse; //set by the ResponseHandler
}


Sorry for bothering you with yet another question ... Rick

GTK-# v0.6, MONO v0.17, Debian unstable i386