Exemple #1
0
        public static void Disable(IntPtr controlHandle)
        {
            if (controlHandle == IntPtr.Zero)
            {
                return;
            }

            IAutoComplete2 iac = null;

            try
            {
                iac = (IAutoComplete2)GetAutoComplete();
                iac.Enable(false);
            }
            finally
            {
                if (iac != null)
                {
                    Marshal.ReleaseComObject(iac);
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Disables the specified control handle.
        /// </summary>
        /// <param name="controlHandle">The control handle.</param>
        private static void Disable(IntPtr controlHandle)
        {
            if (controlHandle == IntPtr.Zero)
            {
                return;
            }

            IAutoComplete2?iac = null;

            try
            {
                iac = GetAutoComplete() as IAutoComplete2;
                iac?.Enable(false);
            }
            finally
            {
                if (iac != null)
                {
                    Marshal.ReleaseComObject(iac);
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// Enable/Disable auto complete.
        /// </summary>
        /// <param name="enable">bool</param>
        /// <param name="quickComplete">string. Use null to disable CTRL-ENTER handling</param>
        /// <remarks>CTRL-ENTER seems to have a bug: it also expands already expanded Urls of the form 'http://xyz.domain'</remarks>
        public void SetAutoComplete(Boolean enable, string quickComplete)
        {
            Int32          ret;
            IAutoComplete2 iac2 = (IAutoComplete2)GetAutoComplete();

            if (EditHandle == IntPtr.Zero)
            {
                throw new Exception("EditHandle must not be zero!");
            }

            if (ListSource == null)
            {
                throw new Exception("ListSource must not be null!");
            }

            ret = iac2.Init(EditHandle, ListSource, "", quickComplete);

            ret = iac2.SetOptions((UInt32)ACOptions);

            ret = iac2.Enable(enable ? 1 : 0);

            Marshal.ReleaseComObject(iac2);
        }
Exemple #4
0
        public static void Enable(IntPtr controlHandle, SourceCustomList items, AUTOCOMPLETEOPTIONS options)
        {
            if (controlHandle == IntPtr.Zero)
            {
                return;
            }

            IAutoComplete2 iac = null;

            try
            {
                iac = (IAutoComplete2)GetAutoComplete();
                int ret = iac.Init(controlHandle, items, "", "");
                ret = iac.SetOptions(options);
                ret = iac.Enable(true);
            }
            finally
            {
                if (iac != null)
                {
                    Marshal.ReleaseComObject(iac);
                }
            }
        }
Exemple #5
0
        /// <summary>
        /// Enables the specified control handle.
        /// </summary>
        /// <param name="controlHandle">The control handle.</param>
        /// <param name="items">The items.</param>
        /// <param name="options">The options.</param>
        private static void Enable(IntPtr controlHandle, SourceCustomList items, AUTOCOMPLETEOPTIONS options)
        {
            if (controlHandle == IntPtr.Zero)
            {
                return;
            }

            IAutoComplete2?iac = null;

            try
            {
                iac = GetAutoComplete() as IAutoComplete2;
                iac?.Init(controlHandle, items, string.Empty, string.Empty);
                iac?.SetOptions(options);
                iac?.Enable(true);
            }
            finally
            {
                if (iac != null)
                {
                    Marshal.ReleaseComObject(iac);
                }
            }
        }