简体   繁体   English

在对话框外部单击时关闭对话框

[英]Close dialog when click outside of it

I'm working with GTK# and I have a dialog that I want to close when user clicks out of it. 我正在使用GTK#,并且有一个对话框,当用户单击它时要关闭它。 Very similar to the way a combobox works: when the dropdown list is expanded and you click out of it, it closes. 与组合框的工作方式非常相似:展开下拉列表并单击它时,它会关闭。 There are similar questions to this problem, but for other languages =( and I can't figure out a way to relate those answers to my problem. 这个问题也有类似的问题,但是对于其他语言=(,我无法找出一种将这些答案与我的问题联系起来的方法。

Thanks in advance. 提前致谢。

乍一看,您应该连接到对话框的notify::has-toplevel-focus信号,并在has-toplevel-focus属性变为false时将其关闭。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM