Beispiel #1
0
        protected void RunButton()
        {
            if (ReadOnly)
            {
                return;
            }

            _ownerPropertyEnum.Property.InPlaceCtrlInAction = this;

            PropertyValue unitValue = _ownerPropertyEnum.Property.GetValue(PropertyUnitLook.UnitValue);

            _editorContainer.SetContent(_ownerPropertyEnum, unitValue.DisplayString, PropertyUnitLook.UnitValue);

            if (_editorContainer.ContentControl == null)
            {
                return;
            }

            _editorContainer.MustBeClosed += new EventHandler(OnDropDownContentMustBeClosed);

            Win32Calls.SetWindowLong(_editorContainer.Handle, -8, (int)Parent.Handle);

            Rectangle workingArea = Screen.FromControl(this).WorkingArea;
            Point     offset      = Parent.PointToScreen(new Point(0, 0));

            Rectangle bounds = Bounds;

            // No listbox smaller than the value column
            if (_editorContainer.Width < Size.Width)
            {
                _editorContainer.Width = Size.Width;
            }

            // No listbox left truncated
            Point origin = new Point(bounds.Right - _editorContainer.Size.Width + offset.X, bounds.Bottom + 1 + offset.Y);

            if (origin.X < workingArea.Left)
            {
                origin.X = workingArea.Left;
            }

            // No listbox bottom truncated
            if (origin.Y + _editorContainer.Height > workingArea.Bottom)
            {
                origin.Y = bounds.Top - _editorContainer.Height + offset.Y;
            }

            _editorContainer.Location            = origin;
            _editorContainer.ContentControl.Dock = DockStyle.Fill;

            // Show the window but don't activate it
            Win32Calls.ShowWindow(new HandleRef(_editorContainer, _editorContainer.Handle), Win32Calls.SW_SHOWNA);
            _editorContainer.Visible = true;
            _ownerPropertyEnum.Property.ParentGrid.SetDropDownTopWindow(_editorContainer);

            _editorContainer.DoModalLoop();
        }
Beispiel #2
0
        protected void HideDropDownContent()
        {
            // If no icon was initially shown (in the case of multiple values as a result of calling SelectedObjects)
            // then the textbox was at the far left. If a value has been entered, the textbox must be right shifted.
            if ((_oldImageListIndex == -1) && (_ownerPropertyEnum.Property.Value.ImageIndex >= 0))
            {
                RepositionChildren();
            }

            _editorContainer.MustBeClosed -= new EventHandler(OnDropDownContentMustBeClosed);

            // If the dropdown window is closed because the focus changed to another app,
            // the focus is not reset to the grid
//            if (_wmFocusMissingArg != null)
//              Parent.Focus();

            _ownerPropertyEnum.Property.InPlaceCtrlInAction = null;

            _editorContainer.Visible = false;
            _editorContainer.SetContent(null, null);
            _ownerPropertyEnum.Property.ParentGrid.SetDropDownTopWindow(null);
            _ownerPropertyEnum.Property.ParentGrid.OnInPlaceCtrlFinishedEdition();

            _editorContainer.Dispose();
            _editorContainer = null;
        }
Beispiel #3
0
        protected void RunButton()
        {
            if (ReadOnly)
                return;

            _ownerPropertyEnum.Property.InPlaceCtrlInAction = this;

            // TODO: Passer la valeur actuelle au lieu de Text qd realtimechange==false et TypeConverter->exception ?
            _editorContainer = new PropInPlaceContainer();
            _editorContainer.SetContent(_ownerPropertyEnum, Text);

            if (_editorContainer.ContentControl == null)
                return;

            _editorContainer.MustBeClosed += new EventHandler(OnDropDownContentMustBeClosed);

            Win32Calls.SetWindowLong(_editorContainer.Handle, -8, (int)Parent.Handle);

            Rectangle workingArea = Screen.FromControl(this).WorkingArea;
            Point offset = Parent.PointToScreen(new Point(0, 0));

            Rectangle bounds = Bounds;

            // No listbox smaller than the value column
            if (_editorContainer.Width < Size.Width)
                _editorContainer.Width = Size.Width;

            // No listbox left truncated
            Point origin = new Point(bounds.Right - _editorContainer.Size.Width + offset.X, bounds.Bottom + 1 + offset.Y);
            if (origin.X < workingArea.Left)
                origin.X = workingArea.Left;

            // No listbox bottom truncated
            if (origin.Y + _editorContainer.Height > workingArea.Bottom)
            {
                _editorContainer.ResizeTop = true;
                origin.Y = bounds.Top - _editorContainer.Height + offset.Y;
            }
            else
                _editorContainer.ResizeTop = false;

            _editorContainer.Location = origin;

            // The previous call to ResizeTop resets the DockPadding to 0 if the container is not resizable
            _editorContainer.ContentControl.Dock = DockStyle.Fill;

            // Show the window but don't activate it
            Win32Calls.ShowWindow(new HandleRef(_editorContainer, _editorContainer.Handle), Win32Calls.SW_SHOWNA);
            _editorContainer.Visible = true;
            _ownerPropertyEnum.Property.ParentGrid.SetDropDownTopWindow(_editorContainer);

            _editorContainer.DoModalLoop();
        }
Beispiel #4
0
        protected void RunButton()
        {
            if (ReadOnly)
            {
                return;
            }

            _ownerPropertyEnum.Property.InPlaceCtrlInAction = this;

            // TODO: Passer la valeur actuelle au lieu de Text qd realtimechange==false et TypeConverter->exception ?
            _editorContainer = new PropInPlaceContainer();
            _editorContainer.SetContent(_ownerPropertyEnum, Text);

            if (_editorContainer.ContentControl == null)
            {
                return;
            }

            _editorContainer.MustBeClosed += new EventHandler(OnDropDownContentMustBeClosed);

            Win32Calls.SetWindowLong(_editorContainer.Handle, -8, (int)Parent.Handle);

            Rectangle workingArea = Screen.FromControl(this).WorkingArea;
            Point     offset      = Parent.PointToScreen(new Point(0, 0));

            Rectangle bounds = Bounds;

            // No listbox smaller than the value column
            if (_editorContainer.Width < Size.Width)
            {
                _editorContainer.Width = Size.Width;
            }

            // No listbox left truncated
            Point origin = new Point(bounds.Right - _editorContainer.Size.Width + offset.X, bounds.Bottom + 1 + offset.Y);

            if (origin.X < workingArea.Left)
            {
                origin.X = workingArea.Left;
            }

            // No listbox bottom truncated
            if (origin.Y + _editorContainer.Height > workingArea.Bottom)
            {
                _editorContainer.ResizeTop = true;
                origin.Y = bounds.Top - _editorContainer.Height + offset.Y;
            }
            else
            {
                _editorContainer.ResizeTop = false;
            }

            _editorContainer.Location = origin;

            // The previous call to ResizeTop resets the DockPadding to 0 if the container is not resizable
            _editorContainer.ContentControl.Dock = DockStyle.Fill;

            // Show the window but don't activate it
            Win32Calls.ShowWindow(new HandleRef(_editorContainer, _editorContainer.Handle), Win32Calls.SW_SHOWNA);
            _editorContainer.Visible = true;
            _ownerPropertyEnum.Property.ParentGrid.SetDropDownTopWindow(_editorContainer);

            _editorContainer.DoModalLoop();
        }