Hi,

In the following source file, I get the following unexpected behavior:


using System;
using Monobjc;
using Monobjc.Cocoa;
namespace YvanSoftware.TwitMenu
{

        [ObjectiveCClass("LengthField")]
        public class NSTextField_Length : NSTextField
        {
                const int maxLength = 160;
                
                [ObjectiveCField("lblNumOfChars")]
                public NSTextField lblNumOfChars;
                
                public NSTextField_Length () : base()
                {
                }
                
                public NSTextField_Length (IntPtr i)
                        :base(i)
                {
                }
                
                
                public override void KeyUp (NSEvent theEvent)
                {
                        base.KeyUp (theEvent);
                        keyUpHandler();
                }
        
        
                
                void keyUpHandler() {
                        
                        Console.WriteLine("*** keyUp ***"); // Never shows up...
                        if (this.StringValue.Length >= maxLength) {
                                this.StringValue = 
this.StringValue.SubstringToIndex(maxLength);        
                        }
                        lblNumOfChars.StringValue = "Chars: " +
this.StringValue.Length.ToString() + "/" + maxLength.ToString();
                }
        }
}

I commented where the "error" takes place: the line ***keyUp*** never
shows up, but if I put it in the constructors such a statement, it
gets properly executed.

What do I need to do?

Thanks,

Yvan

Reply via email to