1

I have a feeling that I've either stumbled upon a bug (unlikely) or that I'm just using this function wrong (probably). I'm trying to make a sheet appear on my MainWindow. For some reason though, the sheet window pops up as a regular window without a toolbar and is in no way connected to my MainWindow at all.

Now I'm pretty new to cocoa and MonoMac so you'll have to forgive me, anyways, heres the code:

        TvShowSheetController sheet = new TvShowSheetController ();
        NSApplication.SharedApplication.BeginSheet (sheet.Window, Window);

What am I doing wrong here?

Anoop Vaidya
  • 46,283
  • 15
  • 111
  • 140
Robin Heggelund Hansen
  • 4,906
  • 6
  • 37
  • 54

2 Answers2

3

Aha! Setting my sheet's window property "Visible at Launch" to false solved my problem :)

Robin Heggelund Hansen
  • 4,906
  • 6
  • 37
  • 54
0

Are you certain that Window is the window you wish to attach the sheet to?

An example from my code using an NSAlert:

alert = new NSAlert ();

alert.AddButton ("OK");
alert.MessageText = "Message";
alert.InformativeText = "Informative.";

alert.BeginSheet (Window, delegate {
    alert.Dispose ();
    alert = null;
});
Geoff Norton
  • 5,056
  • 1
  • 19
  • 17
  • Ok, this code works (altough I get a horrible amount of warnings about leaks :S). How can i get this working using a window instead of alert? – Robin Heggelund Hansen Mar 02 '11 at 15:57
  • If you're getting leaks, you're doing work on a background thread with NSObjects without a NSAutoreleasePool. Wrap your code in using (var pool = new NSAutoReleasePool ()) {}. However, you should never be modifying the UI on any thread that isn't the main thread. – Geoff Norton Mar 02 '11 at 16:07
  • As far as I know I'm not running any background thread with NSObjects, unless BeginSheet starts one? – Robin Heggelund Hansen Mar 02 '11 at 19:49