public UIDisplayArrayContext(FGLApplicationPanel f, DISPLAYARRAY p)
        {
            bool haveDown      = false;
            bool haveUp        = false;
            bool havePgDn      = false;
            bool havePgUp      = false;
            bool haveAccept    = false;
            bool haveInterrupt = false;


            int cnt;

            nCols            = Convert.ToInt32(p.ARRVARIABLES);
            KeyList          = new List <ONKEY_EVENT>();
            mainWin          = f;
            this.arrLine     = 1;
            this.scrLine     = 1;
            this.nextMove    = 0;
            this.lastarrLine = -1;
            this.nRows       = Convert.ToInt32(p.ARRCOUNT);
            onActionList     = new List <ON_ACTION_EVENT>();
            Data             = p.ROWS;
            finishing        = false;

            beforeRow = null;
            afterRow  = null;


            foreach (object evt in p.EVENTS)
            {
                if (evt is ONKEY_EVENT)
                {
                    ONKEY_EVENT e;
                    e = (ONKEY_EVENT)evt;
                    if (e.KEY == "" + FGLUtils.getKeyCodeFromKeyName("ACCEPT"))
                    {
                        haveAccept = true;
                    }

                    if (e.KEY == "" + FGLUtils.getKeyCodeFromKeyName("INTERRUPT"))
                    {
                        haveInterrupt = true;
                    }
                    if (e.KEY == "" + FGLUtils.getKeyCodeFromKeyName("DOWN"))
                    {
                        haveDown = true;
                    }

                    if (e.KEY == "" + FGLUtils.getKeyCodeFromKeyName("UP"))
                    {
                        haveUp = true;
                    }

                    if (e.KEY == "" + FGLUtils.getKeyCodeFromKeyName("PGUP"))
                    {
                        havePgUp = true;
                    }

                    if (e.KEY == "" + FGLUtils.getKeyCodeFromKeyName("PGDN"))
                    {
                        havePgDn = true;
                    }

                    KeyList.Add(e);
                    continue;
                }

                if (evt is BEFORE_ROW_EVENT)
                {
                    BEFORE_ROW_EVENT e;
                    e         = (BEFORE_ROW_EVENT)evt;
                    beforeRow = e;
                    continue;
                }

                if (evt is AFTER_ROW_EVENT)
                {
                    AFTER_ROW_EVENT e;
                    e        = (AFTER_ROW_EVENT)evt;
                    afterRow = e;
                    continue;
                }

                if (evt is ON_ACTION_EVENT)
                {
                    ON_ACTION_EVENT e;
                    e = (ON_ACTION_EVENT)evt;
                    onActionList.Add(e);
                    continue;
                }
                if (evt is AFTER_INPUT_EVENT)
                {
                    afterInput = (AFTER_INPUT_EVENT)evt;
                    continue;
                }
                Program.Show("Unhandled Event for DISPLAY ARRAY");
            }

            if (!haveAccept)
            {
                KeyList.Add(new ONKEY_EVENT("ACCEPT"));
            }

            if (!haveInterrupt)
            {
                KeyList.Add(new ONKEY_EVENT("INTERRUPT"));
            }

            if (!haveDown)
            {
                KeyList.Add(new ONKEY_EVENT("DOWN"));
            }

            if (!haveUp)
            {
                KeyList.Add(new ONKEY_EVENT("UP"));
            }

            if (!havePgDn)
            {
                KeyList.Add(new ONKEY_EVENT("PGDN"));
            }

            if (!havePgUp)
            {
                KeyList.Add(new ONKEY_EVENT("PGUP"));
            }



            activeFields = f.FindFieldArray(p.FIELDLIST);
            scrRecLines  = activeFields.Count / nCols;
            cnt          = 0;
            screenRecord = new FGLFoundField[scrRecLines, nCols];

            for (int a = 0; a < scrRecLines; a++)
            {
                //screenRecord[a] = new FGLFoundField[nCols];
                for (int b = 0; b < nCols; b++)
                {
                    screenRecord[a, b] = activeFields[cnt++];
                }
            }
        }
