Ejemplo n.º 1
0
        internal static void FrontCallNoReturns(FGLApplicationPanel appPanel, FRONTCALL call)
        {
            switch (call.MODULE)
            {
            case "INTERNAL":
                if (call.NAME.StartsWith("ui.combobox."))
                {
                    ui_combo_frontcall(appPanel, call.NAME, call.VS, null);
                    return;
                }

                if (call.NAME.StartsWith("ui.form."))
                {
                    ui_form_frontcall(appPanel, call.NAME, call.VS, null);
                    return;
                }

                if (call.NAME == "ui.interface.close")
                {
                    Application.Exit();
                    System.Diagnostics.Process.GetCurrentProcess().Kill();
                    Environment.Exit(0);
                    return;
                }

                MessageBox.Show("Unhandled INTERNAL frontcall : " + call.NAME);
                break;

            default:
                MessageBox.Show("Unhandled module call : " + call.MODULE + " " + call.NAME);
                break;
            }
        }
Ejemplo n.º 2
0
        /*
         * string getCurrentApplicationAcceptKey()
         * {
         *
         *  FGLApplicationPanel fGLApplicationPanel = null;
         *  TabPage tp = tabControl1.SelectedTab;
         *  if (tp == null) { return "Escape"; }
         *
         *  foreach (Control c in tp.Controls)
         *  {
         *      if (c is FGLApplicationPanel)
         *      {
         *          fGLApplicationPanel = (FGLApplicationPanel)tp.Controls[0];
         *      }
         *  }
         *
         *
         *  if (fGLApplicationPanel != null)
         *  {
         *      return fGLApplicationPanel.getAcceptKey();
         *  }
         *
         *  return "Escape";
         * }
         */



        string getCurrentApplicationKey(string keyType, string defaultKey)
        {
            FGLApplicationPanel fGLApplicationPanel = null;
            TabPage             tp = tabControl1.SelectedTab;

            if (tp == null)
            {
                return(defaultKey);
            }

            foreach (Control c in tp.Controls)
            {
                if (c is FGLApplicationPanel)
                {
                    fGLApplicationPanel = (FGLApplicationPanel)tp.Controls[0];
                }
            }


            if (fGLApplicationPanel != null)
            {
                string rval =
                    fGLApplicationPanel.getApplicationKey(keyType);
                if (rval != "")
                {
                    return(rval);
                }
            }

            return(defaultKey);
        }
Ejemplo n.º 3
0
        private void doChangedRequiredWhenTabChanges()
        {
            FGLApplicationPanel fGLApplicationPanel = null;
            TabPage             tp = tabControl1.SelectedTab;

            if (tp == null)
            {
                return;
            }

            foreach (Control c in tp.Controls)
            {
                if (c is FGLApplicationPanel)
                {
                    fGLApplicationPanel = (FGLApplicationPanel)tp.Controls[0];
                }
            }

            if (currentPanel != null)
            {
                currentPanel.NavigateAwayTab();
            }
            if (fGLApplicationPanel != null)
            {
                fGLApplicationPanel.NavigateToTab();
            }
            currentPanel = fGLApplicationPanel;

            showOrHideMenubar();
            //showOrHideToolbar();
        }
Ejemplo n.º 4
0
        public UIPromptContext(FGLApplicationPanel f, PROMPT p)
        {
            //Label l;
            //TextBox tb;
            bool charMode;

            KeyList      = new List <ONKEY_EVENT>();
            onActionList = new List <ON_ACTION_EVENT>();
            mainWin      = f;



            promptStyle = p.ATTRIB_STYLE;
            if (promptStyle == "")
            {
                promptStyle = "NORMAL";
            }

            if (p.CHARMODE == "0")
            {
                charMode = false;
            }
            else
            {
                charMode = true;
            }

            promptForm = new PromptWindow(p.TEXT, Convert.ToInt32(p.FIELDATTRIBUTE), Convert.ToInt32(p.PROMPTATTRIBUTE), promptStyle, charMode, p.ATTRIB_TEXT, this);

            foreach (object evt in p.EVENTS)
            {
                if (evt is ONKEY_EVENT)
                {
                    ONKEY_EVENT e;
                    e = (ONKEY_EVENT)evt;
                    KeyList.Add(e);
                    promptForm.AddKeyWatch(Convert.ToInt32(e.ID), e.KEY);
                    //f.AddToolBarKey(e.KEY, e.ID);
                    continue;
                }
                if (evt is ON_ACTION_EVENT)
                {
                    ON_ACTION_EVENT e;
                    e = (ON_ACTION_EVENT)evt;
                    onActionList.Add(e);
                }

                Program.Show("Unhandled Event for PROMPT");
            }

            if (promptStyle == "NORMAL")
            {
                Control promptPanel;
                promptPanel = promptForm.GetPromptControls();
                f.setPrompt(promptPanel);
            }
        }
