【问题标题】:Destroying Windows in GTK#在 GTK 中销毁 Windows#
【发布时间】:2009-08-23 21:13:15
【问题描述】:

我在 GTK# 中有一个通过鼠标单击打开的对话框,单击其中的按钮后,应该再次关闭该对话框。我必须在窗口上同时调用 Hide() 和 Destroy() 方法吗?

这是我启动对话的代码:

protected virtual void ConfigureDialogue (object sender, System.EventArgs e)
{
    MyConfigWindow myConfWindow = new MyConfigWindow ();
    this.Sensitive = false;
    myConfWindow.Run ();
    this.Sensitive = true;
}

这里是配置窗口的相关部分:

public partial class MyConfigWindow  : Gtk.Dialog
{

    public MyConfigWindow ()
    {
        this.Build();
    }

    protected virtual void onSave (object sender, System.EventArgs e)
    {
        this.Hide();
        this.Destroy ();
    }
}

当我只调用this.Destroy () 时,主窗口再次敏感(因此myConfWindow.Run () 已结束),但对话仍然可见。

【问题讨论】:

    标签: c# mono gtk gtk#


    【解决方案1】:

    您在 ConfigureDialog 过程中缺少销毁调用...

      this.Sensitive = false; 
      result = myConfWindow.run();
      if (result == gtk.RESPONSE_CLOSE:)
        myConfWindow.destroy();
      this.Sensitive = true;
    

    希望对您有所帮助。

    【讨论】:

      猜你喜欢
      • 2012-10-21
      • 1970-01-01
      • 1970-01-01
      • 2010-09-08
      • 1970-01-01
      • 2016-12-06
      • 2011-10-09
      • 2019-02-23
      • 1970-01-01
      相关资源
      最近更新 更多