Beispiel #1
0
        /// <summary>
        /// Adds a new column to the column parameter list at the specified index.
        /// </summary>
        /// <param name="AColumnParameters">List with the current columns</param>
        /// <param name="AColumnIndex">Index where the new column is added</param>
        /// <returns>the MaxDisplayColumns number</returns>
        public static System.Int32 AddColumn(ref TParameterList AColumnParameters, int AColumnIndex)
        {
            System.Int32 NewColumn;
            System.Int32 NewMaxColumn;
            System.Int32 Counter;

            if (AColumnIndex == -1)
            {
                NewMaxColumn = AColumnParameters.Get("MaxDisplayColumns").ToInt();
                NewColumn = NewMaxColumn;
                AColumnParameters.Add("MaxDisplayColumns", NewColumn + 1);
            }
            else
            {
                NewColumn = AColumnIndex + 1;
                NewMaxColumn = AColumnParameters.Get("MaxDisplayColumns").ToInt() + 1;
                AColumnParameters.Add("MaxDisplayColumns", NewMaxColumn);

                /* need to move the columns to the right */
                for (Counter = NewMaxColumn - 1; Counter >= NewColumn + 1; Counter -= 1)
                {
                    AColumnParameters.MoveColumn(Counter - 1, Counter);
                }
            }

            return NewColumn;
        }
Beispiel #2
0
        /// <summary>
        /// Remove one colum from the parameter list.
        /// </summary>
        /// <param name="AColumnParameters">List with the current columns</param>
        /// <param name="AColumnIndex">Index of the column to remove</param>
        /// <returns>the MaxDisplayColumns number</returns>
        public static System.Int32 RemoveColumn(ref TParameterList AColumnParameters, int AColumnIndex)
        {
            AColumnParameters.RemoveColumn(AColumnIndex);

            /* need to move the following columns to the left */
            System.Int32 MaxColumn = AColumnParameters.Get("MaxDisplayColumns").ToInt() - 1;

            for (int Counter = AColumnIndex + 1; Counter <= MaxColumn; Counter += 1)
            {
                AColumnParameters.MoveColumn(Counter, Counter - 1);
            }

            AColumnParameters.Add("MaxDisplayColumns", MaxColumn);

            return MaxColumn;
        }