[Mono-winforms-list] Gtk dialogs in system windows forms(possible double post)
Whalley Anthony
Anthony.Whalley@ie.fujitsu.com
Tue, 5 Apr 2005 15:44:55 +0100
Hi Guys
I have ported a chess UI to mono.
http://tontsblog.hosting365.ie/blog/
Is there a recommended way to call a GTK dialog
from a system.windows application as my app seems
to hang now and again when I use the following code.
//In a Windows.System.Forms app.
main code(){
FileChooser.Driver dlg = new FileChooser.Driver() ;
string strXMLFile = dlg.GetFileName() ;
}
///FileChooser code
using System;
using Gtk;
using Glade;
namespace FileChooser
{
/// <summary>
/// Summary description for Driver.
/// </summary>
public class Driver
{
#region Glade Widgets
[Widget] Gtk.FileChooser dlgFile;
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
new Driver();
}
public Driver()
{
Application.Init();
}
public string GetFileName()
{
FileSelection fDlg = new FileSelection("Choose a File");
fDlg.Modal = true;
int nRc = fDlg.Run();
fDlg.Hide();
if(nRc == (int)ResponseType.Ok)
{
return fDlg.Filename;
}
else
{
return "";
}
}
}
}
Thanks
Tont