示例#1
0
        bool IExtenderProvider.CanExtend(object extendee)
        {
            //find  AutocompleteMenu with lowest hashcode
            if (Container != null)
            {
                foreach (object comp in Container.Components)
                {
                    if (comp is AutocompleteMenu)
                    {
                        if (comp.GetHashCode() < GetHashCode())
                        {
                            return(false);
                        }
                    }
                }
            }
            //we are main autocomplete menu on form ...
            //check extendee as TextBox
            if (!(extendee is Control))
            {
                return(false);
            }
            TextBoxWrapper temp = TextBoxWrapper.Create(extendee as Control);

            return(temp != null);
        }
示例#2
0
 protected void OnWrapperNeeded(WrapperNeededEventArgs args)
 {
     if (WrapperNeeded != null)
     {
         WrapperNeeded(this, args);
     }
     if (args.Wrapper == null)
     {
         args.Wrapper = TextBoxWrapper.Create(args.TargetControl);
     }
 }
示例#3
0
        public static TextBoxWrapper Create(Control targetControl)
        {
            var result = new TextBoxWrapper(targetControl);

            if (result.selectedText == null || result.selectionLength == null || result.selectionStart == null ||
                result.getPositionFromCharIndex == null)
            {
                return(null);
            }

            return(result);
        }
示例#4
0
        public static TextBoxWrapper Create(Control targetControl)
        {
            var result = new TextBoxWrapper(targetControl);

            if (result.selectedText == null || result.selectionLength == null || result.selectionStart == null ||
                result.getPositionFromCharIndex == null)
                return null;

            return result;
        }