Example #2
0
        public UIDisplayArrayInTableContext(FGLApplicationPanel f, DISPLAYARRAY p)
        {
            bool haveDown      = false;
            bool haveUp        = false;
            bool havePgDn      = false;
            bool havePgUp      = false;
            bool haveAccept    = false;
            bool haveInterrupt = false;

            //nCols = Convert.ToInt32(p.ARRVARIABLES);
            KeyList      = new List <ONKEY_EVENT>();
            mainWin      = f;
            this.arrLine = 1;
            this.scrLine = 1;
            //this.nextMove= 0;
            //this.lastarrLine = -1;
            //this.nRows = Convert.ToInt32(p.ARRCOUNT);
            onActionList = new List <ON_ACTION_EVENT>();
            Data         = p.ROWS;

            beforeRow  = null;
            afterRow   = null;
            initialRow = true;

            foreach (object evt in p.EVENTS)
            {
                if (evt is ONKEY_EVENT)
                {
                    ONKEY_EVENT e;
                    e = (ONKEY_EVENT)evt;
                    if (e.KEY == "" + FGLUtils.getKeyCodeFromKeyName("ACCEPT"))
                    {
                        haveAccept = true;
                    }

                    if (e.KEY == "" + FGLUtils.getKeyCodeFromKeyName("INTERRUPT"))
                    {
                        haveInterrupt = true;
                    }
                    if (e.KEY == "" + FGLUtils.getKeyCodeFromKeyName("DOWN"))
                    {
                        haveDown = true;
                    }

                    if (e.KEY == "" + FGLUtils.getKeyCodeFromKeyName("UP"))
                    {
                        haveUp = true;
                    }

                    if (e.KEY == "" + FGLUtils.getKeyCodeFromKeyName("PGUP"))
                    {
                        havePgUp = true;
                    }

                    if (e.KEY == "" + FGLUtils.getKeyCodeFromKeyName("PGDN"))
                    {
                        havePgDn = true;
                    }

                    KeyList.Add(e);
                    continue;
                }

                if (evt is BEFORE_ROW_EVENT)
                {
                    BEFORE_ROW_EVENT e;
                    e         = (BEFORE_ROW_EVENT)evt;
                    beforeRow = e;
                    continue;
                }

                if (evt is AFTER_ROW_EVENT)
                {
                    AFTER_ROW_EVENT e;
                    e        = (AFTER_ROW_EVENT)evt;
                    afterRow = e;
                    continue;
                }

                if (evt is ON_ACTION_EVENT)
                {
                    ON_ACTION_EVENT e;
                    e = (ON_ACTION_EVENT)evt;
                    onActionList.Add(e);
                    continue;
                }
                Program.Show("Unhandled Event for DISPLAY ARRAY");
            }

            if (!haveAccept)
            {
                KeyList.Add(new ONKEY_EVENT("ACCEPT"));
            }

            if (!haveInterrupt)
            {
                KeyList.Add(new ONKEY_EVENT("INTERRUPT"));
            }

            if (!haveDown)
            {
                KeyList.Add(new ONKEY_EVENT("DOWN"));
            }

            if (!haveUp)
            {
                KeyList.Add(new ONKEY_EVENT("UP"));
            }

            if (!havePgDn)
            {
                KeyList.Add(new ONKEY_EVENT("PGDN"));
            }

            if (!havePgUp)
            {
                KeyList.Add(new ONKEY_EVENT("PGUP"));
            }



            displayArrayGrid = f.FindRecord(p.FIELDLIST);
            displayArrayGrid.init();
            displayArrayGrid.DataSource = null;
            dt = new DataTable();

            dt.Columns.Add("subscript");
            for (int cols = 1; cols <= p.ROWS[0].VALUES.Length; cols++)
            {
                dt.Columns.Add("col" + (cols));
            }


            //displayArrayGrid.Rows.Clear();

            displayArrayGrid.allowInsertRow = false;

            for (int row = 0; row < p.ROWS.Length; row++)
            {
                DataGridViewRow r;
                string[]        data;
                data = new string[p.ROWS[row].VALUES.Length + 1];
                r    = new DataGridViewRow();

                // We'll use the first column to store the index
                // for the current row...
                data[0] = "" + (row + 1);

                for (int col = 0; col < p.ROWS[row].VALUES.Length; col++)
                {
                    object itm;
                    int    trimWidth = -1;
                    AubitDesktop.Xml.XMLForm.TableColumn tc = displayArrayGrid.table.TableColumn[col];
                    itm = tc.Item;


                    if (itm is AubitDesktop.Xml.XMLForm.Edit)
                    {
                        AubitDesktop.Xml.XMLForm.Edit e;
                        e         = (AubitDesktop.Xml.XMLForm.Edit)itm;
                        trimWidth = Convert.ToInt32(e.width);
                    }
                    if (itm is AubitDesktop.Xml.XMLForm.Widget)
                    {
                        AubitDesktop.Xml.XMLForm.Widget e;
                        e         = (AubitDesktop.Xml.XMLForm.Widget)itm;
                        trimWidth = Convert.ToInt32(e.width);
                    }

                    data[col + 1] = p.ROWS[row].VALUES[col].Text;

                    if (trimWidth > 0)
                    {
                        if (p.ROWS[row].VALUES[col].Text != null)
                        {
                            if (p.ROWS[row].VALUES[col].Text.Length > trimWidth)
                            {
                                data[col + 1] = p.ROWS[row].VALUES[col].Text.Substring(0, trimWidth);
                            }
                        }
                    }
                }
                dt.Rows.Add(data);
                //displayArrayGrid.Rows.Add(data);

                //displayArrayGrid.AutoResizeRow(row);
                //displayArrayGrid.AutoResizeColumnHeadersHeight();
            }


            displayArrayGrid.Columns[0].Visible = false;

            displayArrayGrid.DataSource = dt;

            displayArrayGrid.AutoResizeColumnHeadersHeight();
            for (int row = 0; row < dt.Rows.Count; row++)
            {
                displayArrayGrid.AutoResizeRow(row);

                for (int col = 0; col < p.ROWS[row].VALUES.Length; col++)
                {
                    displayArrayGrid.AutoResizeColumn(col);
                }
            }

            //  displayArrayGrid.RowCount = 5;
            displayArrayGrid.Enabled = false;
            displayArrayGrid.sizeGrid();
        }