In Mono I have a simple NSWindow with Controller on it I drop a NSSplitView and a NSButton.
If I try to access the NSSplitView out of the Contstructor or Initialize() Method I get a nullReferenceException. Instead if I try to access the NSSplitView from a ButtonClicked Method, it works.
Well, it seems that the Framework creates the GUI Components after the controller's Construtor is called. But where should I put my code to configure GUI Components if not in the Constructor?
Thanks in advance. Johannes
You should use the AwakeFromNib method in your controller class. It is called once all the objects have been loaded and properly connected.
public override void AwakeFromNib ()
{
base.AwakeFromNib ();
// Do something here with the outlets
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With