Ejemplo n.º 5
0
 internal void setTabTitle(FGLApplicationPanel fGLApplicationPanel, string progname)
 {
     foreach (TabPage tp in this.tabControl1.TabPages)
     {
         if (tp.Controls.Contains(fGLApplicationPanel))
         {
             tp.Text = progname;
             return;
         }
     }
     Program.Show("Unable to find application panel");
 }
Ejemplo n.º 6
0
 internal void setActiveTab(FGLApplicationPanel fGLApplicationPanel)
 {
     foreach (TabPage tp in this.tabControl1.TabPages)
     {
         if (tp.Controls.Contains(fGLApplicationPanel))
         {
             if (tp != tabControl1.SelectedTab)
             {
                 tabControl1.SelectedTab = tp;
             }
             return;
         }
     }
     //Program.Show("Unable to find application panel");
 }
Ejemplo n.º 7
0
        public void addNewTabPage(int ID, string appName, FGLApplicationPanel appPanel)
        {
            TabPage tp;

            bringtoTop();
            // If we get to here - we've not found any valid running application - so we need to start one...
            tabControl1.TabPages.Add(appName);
            tp = tabControl1.TabPages[tabControl1.TabPages.Count - 1];
            tabControl1.TabStop = false;
            tp.Controls.Add(appPanel);
            tp.AutoScroll = true;

            //appPanel.AutoScroll = true;
            tabControl1.SelectTab(tp);
            doChangedRequiredWhenTabChanges();
        }
Ejemplo n.º 8
0
        private void setUpMainAppWindow()
        {
            updating            = false;
            this.currentPanel   = null;
            RunningApplications = new List <FGLApplicationPanel>();
            this.splitContainer1.Panel2Collapsed = true;
            this.splitContainer2.Panel1Collapsed = true;

            this.showApplicationLauncher = showMode.ShowAuto;
            this.showMenuBar             = showMode.ShowAlways;
            this.showToolbar             = showMode.ShowAuto;
            this.lblComment.Text         = "";
            this.lblError.Text           = "";
            this.lblLineDisplay.Text     = "";
            this.lblMessage.Text         = "";
            this.hasApplicationTree      = false;
            bringtoTop();
        }
Ejemplo n.º 9
0
        internal static void FrontCallNoReturns(FGLApplicationPanel appPanel, FRONTCALL call)
        {
            switch (call.MODULE)
            {
            case "INTERNAL":
                if (call.NAME.StartsWith("ui.combobox."))
                {
                    ui_combo_frontcall(appPanel, call.NAME, call.VALUES, null);
                    return;
                }

                MessageBox.Show("Unhandled INTERNAL frontcall : " + call.NAME);
                break;

            default:
                MessageBox.Show("Unhandled module call : " + call.MODULE + " " + call.NAME);
                break;
            }
        }
Ejemplo n.º 10
0
        public void removeTabPage(FGLApplicationPanel appPanel)
        {
            bool forceClose = false;

            if (applicationLauncherId == appPanel.ApplicationEnvelopeID)
            {
                // They are closing the application panel!
                if (tabControl1.TabCount > 1)
                {
                    MessageBox.Show("Application launcher is exiting - all other program will exit too");
                    forceClose = true;
                }
            }
            if (appPanel == null)
            {
                return;
            }

            foreach (TabPage tp in this.tabControl1.TabPages)
            {
                if (tp.Controls.Contains(appPanel))
                {
                    tabControl1.TabPages.Remove(tp);

                    appPanel.Dispose();
                    appPanel = null;
                }
            }


            if (this.tabControl1.TabCount == 0 || forceClose)
            {
                dontPrompt = true;
                this.Close();
                this.Dispose();
            }
            return;
        }
Ejemplo n.º 11
0
        private void saveWindowToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FGLApplicationPanel fGLApplicationPanel = null;
            TabPage             tp = tabControl1.SelectedTab;

            if (tp == null)
            {
                return;
            }

            foreach (Control c in tp.Controls)
            {
                if (c is FGLApplicationPanel)
                {
                    fGLApplicationPanel = (FGLApplicationPanel)tp.Controls[0];
                }
            }


            if (fGLApplicationPanel != null)
            {
                fGLApplicationPanel.saveWindow();
            }
        }
Ejemplo n.º 12
0
        void setLastKeyInApplication(string keycode)
        {
            FGLApplicationPanel fGLApplicationPanel = null;
            TabPage             tp = tabControl1.SelectedTab;

            if (tp == null)
            {
                return;
            }

            foreach (Control c in tp.Controls)
            {
                if (c is FGLApplicationPanel)
                {
                    fGLApplicationPanel = (FGLApplicationPanel)tp.Controls[0];
                }
            }


            if (fGLApplicationPanel != null)
            {
                fGLApplicationPanel.setLastKey(keycode);
            }
        }
Ejemplo n.º 13
0
 public UIMiscContext(FGLApplicationPanel f, FRONTCALL p)
 {
     frontCall   = p;
     appPanel    = f;
     contextType = MiscContextType.MiscContextFrontCall;
 }
Ejemplo n.º 14
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();
        }
Ejemplo n.º 15
0
        void n_ReceivedEnvelopeFromServer(object sender, ReceivedEventArgs e)
        {
            ENVELOPE enew;
            int      a;
            int      ID;


            FGLApplicationPanel appPanel;

            if (e.Data == "")
            {
                return;
            }
            updating = true;


            enew = null;
            try
            {
                enew = EnvReader.ReadFromXml(e.Data);
            }
            catch (Exception E)
            {
                MessageBox.Show("Internal Error\nInvalid XML in data sent from 4gl" + e.Data + "\n" + E.Message);
            }
            if (enew == null)
            {
                return;
            }
            ID = Convert.ToInt32(enew.ID);

            foreach (FGLApplicationPanel p in RunningApplications)
            {
                if (p.ApplicationEnvelopeID == ID) // We've found it..
                {
                    for (a = 0; a < enew.COMMANDS.Length; a++)
                    {
                        p.commands.Add(enew.COMMANDS[a]);
                    }
                    updating = false;

                    if (EnvelopeReadyForConsumption != null)
                    {
                        EnvelopeReadyForConsumption(null, null);
                    }
                    return;
                }
            }

            // If we get to here - we have no FGLApplication panel to use :-(
            appPanel = new FGLApplicationPanel(this, this.stdNetworkConnection.username, this.stdNetworkConnection.application, Convert.ToInt32(enew.ID));
            RunningApplications.Add(appPanel);
            for (a = 0; a < enew.COMMANDS.Length; a++)
            {
                appPanel.commands.Add(enew.COMMANDS[a]);
            }

            updating = false;
            if (EnvelopeReadyForConsumption != null)
            {
                EnvelopeReadyForConsumption(null, null);
            }
        }
Ejemplo n.º 16
0
        private static string[] ui_form_frontcall(FGLApplicationPanel appPanel, string name, V[] values, string[] retStrings)
        {
            switch (name)
            {
            case "ui.form.setpagetitle":
            {
                TabPage f = appPanel.FindPage(values);



                if (f == null)
                {
                    return(null);
                }



                return(null);
            }

            case "ui.form.setelementhidden":
            {
                return(null);
            }


            case "ui.form.setfieldhidden":
            {
                List <FGLFoundField> f = appPanel.FindField(values[0].Text);
                if (f == null)
                {
                    return(null);
                }
                if (f.Count == 0)
                {
                    return(null);
                }

                return(null);
            }



            case "ui.form.setattributes":
            {
                List <FGLFoundField> f = appPanel.FindField(values[0].Text);
                if (f == null)
                {
                    return(null);
                }
                if (f.Count == 0)
                {
                    return(null);
                }

                if (f[0].fglField is FGLTextFieldWidget)
                {
                    FGLTextFieldWidget widget = (FGLTextFieldWidget)f[0].fglField;
                    widget.ui_textfield_picture(values[1].Text);
                }
                return(null);        // no return values...
            }



            default:
                return(null);
            }

            return(retStrings);
        }
        //  private List<FGLFoundField> activeFields;

        public UIConstructInTableContext(FGLApplicationPanel f, CONSTRUCT c, FormattedGridView pConstructGrid, List <DataGridViewCell> pRecordFields)
        {
            bool haveAccept    = false;
            bool haveInterrupt = false;

            KeyList = new List <ONKEY_EVENT>();
            KeyList.Clear();
            RecordFields    = pRecordFields;
            afterFieldList  = new List <AFTER_FIELD_EVENT>();
            beforeFieldList = new List <BEFORE_FIELD_EVENT>();
            onActionList    = new List <ON_ACTION_EVENT>();
            setCurrentField = null;
            CurrentField    = null;
            PendingEvents   = new List <string>();
            isBeforeInput   = true;

            // activeFields = f.FindFieldArray(c.FIELDLIST);

            foreach (object evt in c.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;
                    }
                    KeyList.Add(e);
                    continue;
                }

                if (evt is BEFORE_FIELD_EVENT)
                {
                    BEFORE_FIELD_EVENT e;
                    e = (BEFORE_FIELD_EVENT)evt;
                    beforeFieldList.Add(e);
                    continue;
                }

                if (evt is AFTER_FIELD_EVENT)
                {
                    AFTER_FIELD_EVENT e;
                    e = (AFTER_FIELD_EVENT)evt;
                    afterFieldList.Add(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 CONSTRUCT");
            }

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

            mainWin = f;


            constructGrid = pConstructGrid;

            if (constructGrid == null)
            {
                constructGrid = (FormattedGridView)pRecordFields[0].DataGridView;
            }

            constructGrid.init();
            constructGrid.DataSource = null;
            dt = new DataTable();
            dt.Columns.Add("subscript");


            // Add a column for each column in the grid
            for (int cols = 0; cols < constructGrid.Columns.Count; cols++)
            {
                DataColumn col = new DataColumn("col" + (cols));
                dt.Columns.Add(col);
            }

            constructColumnList = c.COLUMNS;

            constructGrid.allowInsertRow = false;


            DataGridViewRow r;

            string[] data;
            data = new string[constructGrid.Columns.Count];
            r    = new DataGridViewRow();


            for (int colno = 1; colno < constructGrid.Columns.Count; colno++)
            {
                data[colno] = "";
            }
            setActiveFields();
            dt.Rows.Add(data);

            constructGrid.Columns[0].Visible = false;
            constructGrid.DataSource         = dt;
            //   constructGrid.AutoResizeColumnHeadersHeight();
            //   constructGrid.AutoResizeRow(0);

            // for (int colno = 1; colno < constructGrid.Columns.Count; colno++)
            //  {
            //     constructGrid.AutoResizeColumn(colno);
            //  }

            constructGrid.Enabled = false;

            // WEBGUI displayArrayGrid.sizeGrid();
        }
