-
-
Save chamons/bc7d951b009cab8b7a63 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Foundation; | |
using AppKit; | |
namespace TextViewTest | |
{ | |
public class StdMyDel : NSTextViewDelegate | |
{ | |
public override void TextDidChange (NSNotification notification) | |
{ | |
Console.WriteLine ("standardTextView: TextDidChange"); | |
} | |
} | |
public class CustMyDel : NSTextViewDelegate | |
{ | |
public override void TextDidChange (NSNotification notification) | |
{ | |
Console.WriteLine ("customTextView: TextDidChange"); | |
} | |
} | |
public partial class MainWindow : NSWindow | |
{ | |
private CustomTextView customTextView; | |
private NSTextView standardTextView; | |
public MainWindow (IntPtr handle) : base (handle) | |
{ | |
} | |
[Export ("initWithCoder:")] | |
public MainWindow (NSCoder coder) : base (coder) | |
{ | |
} | |
public override void AwakeFromNib () | |
{ | |
base.AwakeFromNib (); | |
customTextView = new CustomTextView (new CoreGraphics.CGRect (10, 10, 200, 24)); | |
customTextView.FinishedEditing += () => Console.WriteLine("Shift Enter Pressed"); | |
customTextView.Delegate = new CustMyDel (); | |
ContentView.AddSubview (customTextView); | |
standardTextView = new NSTextView (new CoreGraphics.CGRect (10, 50, 200, 24)); | |
standardTextView.BackgroundColor = NSColor.LightGray; | |
standardTextView.Delegate = new StdMyDel (); | |
ContentView.AddSubview (standardTextView); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment