コード例 #1
0
ファイル: UFlexCelDataSource.cs プロジェクト: mwilian/demos
        public object GetValueForRow(int Row, int ColumnIndex)
        {
            if ((TPseudoColumn)ColumnIndex == TPseudoColumn.RowCount)
            {
                return(DataState.RowCount);                                                      //First so it does not check for eof.
            }
            if (Row >= RecordCount)
            {
                FlxMessages.ThrowException(FlxErr.ErrReadAfterEOF);
            }
            if (Row < 0)
            {
                FlxMessages.ThrowException(FlxErr.ErrReadBeforeBOF);
            }

            if (ColumnIndex >= ColumnCount)
            {
                FlxMessages.ThrowException(FlxErr.ErrInvalidColumn, ColumnIndex);
            }

            if (ColumnIndex < 0)
            {
                switch ((TPseudoColumn)ColumnIndex)
                {
                case TPseudoColumn.RowPos: return(DataState.Position);

                default: FlxMessages.ThrowException(FlxErr.ErrInvalidColumn, ColumnIndex); break;
                }
            }

            if (Row == DataState.Position)
            {
                return(DataState.GetValue(ColumnIndex));                           //avoid an exception if movetorecord is not supported and we really don't need to move to record.
            }
            int SavePosition = DataState.Position;

            try
            {
                DataState.DoMoveToRecord(Row);
                return(DataState.GetValue(ColumnIndex));
            }
            finally
            {
                DataState.DoMoveToRecord(SavePosition);
            }
        }
コード例 #2
0
 public override void MoveToRecord(int aPosition)
 {
     ActualDataState.DoMoveToRecord(aPosition);
 }