Ejemplo n.º 18
0
        public UIInputArrayInTableContext(FGLApplicationPanel f, INPUTARRAY p)
        {
            bool haveDown      = false;
            bool haveUp        = false;
            bool havePgDn      = false;
            bool havePgUp      = false;
            bool haveAccept    = false;
            bool haveInterrupt = false;
            bool haveDelete    = false;
            bool haveInsert    = false;


            KeyList = new List <ONKEY_EVENT>();
            mainWin = f;
            nCols   = p.ARRVARIABLES;
            maxRows = p.MAXARRSIZE;


            Data = new DataTable();          //new string[p.MAXARRSIZE, p.ARRVARIABLES];

            for (int a = 0; a <= nCols; a++) // One extra for the subscript....
            {
                if (a == 0)
                {
                    Data.Columns.Add("subscript");
                }
                else
                {
                    Data.Columns.Add("col" + a);
                }
            }



            //  rowWasAutoInserted = new bool[maxRows];
            //     rowDataChanged = new bool[maxRows];

            //  inputArrayGrid.maxRows = maxRows;


            PendingEvents = new List <s_pending>();

            lastRowData = new string[maxRows];
            for (int a = 0; a < maxRows; a++)
            {
                lastRowData[a] = "";
            }



            // Set up the 'blank' event IDs for before
            // and after fields for the Cell number
            // this will make it easier to check if we need to action
            // a before or after field event
            beforeFieldEventIds = new int[nCols];
            afterFieldEventIds  = new int[nCols];
            for (int a = 0; a < nCols; a++)
            {
                beforeFieldEventIds[a] = -1;
                afterFieldEventIds[a]  = -1;
            }


            onActionList = new List <ON_ACTION_EVENT>();


            beforeRow = null;
            afterRow  = null;

            inputArrayGrid = f.FindRecord(p.FIELDLIST);

            if (inputArrayGrid == null)
            {
                MessageBox.Show("Screen record " + p.FIELDLIST + " not found - fix your 4gl!");
                Application.Exit();
            }


            inputArrayGrid.DataSource = null;

            // Make sure the array is completely cleared down..
            inputArrayGrid.ClearSelection();
            inputArrayGrid.Rows.Clear();
            inputArrayGrid.init();
            inputArrayGrid.maxRows = maxRows;

            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;
                    }
                    if (e.KEY == "" + FGLUtils.getKeyCodeFromKeyName("INSERT"))
                    {
                        haveInsert = true;
                    }

                    if (e.KEY == "" + FGLUtils.getKeyCodeFromKeyName("DELETE"))
                    {
                        haveDelete = 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 BEFORE_DELETE_EVENT)
                {
                    BEFORE_DELETE_EVENT e;
                    e            = (BEFORE_DELETE_EVENT)evt;
                    beforeDelete = e;
                    continue;
                }

                if (evt is BEFORE_INSERT_EVENT)
                {
                    BEFORE_INSERT_EVENT e;
                    e            = (BEFORE_INSERT_EVENT)evt;
                    beforeInsert = e;
                    continue;
                }


                if (evt is AFTER_DELETE_EVENT)
                {
                    AFTER_DELETE_EVENT e;
                    e           = (AFTER_DELETE_EVENT)evt;
                    afterDelete = e;
                    continue;
                }

                if (evt is AFTER_INPUT_EVENT)
                {
                    afterInput = (AFTER_INPUT_EVENT)evt;
                    continue;
                }

                if (evt is AFTER_INSERT_EVENT)
                {
                    AFTER_INSERT_EVENT e;
                    e           = (AFTER_INSERT_EVENT)evt;
                    afterInsert = 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 BEFORE_FIELD_EVENT)
                {
                    BEFORE_FIELD_EVENT e;
                    e = (BEFORE_FIELD_EVENT)evt;
                    int a = getCellNumberForField(e.FIELD);

                    if (a >= 0)
                    {
                        beforeFieldEventIds[a] = Convert.ToInt32(e.ID);
                    }
                    else
                    {
                        MessageBox.Show("BEFORE FIELD " + e.FIELD + " - field not found");
                    }
                    continue;
                }

                if (evt is AFTER_FIELD_EVENT)
                {
                    AFTER_FIELD_EVENT e;
                    e = (AFTER_FIELD_EVENT)evt;
                    int a = getCellNumberForField(e.FIELD);
                    if (a >= 0)
                    {
                        afterFieldEventIds[a] = Convert.ToInt32(e.ID);
                    }
                    else
                    {
                        MessageBox.Show("AFTER FIELD " + e.FIELD + " - field not found");
                    }

                    continue;
                }

                Program.Show("Unhandled Event for INPUT ARRAY");
            }



            if (p.NONEWLINES == 1 || p.ALLOWINSERT == 0)
            {
                allowInsert = false;
            }
            else
            {
                allowInsert = true;
            }

            if (p.ALLOWDELETE == 1)
            {
                allowDelete = true;
            }
            else
            {
                allowDelete = false;
            }

            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"));
            }

            if (!haveInsert && allowInsert)
            {
                KeyList.Add(new ONKEY_EVENT("INSERT"));
            }

            if (!haveDelete && allowDelete)
            {
                KeyList.Add(new ONKEY_EVENT("DELETE"));
            }
        }
