/// <summary>process set data for row</summary> ///<param name = "guiMgCtrl">table control</param> /// <param name = "sendAll">if true , always send all records</param> internal void processGetRowsData(GuiMgControl guiMgCtrl, int desiredTopIndex, bool sendAll, LastFocusedVal lastFocusedVal) { var mgControl = (MgControl)guiMgCtrl; if (mgControl != null && mgControl.Type == MgControlType.CTRL_TYPE_TABLE) { var rtEvt = new RunTimeEvent(mgControl, desiredTopIndex, true); rtEvt.setInternal(InternalInterface.MG_ACT_ROW_DATA_CURR_PAGE); rtEvt.setSendAll(sendAll); rtEvt.LastFocusedVal = lastFocusedVal; ClientManager.Instance.EventsManager.addToTail(rtEvt); } }
/// <summary> /// vertical scroll /// </summary> /// <param name="ea"></param> internal override void ScrollVertically(ScrollEventArgs ea) { if (ea.Type == ScrollEventType.EndScroll) { return; } int newPos = ea.NewValue - _tableControl.RecordsBeforeCurrentView; if (ea.Type == ScrollEventType.First && _includesFirst == false) { newPos = 1; SetGuiTopIndex(newPos); _tableControl.Refresh(); } else if (ea.Type == ScrollEventType.Last && _includesLast == false) { newPos = Math.Max(_tableControl.VirtualItemsCount - _rowsInPage - 3, 0); SetGuiTopIndex(newPos); } else if (_includesFirst && newPos < 0) { newPos = 0; } else if (_includesLast && newPos > _tableControl.VirtualItemsCount - _rowsInPage) { newPos = Math.Max(_tableControl.VirtualItemsCount - _rowsInPage, 0); SetGuiTopIndex(newPos); } if (needToGetRows(newPos)) { LastFocusedVal lastFocusedVal = GetLastEditedFocusedVal(); int desiredTopIndex = getMagicIndex(newPos); Events.OnGetRowsData(_mgControl, desiredTopIndex, false, lastFocusedVal); } else { refreshPage(); } }
/// <summary> /// gets last value of the control that was previously in focus /// is working only for text controls /// used to restore control's edited value after current record is replaced by different chunk /// </summary> /// <returns></returns> private LastFocusedVal GetLastEditedFocusedVal() { Form form = GuiUtilsBase.FindForm(_tableControl); LastFocusedVal lastFocusedVal = null; MapData mapData = ((TagData)form.Tag).LastFocusedMapData; if (mapData != null && mapData.getControl() != null) { Object obj = controlsMap.object2Widget(mapData.getControl(), mapData.getIdx()); var lg = obj as LogicalControl; if (lg != null && lg.ContainerManager == this) { GuiMgControl mgControl = mapData.getControl(); if (mgControl.isTextControl()) { lastFocusedVal = new LastFocusedVal(mgControl, mapData.getIdx(), lg.Text); } } } return(lastFocusedVal); }