Esempio n. 1
0
        private void OnEmptyObjectsRemoved(object sender, EventArgs e)
        {
            VerifyNotDisposed();
            //find out where our current focus is and attempt to return to that place
            int?row = null;

            if (_detailListControl.ContainsFocus)
            {
                Control focussedControl = _detailListControl.FocussedImmediateChild;
                if (focussedControl != null)
                {
                    row = _detailListControl.GetRow(focussedControl);
                }
            }
            Logger.WriteMinorEvent("OnEmptyObjectsRemoved: b4 RefreshEntryDetial");
            RefreshEntryDetail();
            Logger.WriteMinorEvent("OnEmptyObjectsRemoved: b4  Application.DoEvents()");
            Application.DoEvents();
            //TODO: We need to remove this.  It's a dangerous thing in a historically buggy spot
            Logger.WriteMinorEvent("OnEmptyObjectsRemoved: b4 MoveInsertionPoint");
            if (row != null)
            {
                row = Math.Min((int)row, _detailListControl.RowCount - 1);
                Debug.Assert(row > -1, "You've reproduced bug ws-511!");
                // bug WS-511, which we haven't yet been able to reproduce
                row = Math.Max((int)row, 0);                  //would get around bug WS-511
                _detailListControl.MoveInsertionPoint((int)row);
            }
            Logger.WriteMinorEvent("OnEmptyObjectsRemoved end");
        }
Esempio n. 2
0
        protected virtual void OnGhostBindingLayoutNeeded <T>(GhostBinding <T> sender,
                                                              IList <T> list,
                                                              int index,
                                                              MultiTextControl previouslyGhostedControlToReuse,
                                                              bool doGoToNextField,
                                                              EventArgs args)
            where T : PalasoDataObject, new()
        {
            DetailList.SuspendLayout();
            var position = _detailList.GetCellPosition(sender.ReferenceControl);
            var rowIndex = position.Row;

            _previouslyGhostedControlToReuse = previouslyGhostedControlToReuse;
            PdoToLayout = list[index];
            AddWidgetsAfterGhostTrigger(PdoToLayout, sender.ReferenceControl, doGoToNextField);
            if (GhostRequestedLayout != null)
            {
                GhostRequestedLayout(this, new EventArgs());
            }
            DetailList.ResumeLayout();
            if (doGoToNextField)
            {
                _detailList.MoveInsertionPoint(rowIndex + 1);
            }
            else
            {
                _detailList.MoveInsertionPoint(rowIndex);
            }
            // For Linux/Mono, merely resuming layout and refreshing doesn't work.
            ForceLayoutAndRefresh();
        }
Esempio n. 3
0
        public void MoveInsertionPoint()
        {
            ActuallyShowOnScreen();
            _control.AddWidgetRow("blah", false, MakeWiredUpTextBox());
            _control.AddWidgetRow("blah", false, MakeWiredUpTextBox());
            _control.AddWidgetRow("blah", false, MakeWiredUpTextBox());

            _control.MoveInsertionPoint(0);

            Assert.AreSame(_control.GetEditControlFromRow(0), _focussedControl);
            _control.MoveInsertionPoint(1);
            Assert.AreSame(_control.GetEditControlFromRow(1), _focussedControl);
            _control.MoveInsertionPoint(2);
            Assert.AreSame(_control.GetEditControlFromRow(2), _focussedControl);
            _window.Close();
        }