Ejemplo n.º 19
0
 public UIMiscContext(FGLApplicationPanel f, WINQUESTION p)
 {
     wq          = p;
     appPanel    = f;
     contextType = MiscContextType.MiscContextWinquestion;
 }
Ejemplo n.º 20
0
        public UIInputContext(FGLApplicationPanel f, INPUT i)
        {
            bool haveAccept    = false;
            bool haveInterrupt = false;

            KeyList = new List <ONKEY_EVENT>();
            KeyList.Clear();
            afterFieldList  = new List <AFTER_FIELD_EVENT>();
            beforeFieldList = new List <BEFORE_FIELD_EVENT>();
            onActionList    = new List <ON_ACTION_EVENT>();
            setCurrentField = null;
            CurrentField    = null;
            PendingEvents   = new List <string>();
            isBeforeInput   = true;

            foreach (object evt in i.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;
                    }


                    KeyList.Add(e);
                    continue;
                }

                if (evt is BEFORE_FIELD_EVENT)
                {
                    BEFORE_FIELD_EVENT e;
                    e = (BEFORE_FIELD_EVENT)evt;
                    beforeFieldList.Add(e);
                    continue;
                }

                if (evt is AFTER_FIELD_EVENT)
                {
                    AFTER_FIELD_EVENT e;
                    e = (AFTER_FIELD_EVENT)evt;
                    afterFieldList.Add(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)
                {
                    //Just ignore it...
                    continue;
                }
                Program.Show("Unhandled Event for INPUT");
            }

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

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

            mainWin = f;

            activeFields = f.FindFields(i.FIELDLIST);
            foreach (FGLFoundField fld in activeFields)
            {
                if (fld.fglField.NoEntry == false)
                {
                    setCurrentField = fld;
                    fld.fglField.gotFocus();
                    CurrentField   = fld;
                    careAboutFocus = true;
                    CurrentField.fglField.setFocus();
                    careAboutFocus  = false;
                    setCurrentField = null;
                    break;
                }
            }
        }
