在GTK上,相关事件“获得焦点”的名称是什么?

时间:2011-10-20 12:43:29

标签: .net mono gtk gtk#

当一个窗口聚焦时,GTK上的事件名称是什么? 谢谢

1 个答案:

答案 0 :(得分:3)

也许, FocusIn

public class FocusTest {

    private static void FocusInHandler (object obj, FocusInEventArgs args) {
        Console.WriteLine("focus in");
    }

    private static void FocusOutHandler (object obj, FocusOutEventArgs args) {
        Console.WriteLine("focus out");
    }

    public static void Main() {
        Application.Init();

        Window window = new Window("Focus test");
        ...
        window.FocusInEvent += new FocusInEventHandler(FocusInHandler);
        window.FocusOutEvent += new FocusOutEventHandler(FocusOutHandler);
        ...  
        window.ShowAll();
        Application.Run();

    }
}