简体   繁体   中英

monomac - How to close a child windown when click a button in main window

I created a MonoMac project with monodevelop.

I opened the file MainWindow.xib in the Xcode Interface Builder. In Interface Builder, I dropped a new NSwindow Panel into my project. The panel name is: Setting_window and the outlet name is: Setting_window.

In the Mainwindow I have 2 buttons: Hide Settings Window(btn1) and Show Settings Window(btn2);

When I run project, It show 2 window : Main Window and Settings window. I want to hide and show Settings window when click button btn1 and btn2. In C# on Windows, I use .show() and .Dispose(); But on Monomac, I don't know which methods to call.

This is code:

Setting_window.Title = "my setting"; // This works as expected 
//Setting_window.??? // I want to close the settings window

NSWindow.Close() was not available due to how it released the reference on the objc side of things, and wasn't playing nice with the GC.

It appears that a recent fix has been committed that brings back this method so you can close the window programatically:

https://github.com/mono/monomac/commit/6183d93be442aec3946f19e273e4810dff291f66

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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