Ejemplo n.º 21
0
        public UIMenuContext(FGLApplicationPanel f, MENU m)
        {
            int top = 30;

            //  MenuButtons = new List<Button>();
            thismenu          = m;
            _contextIsActive  = false;
            mainWin           = f;
            menuPanel         = new GroupBox();
            menuPanel.Visible = true;

            menuPanel.Text = m.TITLE;
            menuPanel.Controls.Clear();
            menuPanel.Dock = DockStyle.Fill;


            keyList      = new List <ONKEY_EVENT>();
            onActionList = new List <ON_ACTION_EVENT>();


            foreach (object o in m.MENUCOMMANDS)
            {
                if (o is MENUACTION)
                {
                    // Ignore for now..
                }
                if (o is MENUCOMMAND)
                {
                    MENUCOMMAND a;
                    Button      btn;
                    string      txt;
                    bool        isOnToolbar = false;
                    a   = o as MENUCOMMAND;
                    txt = a.TEXT;
                    if (txt.Length == 0)
                    {
                        txt = null;
                    }



                    if (txt == null)
                    {
                        string[] menukeys;
                        menukeys = a.KEYS.Split(',');
                        foreach (string s in menukeys)
                        {
                            ONKEY_EVENT e = new ONKEY_EVENT();
                            e.ID = a.ID;

                            e.KEY = s;
                            keyList.Add(e);
                        }
                    }
                    else
                    {
                        string[] menukeys;
                        if (a.KEYS == "")
                        {
                            menukeys = new string[1];
                            //menukeys[0] =1;

                            char[] arr = a.TEXT.Substring(0, 1).ToCharArray();
                            menukeys[0] = ((int)(arr[0])).ToString();
                        }
                        else
                        {
                            menukeys = a.KEYS.Split(',');
                        }

                        foreach (string s in menukeys)
                        {
                            int         n = -1;
                            ONKEY_EVENT e = new ONKEY_EVENT();
                            try
                            {
                                n = Convert.ToInt32(s);
                            }
                            catch (Exception) { }


                            if (s.Trim() != "" && n != -1)
                            {
                                e.ID = a.ID;

                                e.KEY = s;
                                if (n <= 26 || n > 255)
                                {
                                    keyList.Add(e);
                                }
                            }
                        }

                        if (a.TEXT != null && a.TEXT != "")
                        {
                            if (f.hasToolbarButton(a.TEXT.ToLower()))
                            {
                                ON_ACTION_EVENT e;
                                e        = new ON_ACTION_EVENT();
                                e.ACTION = a.TEXT.ToLower();
                                e.ID     = a.ID;

                                onActionList.Add(e);
                                isOnToolbar = true;
                                // NOTE :
                                // We might want to add a 'continue' here - so
                                // we dont have a menubutton of we have a toolbar button...
                            }
                        }

                        btn = new UIMenuBarButton(txt, a.ID);


                        if (a.DESCRIPTION != null)
                        {
                            tooltips.SetToolTip(btn, a.DESCRIPTION);
                        }

                        btn.Click   += new EventHandler(b_Click);
                        btn.Top      = top;
                        btn.AutoSize = true;
                        btn.Left     = 10;
                        if (btn.Image != null)
                        {
                            btn.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
                            btn.TextAlign  = System.Drawing.ContentAlignment.MiddleRight;
                        }

                        if (!isOnToolbar)
                        {
                            menuPanel.Controls.Add(btn);
                            if (btn.Height == 0)
                            {
                                top += 30;
                            }
                            else
                            {
                                top += btn.Height;
                            }
                        }
                    }
                }
            }


            //   mainWin.setActiveToolBarKeys(keyList, onActionList, false, false, false);
        }
