예제 #1
0
        /// <summary>
        /// This procedure will switch the two columns
        /// </summary>
        /// <param name="AColumnParameters">List with the current columns</param>
        /// <param name="AFrom">Index of the column to move</param>
        /// <param name="ATo">Index of the new position of the column to move</param>
        /// <returns>void</returns>
        public static void SwitchColumn(ref TParameterList AColumnParameters, int AFrom, int ATo)
        {
            System.Int32 MaxDisplayColumns;
            System.Int32 Counter;
            System.Int32 ReferencedColumn;

            AColumnParameters.SwitchColumn(AFrom, ATo);

            /* switch the referenced columns in calculation */
            MaxDisplayColumns = AColumnParameters.Get("MaxDisplayColumns").ToInt();

            for (Counter = 0; Counter <= MaxDisplayColumns - 1; Counter += 1)
            {
                if (AColumnParameters.Exists("FirstColumn", Counter))
                {
                    ReferencedColumn = AColumnParameters.Get("FirstColumn", Counter).ToInt();

                    if (ReferencedColumn == AFrom)
                    {
                        ReferencedColumn = ATo;
                    }
                    else if (ReferencedColumn == ATo)
                    {
                        ReferencedColumn = AFrom;
                    }

                    AColumnParameters.Add("FirstColumn", new TVariant(ReferencedColumn), Counter);
                }

                if (AColumnParameters.Exists("SecondColumn", Counter))
                {
                    ReferencedColumn = AColumnParameters.Get("SecondColumn", Counter).ToInt();

                    if (ReferencedColumn == AFrom)
                    {
                        ReferencedColumn = ATo;
                    }
                    else if (ReferencedColumn == ATo)
                    {
                        ReferencedColumn = AFrom;
                    }

                    AColumnParameters.Add("SecondColumn", new TVariant(ReferencedColumn), Counter);
                }
            }
        }