Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
namespace MonoMacCrash
{
public partial class AppDelegate : NSApplicationDelegate
{
public AppDelegate ()
{
}
public override void FinishedLaunching (NSObject notification)
{
using (var alert = new NSAlert ()) {
var scrollSize = new SizeF (400, 130);
var text = new MyTextView (new RectangleF (0, 0, float.MaxValue, float.MaxValue)) {
HorizontallyResizable = true,
};
text.TextContainer.ContainerSize = new SizeF (float.MaxValue, float.MaxValue);
text.TextContainer.WidthTracksTextView = true;
text.InsertText (new NSString ("Hello"));
text.Editable = false;
var scrollView = new NSScrollView (new RectangleF (PointF.Empty, SizeF.Empty)) {
HasHorizontalScroller = true,
HasVerticalScroller = true,
};
scrollView.Hidden = false;
scrollView.Frame = new RectangleF (PointF.Empty, scrollSize);
scrollView.DocumentView = text;
alert.AccessoryView = scrollView;
alert.RunModal ();
}
}
class MyTextView : NSTextView
{
public MyTextView (RectangleF frame) : base (frame)
{
}
public override void KeyDown (NSEvent theEvent)
{
base.KeyDown (theEvent);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.