Ejemplo n.º 22
0
        private static string[] ui_combo_frontcall(FGLApplicationPanel appPanel, string name, VALUE[] values, string[] retStrings)
        {
            switch (name)
            {
            case "ui.combobox.forname":
            {
                List <FGLFoundField> f = appPanel.FindField(values[0].Text);
                if (f == null)
                {
                    return(null);
                }
                if (f.Count == 0)
                {
                    return(null);
                }
                retStrings[0] = f[0].fullName;
                return(retStrings);
            }


            case "ui.combobox.additem":
            {
                List <FGLFoundField> f = appPanel.FindField(values[0].Text);
                if (f == null)
                {
                    return(null);
                }
                if (f.Count == 0)
                {
                    return(null);
                }
                if (f[0].fglField is FGLComboListBoxFieldWidget)
                {
                    FGLComboListBoxFieldWidget widget = (FGLComboListBoxFieldWidget)f[0].fglField;
                    widget.ui_combobox_additem(values[1].Text, values[2].Text);
                }
                return(null);        // no return values...
            }

            case "ui.combobox.clear":
            {
                List <FGLFoundField> f = appPanel.FindField(values[0].Text);
                if (f == null)
                {
                    return(null);
                }
                if (f.Count == 0)
                {
                    return(null);
                }
                if (f[0].fglField is FGLComboListBoxFieldWidget)
                {
                    FGLComboListBoxFieldWidget widget = (FGLComboListBoxFieldWidget)f[0].fglField;
                    widget.ui_combobox_clear();
                    return(null);
                }
                break;
            }

            case "ui.combobox.removeitem":
            {
                List <FGLFoundField> f = appPanel.FindField(values[0].Text);
                if (f == null)
                {
                    return(null);
                }
                if (f.Count == 0)
                {
                    return(null);
                }

                if (f[0].fglField is FGLComboListBoxFieldWidget)
                {
                    FGLComboListBoxFieldWidget widget = (FGLComboListBoxFieldWidget)f[0].fglField;
                    widget.ui_combobox_removeitem(values[1].Text);
                    return(null);
                }
            }
            break;


            case "ui.combobox.getcolumnname":
            {
                List <FGLFoundField> f = appPanel.FindField(values[0].Text);
                if (f == null)
                {
                    return(null);
                }
                if (f.Count == 0)
                {
                    return(null);
                }
                retStrings[0] = f[0].getColumnName();
            }
            break;

            case "ui.combobox.getindexof":
                throw new ApplicationException("Combo." + name + " not implemented yet");
            //return null;

            case "ui.combobox.getitemcount":
            {
                List <FGLFoundField> f = appPanel.FindField(values[0].Text);
                if (f[0].fglField is FGLComboListBoxFieldWidget)
                {
                    FGLComboListBoxFieldWidget widget = (FGLComboListBoxFieldWidget)f[0].fglField;
                    retStrings[0] = widget.ui_combobox_getitemcount();
                    return(null);
                }
            }
            break;

            case "ui.combobox.getitemname":
                throw new ApplicationException("Combo." + name + " not implemented yet");
            //return null;

            case "ui.combobox.getitemtext":
                throw new ApplicationException("Combo." + name + " not implemented yet");
            //return null;

            case "ui.combobox.gettablename":
            {
                List <FGLFoundField> f = appPanel.FindField(values[0].Text);
                if (f == null)
                {
                    return(null);
                }
                if (f.Count == 0)
                {
                    return(null);
                }
                retStrings[0] = f[0].getTableName();
            }
            break;

            case "ui.combobox.gettag":
                throw new ApplicationException("Combo." + name + " not implemented yet");
            //return null;

            case "ui.combobox.gettextof":

                throw new ApplicationException("Combo." + name + " not implemented yet");
            // return null;


            default:
                return(null);
            }

            return(retStrings);
        }
Ejemplo n.º 23
0
 public UIMiscContext(FGLApplicationPanel f, GETKEY p)
 {
     gk          = p;
     appPanel    = f;
     contextType = MiscContextType.MiscContextGetKey;
 }
Ejemplo n.º 24
0
        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++];
                }
            }
        }
Ejemplo n.º 25
0
        public UIConstructContext(FGLApplicationPanel f, CONSTRUCT c)
        {
            bool haveAccept    = false;
            bool haveInterrupt = false;

            KeyList = new List <ONKEY_EVENT>();
            KeyList.Clear();
            afterFieldList  = new List <AFTER_FIELD_EVENT>();
            beforeFieldList = new List <BEFORE_FIELD_EVENT>();
            onActionList    = new List <ON_ACTION_EVENT>();
            setCurrentField = null;
            CurrentField    = null;
            PendingEvents   = new List <string>();
            isBeforeInput   = true;


            foreach (object evt in c.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;
                    }
                    KeyList.Add(e);
                    continue;
                }

                if (evt is BEFORE_FIELD_EVENT)
                {
                    BEFORE_FIELD_EVENT e;
                    e = (BEFORE_FIELD_EVENT)evt;
                    beforeFieldList.Add(e);
                    continue;
                }

                if (evt is AFTER_FIELD_EVENT)
                {
                    AFTER_FIELD_EVENT e;
                    e = (AFTER_FIELD_EVENT)evt;
                    afterFieldList.Add(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)
                {
                    //Just ignore it...
                    continue;
                }
                Program.Show("Unhandled Event for CONSTRUCT");
            }

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

            mainWin = f;

            activeFields = f.FindFields(c.FIELDLIST);
            if (activeFields.Count != c.COLUMNS.Length)
            {
                Program.Show("Field count mismatch in CONSTRUCT");
                Application.Exit();
                constructColumnList = null;
            }
            else
            {
                constructColumnList = c.COLUMNS;
            }
            foreach (FGLFoundField fld in activeFields)
            {
                fld.fglField.Text = "";
            }
            try
            {
                activeFields[0].fglField.setFocus();
            }
            catch
            {
            }
        }