Esempio n. 1
0
        public bool useKeyPress(KeyEventArgs ke)
        {
            if (contextType == MiscContextType.MiscContextGetKey)
            {
                string lastKey = null;
                if (ke.KeyValue >= 1 && ke.KeyValue <= 255)
                {
                    if (!ke.Alt)
                    {
                        lastKey = ke.KeyValue.ToString();
                    }
                }
                if (lastKey == null)
                {
                    lastKey = FGLUtils.decodeKeycode(ke.Control, ke.Shift, ke.Alt, ke.KeyCode);
                }
                //   Program.Show("KEYVALYE : "+ke.KeyValue);
                appPanel.setLastKey(lastKey);
                //appsetLastKeyInApplication(lastKey);
                lastKey = FGLUtils.getKeyCodeFromKeyName(lastKey).ToString();

                this.EventTriggered(null, "ACCEPT", "<TRIGGERED ID=\"ACCEPT\" LASTKEY=\"" + lastKey + "\"/>", this);
                return(true);
            }
            return(false);
        }
Esempio n. 2
0
        private bool CheckForToolStripKey(KeyEventArgs e, string key, string altHotKey)
        {
            string fglKey;

            //return false;

            foreach (ToolStripItem i in topWindowToolStrip.Items)
            {
                if (i is AubitTSBtn)
                {
                    AubitTSBtn a;

                    a = (AubitTSBtn)i;
                    if (i.Visible == false)
                    {
                        continue;
                    }
                    if (i.Enabled == false)
                    {
                        continue;
                    }

                    if (a.altHotKey != null && altHotKey != null)
                    {
                        if (a.altHotKey != "" && altHotKey != "")
                        {
                            if (altHotKey.ToLower() == a.altHotKey.ToLower())
                            {
                                if (a.clickHandler != null)
                                {
                                    a.clickHandler(a, null);
                                    return(true);
                                }
                            }
                        }
                    }

                    fglKey = FGLUtils.getKeyNameFromFGLKeyCode(a.ActiveKey);
                    if (fglKey.ToLower() == key.ToLower())
                    {
                        if (a.clickHandler != null)
                        {
                            a.clickHandler(a, null);
                        }
                        else
                        {
                            Program.Show("No click handler ?");
                        }


                        //e.Handled = true;
                        //e.SuppressKeyPress = true;


                        return(true);
                    }
                }
            }
            return(false);
        }
Esempio n. 3
0
        private static string a4gl_using_date(string fmt, string value)
        {
            DateTime d;

            // Value should always be in DBDATE format..
            d   = FGLUtils.getDate(value);
            fmt = fmt.Replace("mmmm", "MMMM");
            fmt = fmt.Replace("mmm", "MMM");
            fmt = fmt.Replace("mm", "MMM");
            return(d.ToString(fmt));

            /*
             * fmt = fmt.Replace("dddd", d.ToString("dddd"));
             * fmt = fmt.Replace("ddd", d.ToString("ddd"));
             * fmt = fmt.Replace("dd", d.ToString("dd"));
             * fmt = fmt.Replace("mmmm", d.ToString("MMMM"));
             * fmt = fmt.Replace("mmm", d.ToString("MMM"));
             * fmt = fmt.Replace("mm", d.ToString("MM"));
             * fmt = fmt.Replace("yyyy", d.ToString("yyyy"));
             * fmt = fmt.Replace("yy", d.ToString("yy"));
             *
             * fmt = fmt.Replace("DDDD", d.ToString("dddd"));
             * fmt = fmt.Replace("DDD", d.ToString("ddd"));
             * fmt = fmt.Replace("DD", d.ToString("dd"));
             * fmt = fmt.Replace("MMMM", d.ToString("MMMM"));
             * fmt = fmt.Replace("MMM", d.ToString("MMM"));
             * fmt = fmt.Replace("MM", d.ToString("MM"));
             * fmt = fmt.Replace("YYYY", d.ToString("yyyy"));
             * fmt = fmt.Replace("YY", d.ToString("yy"));
             *
             * return d.ToString(fmt);
             * */
        }
Esempio n. 4
0
        internal virtual void setKeyList(List <ONKEY_EVENT> keyList, List <ON_ACTION_EVENT> actionList, UIContext currContext, UIEventHandler _evtHandler)
        {
            string lastActionId;

            if (Action == "")
            {
                return;
            }
            if (Action == null)
            {
                return;
            }

            lastActionId = onActionID;

            onActionID = "";

            foreach (ONKEY_EVENT a in keyList)
            {
                int res;
                if (Int32.TryParse(a.KEY, out res))
                {
                    if (res == _fakeKeyId)
                    {
                        // The action is really a fake keypress...
                        onActionID = a.ID;
                        break;
                    }


                    if (res == FGLUtils.getKeyCodeFromKeyName(Action))
                    {
                        // The action is really a fake keypress...
                        onActionID = a.ID;
                        break;
                    }
                }
            }

            foreach (ON_ACTION_EVENT a in actionList)
            {
                if (a.ACTION.ToLower() == Action.ToLower())
                {
                    onActionID = a.ID;
                }
            }

            if (onActionID != "")
            {
                _onUIEvent = _evtHandler;
            }

            if (lastActionId != onActionID)
            {
                ContextTypeChanged();
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Copy the data from our 'Data' array into the cells on the datagrid..
        /// </summary>
        internal void syncData(int line, int nCols, string[,] Data)
        {
            //Data[,].Length;
            for (int a = 0; a < nCols; a++)
            {
                object o;

                o = this.Rows[line].Cells[a + 1];
                FGLUtils.setCellValue(this.Rows[line].Cells[a + 1], Data[line, a], 0);
            }
        }
Esempio n. 6
0
        private static string a4gl_using_date(string fmt, string value)
        {
            DateTime d;
            string   longStr = "                                               ";

            if (value == null)
            {
                fmt = longStr.Substring(0, fmt.Length);
                return(fmt);
            }
            if (value.Trim().Length == 0)
            {
                fmt = longStr.Substring(0, fmt.Length);
                return(fmt);
            }

            // Value should always be in DBDATE format..
            d   = FGLUtils.getDate(value);
            fmt = fmt.Replace("mmmm", "MMMM");
            fmt = fmt.Replace("mmm", "MMM");
            fmt = fmt.Replace("mm", "MMM");
            return(d.ToString(fmt));

            /*
             * fmt = fmt.Replace("dddd", d.ToString("dddd"));
             * fmt = fmt.Replace("ddd", d.ToString("ddd"));
             * fmt = fmt.Replace("dd", d.ToString("dd"));
             * fmt = fmt.Replace("mmmm", d.ToString("MMMM"));
             * fmt = fmt.Replace("mmm", d.ToString("MMM"));
             * fmt = fmt.Replace("mm", d.ToString("MM"));
             * fmt = fmt.Replace("yyyy", d.ToString("yyyy"));
             * fmt = fmt.Replace("yy", d.ToString("yy"));
             *
             * fmt = fmt.Replace("DDDD", d.ToString("dddd"));
             * fmt = fmt.Replace("DDD", d.ToString("ddd"));
             * fmt = fmt.Replace("DD", d.ToString("dd"));
             * fmt = fmt.Replace("MMMM", d.ToString("MMMM"));
             * fmt = fmt.Replace("MMM", d.ToString("MMM"));
             * fmt = fmt.Replace("MM", d.ToString("MM"));
             * fmt = fmt.Replace("YYYY", d.ToString("yyyy"));
             * fmt = fmt.Replace("YY", d.ToString("yy"));
             *
             * return d.ToString(fmt);
             * */
        }
        /*
         * override internal void setKeyList(List<ONKEY_EVENT> keyList, List<ON_ACTION_EVENT> actionList, UIContext currContext)
         * {
         *
         *  foreach (ONKEY_EVENT a in keyList)
         *  {
         *      if (Convert.ToInt32(a.KEY) == FGLUtils.getKeyCodeFromKeyName(Action))
         *      {
         *          // The action is really a fake keypress...
         *          onActionID = a.ID;
         *
         *
         *
         *          break;
         *      }
         *  }
         *
         * }
         */



        private void createWidget(ATTRIB thisAttribute, AubitDesktop.Xml.XMLForm.Matrix ma, int row, int index, int column, int rows, int columns, string widget, string config, int id, string tabcol, string action, int attributeNo, string incl)
        {
            this.SetWidget(thisAttribute, ma, row, index, column, rows, columns, widget, config, id, tabcol, action, attributeNo, incl);
            pb = new PictureBox();

            #region SetImageFromFile
            if (configSettings.ContainsKey("FILENAME"))
            {
                string dir;
                Image  obj; // NOTWEBGUI
                //WEBGUI Gizmox.WebGUI.Common.Resources.ResourceHandle obj;

                obj = FGLUtils.getImageFromName((string)configSettings["FILENAME"]);
                //pb.BackColor = Color.AliceBlue;


                if (obj != null)
                {
                    pb.Image = obj;
                }
                else
                {
                    dir = "c:/images"; //Properties.  Resources.ImageDirectory;
                    if (!dir.EndsWith("/") && !dir.EndsWith("\\"))
                    {
                        dir = dir + "/";
                    }
                    try
                    {
                        pb.Load(dir + "/" + (string)configSettings["FILENAME"]);
                    }
                    catch (Exception)
                    {
                        ;
                    }
                }
                ContextTypeChanged();
            }
            #endregion

            SizeControl(ma, index, pb);
            pb.SizeMode = PictureBoxSizeMode.StretchImage;
            pb.Visible  = true;
            pb.Location = GuiLayout.getPoint(ma, index, column - 1, row);
        }
Esempio n. 8
0
        internal void FormattedGridView_DefaultValuesNeeded(object sender, DataGridViewRowEventArgs e)
        {
            e.Row.Cells[0].Value = "XXX"; // First column was to hold the subscript - but its currently not used....


            for (int a = 0; a < table.TableColumn.Length; a++)
            {
                if (table.TableColumn[a].defaultValue != null && table.TableColumn[a].defaultValue != "")
                {
                    FGLUtils.setCellValue(e.Row.Cells[a + 1], table.TableColumn[a].defaultValue, 0);
                    //e.Row.Cells[a+1].Value=table.TableColumn[a].defaultValue;
                }
                else
                {
                    FGLUtils.setCellValue(e.Row.Cells[a + 1], "", 0);
                }
            }
            EndEdit();
        }
Esempio n. 9
0
        public FGLRadioFieldWidget(AubitDesktop.Xml.XMLForm.FormField ffx, AubitDesktop.Xml.XMLForm.RipRADIO cbox, string config, int index, AubitDesktop.Xml.XMLForm.Matrix ma)
        {
            AubitDesktop.Xml.XMLForm.Radio cnew;
            cnew = new AubitDesktop.Xml.XMLForm.Radio();


            cnew.action      = cbox.action;
            cnew.autoNext    = cbox.autoNext;
            cnew.comments    = cbox.comments;
            cnew.config      = cbox.config;
            cnew.format      = cbox.format;
            cnew.gridWidth   = cbox.gridWidth;
            cnew.posX        = cbox.posX;
            cnew.posY        = cbox.posY;
            cnew.shift       = cbox.shift;
            cnew.width       = cbox.width;
            cnew.pixelHeight = cbox.pixelHeight;
            cnew.pixelWidth  = cbox.pixelWidth;
            List <string> items = FGLUtils.splitConfig(config);

            if (items.Count == 0)
            {
                cnew.Items = new AubitDesktop.Xml.XMLForm.Item[0];
            }
            else
            {
                int b = 0;
                cnew.Items = new AubitDesktop.Xml.XMLForm.Item[(items.Count + 1) / 2];
                for (int a = 0; a < cnew.Items.Length; a++)
                {
                    cnew.Items[a]      = new AubitDesktop.Xml.XMLForm.Item();
                    cnew.Items[a].name = items[b++];
                    if (b < items.Count)
                    {
                        cnew.Items[a].text = items[b++];
                    }
                }
            }

            makeRadio(ffx, cnew, config, index, ma);
        }
Esempio n. 10
0
 private void AubitMessageBox_Load(object sender, EventArgs e)
 {
     lbltext.Text = winQuestion.TEXT;
     this.Text    = winQuestion.TITLE;
     if (winQuestion.ICON != "")
     {
         this.lblPb.Image = FGLUtils.getImageFromName(winQuestion.ICON);
     }
     string[] s = winQuestion.POS.Split('|');
     for (int a = 0; a < s.Length; a++)
     {
         Button b;
         b        = new Button();
         b.Text   = s[a];
         b.Click += new EventHandler(b_Click);
         if (s[a] == winQuestion.DEFAULT)
         {
             b.Select();
         }
         buttonBox.Controls.Add(b);
     }
 }
Esempio n. 11
0
        getConstructString(string colName, string val, FGLUtils.FGLDataTypes dtype, int dtype_size)
        {
            //int a;
            string quote = "";
            bool   allow_range_character = true;
            string colname;

            allow_range_character = true;
            int inc_quotes = 0;

            if (val == null || val.Trim() == "")
            {
                return(""); // Ignore it !
            }

            if (dtype == FGLUtils.FGLDataTypes.DTYPE_CHAR || dtype == FGLUtils.FGLDataTypes.DTYPE_NCHAR || dtype == FGLUtils.FGLDataTypes.DTYPE_VCHAR)
            {
                inc_quotes = 1;
            }
            if (dtype == FGLUtils.FGLDataTypes.DTYPE_DATE)
            {
                inc_quotes = 2;
            }
            if (dtype == FGLUtils.FGLDataTypes.DTYPE_DTIME)
            {
                inc_quotes = 3;
            }
            if (dtype == FGLUtils.FGLDataTypes.DTYPE_INTERVAL)
            {
                inc_quotes = 4;
            }

            if (inc_quotes > 0)
            {
                quote = "'";
            }

            colname = colName;
            if (colname.StartsWith("."))
            {
                colname = colname.Substring(1);
            }


            if (inc_quotes == 3 || inc_quotes == 4)
            {
                if (dtype == FGLUtils.FGLDataTypes.DTYPE_DTIME)
                {
                    string p;
                    int    a;
                    // DATETIME RANGE KLUDGE
                    // one problem we have is if we have a datetime - and a range
                    //
                    // Lets figure out how long out datetime should be
                    // Quick and dirty way is to measure the length of
                    // a 'CURRENT' with the same dimensions...

                    p = String.Format(FGLUtils.formatForDatetime(dtype_size >> 4, dtype_size & 0xf));

                    if (p.Contains(":"))
                    {
                        // Darn - it contains a ':' - so we cant use this as a range character
                        allow_range_character = false;
                    }
                    else
                    {
                        allow_range_character = true;
                    }
                    a = p.Length;


                    if (allow_range_character == false)
                    {
                        // Special case - imagine HH:MM  to HH:MM
                        // We can use the specific size to check for HH:MM:HH:MM

                        if (val.Length > a)
                        {
                            // its a candidate..
                            if (val.Substring(a) == ":")
                            {
                                val = val.Substring(0, a - 1) + ".." + val.Substring(a + 1);
                            }
                        }
                    }
                }
            }



            string[] entries = val.Split('|');

            List <string> srch;

            srch = new List <string>();

            foreach (string v_e in entries)
            {
                string v;
                v = v_e.Trim();


                if (v == "=" || v == "=''")
                {
                    srch.Add("is null");
                    continue;
                }

                if (v == "!=" || v == "<>" || v == "<>''" || v == "!=''")
                {
                    srch.Add(colname + " is not null");
                    continue;
                }

                if (v.StartsWith(".."))
                {                           // We allow ..X and X.. to be <=X and >=X
                    v = "<=" + val.Substring(2);
                }

                if (v.StartsWith(":"))
                {
                    // We allow ..X and X.. to be <=X and >=X
                    v = "<=" + val.Substring(2);
                }

                if (v.EndsWith(".."))
                {                           // We allow ..X and X.. to be <=X and >=X
                    v = ">=" + val.Substring(2);
                }

                if (v.EndsWith(":"))
                {
                    // We allow ..X and X.. to be <=X and >=X
                    v = ">=" + val.Substring(2);
                }



                if (v.Contains(".."))
                {
                    string[] splt;
                    splt    = new string[1];
                    splt[0] = "..";
                    string[] range = v.Split(splt, StringSplitOptions.None);
                    if (range.Length != 2)
                    {
                        return(null);
                    }
                    else
                    {
                        if (!isConstructValueValid(dtype, dtype_size, range[0]))
                        {
                            return(null);
                        }
                        if (!isConstructValueValid(dtype, dtype_size, range[1]))
                        {
                            return(null);
                        }
                        srch.Add(colname + " between " + quoteEscape(range[0], quote) + " and " + quoteEscape(range[1], quote));
                    }
                }

                if (allow_range_character && v.Contains(":"))
                {
                    string[] splt;
                    splt    = new string[1];
                    splt[0] = ":";
                    string[] range = v.Split(splt, StringSplitOptions.None);
                    if (range.Length != 2)
                    {
                        return(null);
                    }
                    else
                    {
                        if (!isConstructValueValid(dtype, dtype_size, range[0]))
                        {
                            return(null);
                        }
                        if (!isConstructValueValid(dtype, dtype_size, range[1]))
                        {
                            return(null);
                        }
                        srch.Add(colname + " between " + quoteEscape(range[0], quote) + " and " + quoteEscape(range[1], quote));
                    }
                }


                if (v.StartsWith(">="))
                {
                    if (!isConstructValueValid(dtype, dtype_size, v.Substring(2)))
                    {
                        return(null);
                    }
                    srch.Add(colname + ">=" + quoteEscape(v.Substring(2), quote));
                }

                if (v.StartsWith("<="))
                {
                    if (!isConstructValueValid(dtype, dtype_size, v.Substring(2)))
                    {
                        return(null);
                    }
                    srch.Add(colname + "<=" + quoteEscape(v.Substring(2), quote));
                }

                if (v.StartsWith("<>") || v.StartsWith("!="))
                {
                    if (!isConstructValueValid(dtype, dtype_size, v.Substring(2)))
                    {
                        return(null);
                    }

                    srch.Add(colname + "!=" + quoteEscape(v.Substring(2), quote));
                }

                if (v.StartsWith("=="))
                {
                    if (!isConstructValueValid(dtype, dtype_size, v.Substring(2)))
                    {
                        return(null);
                    }

                    srch.Add(colname + "=" + quoteEscape(v.Substring(2), quote));
                }

                if (v.StartsWith("="))
                {
                    if (!isConstructValueValid(dtype, dtype_size, v.Substring(1)))
                    {
                        return(null);
                    }
                    srch.Add(colname + "=" + quoteEscape(v.Substring(1), quote));
                }

                if (v.StartsWith(">"))
                {
                    if (!isConstructValueValid(dtype, dtype_size, v.Substring(1)))
                    {
                        return(null);
                    }
                    srch.Add(colname + ">" + quoteEscape(v.Substring(1), quote));
                }
                if (v.StartsWith("<"))
                {
                    if (!isConstructValueValid(dtype, dtype_size, v.Substring(1)))
                    {
                        return(null);
                    }
                    srch.Add(colname + "<" + quoteEscape(v.Substring(1), quote));
                }


                // Drop through to an "=" ...
                if (!isConstructValueValid(dtype, dtype_size, v))
                {
                    return(null);
                }
                srch.Add(colname + "=" + quoteEscape(v, quote));
            }

            if (srch.Count == 0)
            {
                return("");
            }
            if (srch.Count == 1)
            {
                return(srch[0]);
            }
            string rval = "";

            foreach (string s in srch)
            {
                if (rval == "")
                {
                    rval = "(" + s + ")";
                }
                else
                {
                    rval += " OR (" + s + ")";
                }
            }
            return(rval);
        }
Esempio n. 12
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();
        }
Esempio n. 13
0
        internal bool validateField()
        {
            if (this._ContextType == FGLContextType.ContextConstruct)
            {
                if (FGLConstruct.getConstructString(constructName, Text, this.datatype, this.datatype_length) == null)
                {
                    bool ign = false;
                    this.fieldValidationFailed(this, "FIELD_CONSTR_EXPR", out ign);

                    if (!ign)
                    {
                        return(false);
                    }
                }
                return(true);
            }

            if (this._ContextType == FGLContextType.ContextInput || this._ContextType == FGLContextType.ContextInputArray)
            {
                bool ign = false;
                #region REQUIRED CHECK
                if (this.Required)
                {
                    if (Text.Length == 0)
                    {
                        if (this.fieldValidationFailed != null)
                        {
                            this.fieldValidationFailed(this, "FIELD_REQD_MSG", out ign);
                        }
                        if (!ign)
                        {
                            return(false);
                        }
                    }
                }
                #endregion
                #region Datatype Check
                if (!FGLUtils.IsValidForType(this.datatype, Text, this.format, this.datatype_length))
                {
                    if (this.fieldValidationFailed != null)
                    {
                        this.fieldValidationFailed(this, "FIELD_ERROR_MSG", out ign);
                    }
                    if (!ign)
                    {
                        return(false);
                    }
                }
                #endregion
                #region Include value check
                if (this.includeValues != null)
                {
                    bool ok = false;
                    foreach (string s in this.includeValues)
                    {
                        if (s.Contains(":"))
                        {
                            string   l, r;
                            string[] arr;
                            arr = s.Split(':');
                            l   = arr[0];
                            r   = arr[1];

                            if (FGLUtils.compare_range(this.Text, l, r, this.datatype, this.datatype_length, this.format))
                            {
                                ok = true;
                            }
                        }
                        else
                        {
                            if (s == "NULL" && this.Text == "")
                            {
                                ok = true;
                                break;
                            }
                            if (s == this.Text)
                            {
                                ok = true;
                                break;
                            }
                        }
                    }

                    ign = false;
                    if (!ok)
                    {
                        this.fieldValidationFailed(this, "FIELD_INCL_MSG", out ign);


                        if (!ign)
                        {
                            return(false);
                        }
                    }
                }
                #endregion
            }



            return(true);
        }
Esempio n. 14
0
        private void createTextWidget(ATTRIB thisAttribute, AubitDesktop.Xml.XMLForm.Matrix ma, int row, int index, int column, int rows, int columns, string widget, string config, int id, string tabcol, string action, int attributeNo, string incl, bool buttonEdit, string buttonImage)
        {
            int bcol       = 0;
            int totalWidth = 0;

            this.SetWidget(thisAttribute, ma, row, index, column, rows, columns, widget, config, id, tabcol, action, attributeNo, incl);

            p = new Panel();
            //lblInsteadOfTxtBox = new Label();
            p.BorderStyle = BorderStyle.None;

            /*
             * if (rows > 1)
             * {
             *  lblInsteadOfTxtBox.TextAlign = ContentAlignment.TopLeft;
             * }
             * else
             * {
             *  lblInsteadOfTxtBox.TextAlign = ContentAlignment.MiddleLeft;
             * } */

            t = new System.Windows.Forms.TextBox();
            if (thisAttribute.ATTRIB_INVISIBLE != null)
            {
                t.PasswordChar = '*';
            }

            p.Margin  = new Padding(0, 0, 0, 0);
            p.Padding = new Padding(0, 0, 0, 0);
            // lblInsteadOfTxtBox.Margin = new Padding(0, 0, 0, 0);
            //lblInsteadOfTxtBox.Padding = new Padding(0, 0, 0, 0);
            t.Margin  = new Padding(0, 0, 0, 0);
            t.Padding = new Padding(0, 0, 0, 0);

            p.Name = "TWP_" + tabcol;
            t.Name = "TWT_" + tabcol;
            // lblInsteadOfTxtBox.Name = "TWL_" + tabcol;

            if (buttonEdit)
            {
                if (configSettings["BUTTONWIDTH"] != null)
                {
                    bcol = Convert.ToInt32((string)configSettings["BUTTONWIDTH"]);
                }
                else
                {
                    bcol = 1;
                }
            }



            t.Visible = true;
            t.Enabled = true;
            SizeControl(ma, index, p);
            if (bcol > 0)
            {
                p.Size = new Size(GuiLayout.get_gui_w(columns + bcol + 1) + 5, GuiLayout.get_gui_h(rows));
            }


            if (rows > 1)
            {
                t.Multiline = true;
            }
            else
            {
                t.Multiline = false;
            }



            // Any columns used for the button must be subtracted from the length of the
            // textbox..

            // t.Size = new Size(GuiLayout.get_gui_w(columns), GuiLayout.get_gui_h(rows));
            //l.Size = new Size(GuiLayout.get_gui_w(columns), GuiLayout.get_gui_h(rows));

            t.Height = GuiLayout.get_gui_h(rows);


            if (columns > 2 || true)
            {
                totalWidth = GuiLayout.get_gui_w(columns + 1);
            }
            else
            {
                totalWidth = GuiLayout.get_gui_w(4);
            }

            if (rows == 1)
            {
                this.MaxLength = columns;
            }
            else
            {
                this.MaxLength = columns * rows;
            }


            if (Upshift)
            {
                t.CharacterCasing = CharacterCasing.Upper;
            }

            if (Downshift)
            {
                t.CharacterCasing = CharacterCasing.Lower;
            }


            if (false)
            {
                // lblInsteadOfTxtBox.Visible = true;
                // lblInsteadOfTxtBox.BorderStyle = BorderStyle.Fixed3D;
            }

            if (buttonEdit)
            {
                b         = new Button();
                b.TabStop = false;
                if (configSettings["TEXT"] != null)
                {
                    b.Text = (string)configSettings["TEXT"];
                }
                else
                {
                    b.Text = "!";
                }

                //b.Size = new Size(GuiLayout.get_gui_w(bcol), GuiLayout.get_gui_h(rows)-4);
                b.Top = 0;

                if (bcol > 0)
                {
                    //reservedButtonWidth = bcol;
                    b.Width = GuiLayout.get_gui_w(bcol);     //NOTWEBGUI
                    //WEBGUI b.Size = new System.Drawing.Size( GuiLayout.get_gui_w(bcol+1),  GuiLayout.get_gui_h(1));
                }
                else
                {
                    //reservedButtonWidth = 1;
                    b.Width = GuiLayout.get_gui_w(1); //NOTWEBGUI
                    //WEBGUI b.Size = new System.Drawing.Size( GuiLayout.get_gui_w(2),  GuiLayout.get_gui_h(1));
                }

                if (configSettings["IMAGE"] == null)
                {
                    //WEBGUI b.Image = FGLUtils.getImageFromName("zoom.png");
                    b.Image = FGLUtils.getImageFromName("zoom"); //NOTWEBGUI
                }
                else
                {
                    b.Image = FGLUtils.getImageFromName((string)configSettings["IMAGE"]);
                }


                b.Height = b.Image.Height + 4;  // NOTWEBGUI
                b.Width  = b.Image.Width + 4;   // NOTWEBGUI
                if (b.Image.Height > t.Height)  // NOTWEBGUI
                {                               // NOTWEBGUI
                    b.Height = t.Height;        // NOTWEBGUI
                }                               // NOTWEBGUI


                if (bcol > 0)
                {
                    t.Width = totalWidth; // -(GuiLayout.get_gui_w(bcol) + 5);
                    b.Left  = totalWidth; // -b.Width;
                }
                else
                {
                    t.Width = totalWidth; //-(b.Width +5);
                    b.Left  = totalWidth; // -b.Width;
                }

                //b.Left = GuiLayout.get_gui_x(column) ;     /* thats 2 pixels - not 2 characters */
                b.Visible = true;
            }
            else
            {
                b       = null;
                t.Width = totalWidth;
            }
            p.Height = GuiLayout.get_gui_h(rows);
            // lblInsteadOfTxtBox.Left = 0;
            //lblInsteadOfTxtBox.Top = 0;
            //lblInsteadOfTxtBox.Size = t.Size;
            p.Controls.Add(t);
            // p.Controls.Add(lblInsteadOfTxtBox);
            p.AutoSize = true; //NOTWEBGUI
            if (b != null)
            {
                p.Controls.Add(b);
            }

            // p.Size = l.Size;

            t.CausesValidation = true;
            //t.KeyDown += new KeyEventHandler(t_KeyDown);
            t.KeyPress    += new KeyPressEventHandler(t_KeyPress);
            t.Validating  += new System.ComponentModel.CancelEventHandler(t_Validating);
            t.Enter       += new EventHandler(t_GotFocus);
            t.TextChanged += new EventHandler(t_TextChanged);

            // EventHandler moveNext = new EventHandler(TheMethod);

            //t.Validating += new System.ComponentModel.CancelEventHandler(t_Validating);
            if (b != null)
            {
                b.Click += new EventHandler(t_Click);
            }
            else
            {
                t.Click += new EventHandler(t_Click);
            }
            t.ReadOnly = true;
            t.Visible  = true;

            this.id          = id;
            this.ContextType = FGLContextType.ContextNone;
            adjustDisplayPropertiesForContext();
        }
        //  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();
        }
        public string getSyncValues()
        {
            string s;

            s = "<SVS>";

//            constructGrid.syncData(0,

            for (int a = 1; a < this.constructGrid.Columns.Count; a++)
            {
                dt.Rows[0].EndEdit();
                //FGLFoundField i=activeFields[a];
                if (isFieldForConstruct(a))
                {
                    s += "<SV FN=\"" + constructGrid.getFieldName(a - 1) + "\">" + System.Security.SecurityElement.Escape(FGLUtils.GetString(constructGrid.Rows[0].Cells[a].EditedFormattedValue)) + "</SV>";
                }
            }

            s += "</SVS>";
            return(s);
        }
Esempio n. 17
0
 private void showInterruptKeycode()
 {
     lblKeyCode.Text = FGLUtils.getKeyCodeFromKeyName(tbInterruptKey.Text).ToString();
 }
Esempio n. 18
0
        private bool handleKeyPress(KeyEventArgs e)
        {
            string key = "";

            int    keycode;
            string rkey = "";

            key = FGLUtils.decodeKeycode(e.Control, e.Shift, e.Alt, e.KeyCode);
            if (key == null)
            {
                Console.WriteLine("Key : " + getWindowsKey(e.Control, e.Shift, e.Alt, key));
            }
            else
            {
                Console.WriteLine("Key : " + getWindowsKey(e.Control, e.Shift, e.Alt, key));
            }
            if (key == null)
            {
                return(false);
            }

            if (key == "ControlKey")
            {
                return(false);
            }
            if (key == "ShiftKey")
            {
                return(false);
            }



            if (scanApplicationLauncherForKey(getWindowsKey(e.Control, e.Shift, e.Alt, key)))
            {
                return(true);
            }


            keycode = FGLUtils.getKeyCodeFromKeyName(key);
            string acceptKey = getCurrentApplicationKey("ACCEPT", "Escape");
            string insertKey = getCurrentApplicationKey("INSERT", "F1");
            string deleteKey = getCurrentApplicationKey("DELETE", "F2");


            if (FGLUtils.getKeyCodeFromKeyName(key) == FGLUtils.getKeyCodeFromKeyName(Program.AppSettings.interruptKey))
            {
                rkey = "INTERRUPT";
            }

            if (FGLUtils.getKeyCodeFromKeyName(key) == FGLUtils.getKeyCodeFromKeyName(getCurrentApplicationKey("ACCEPT", "Escape")))
            {
                rkey = "ACCEPT";
            }

            if (FGLUtils.getKeyCodeFromKeyName(key) == FGLUtils.getKeyCodeFromKeyName(getCurrentApplicationKey("INSERT", "F1")))
            {
                rkey = "INSERT";
            }
            if (FGLUtils.getKeyCodeFromKeyName(key) == FGLUtils.getKeyCodeFromKeyName(getCurrentApplicationKey("DELETE", "F2")))
            {
                rkey = "DELETE";
            }


            if (key == null)
            {
                return(false);
            }



            setLastKeyInApplication(key);


            this.ErrorText = "";

            // Check for an explicit key name..
            if (CheckForToolStripKey(e, getWindowsKey(e.Control, e.Shift, e.Alt, key), getWindowsKey(e.Control, e.Shift, e.Alt, key)))
            {
                return(true);
            }


            if (rkey != "")
            {
                // Check for a 4GL key name (insert, delete, accept, escape etc)
                if (CheckForToolStripKey(e, rkey, null))
                {
                    return(true);
                }
            }


            // Key wasnt found...


            if (currentContext != null)
            {
                // currentContext.keyPreview(e,rkey);
                if (currentContext.useKeyPress(e))
                {
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 19
0
        private void createTextWidget(ATTRIB thisAttribute, AubitDesktop.Xml.XMLForm.Matrix ma, int row, int index, int column, int rows, int columns, string widget, string config, int id, string tabcol, string action, int attributeNo, string incl, bool buttonEdit, string buttonImage)
        {
            int bcol = 0;

            this.SetWidget(thisAttribute, ma, row, index, column, rows, columns, widget, config, id, tabcol, action, attributeNo, incl);

            p = new Panel();

            p.BorderStyle = BorderStyle.Fixed3D;

            tNullable              = new NullableDateTimePicker();
            tNullable.Format       = DateTimePickerFormat.Custom;
            tNullable.CustomFormat = FGLUtils.DBDATEFormat_dotnet;
            tNullable.Visible      = true;
            tNullable.Enabled      = true;


            p.Margin  = new Padding(0, 0, 0, 0);
            p.Padding = new Padding(0, 0, 0, 0);

            tNullable.Margin  = new Padding(0, 0, 0, 0);
            tNullable.Padding = new Padding(0, 0, 0, 0);


            tNullable.Visible = true;
            tNullable.Enabled = true;
            tNullable.Value   = null;
            SizeControl(ma, index, p);
            //p.Location = new System.Drawing.Point(GuiLayout.get_gui_x(column), GuiLayout.get_gui_y(row));
            p.AutoSize     = true;
            p.Name         = "DTPP_" + tabcol;
            tNullable.Name = "DTPT_" + tabcol;

            //t.BackColor = Color.Red;
            //l.BackColor = Color.Blue;



            // Any columns used for the button must be subtracted from the length of the
            // textbox..

            tNullable.Size = new Size(GuiLayout.get_gui_w(columns - bcol), GuiLayout.get_gui_h(rows));

            p.Size = new Size(GuiLayout.get_gui_w(columns), GuiLayout.get_gui_h(rows));



            if (columns > 2)
            {
                tNullable.Width = GuiLayout.get_gui_w(columns + 1);
            }
            else
            {
                tNullable.Width = GuiLayout.get_gui_w(3);
            }


            //t.KeyDown += new KeyEventHandler(t_KeyDown);
            //t.KeyPress += new KeyPressEventHandler(t_KeyPress);



            if (buttonEdit)
            {
                b         = new Button();
                b.TabStop = false;
                if (configSettings["TEXT"] != null)
                {
                    b.Text = (string)configSettings["TEXT"];
                }
                else
                {
                    b.Text = "!";
                }

                b.Size = new Size(GuiLayout.get_gui_w(bcol), GuiLayout.get_gui_h(rows) - 4);
                b.Top  = 0;
                if (configSettings["IMAGE"] == null)
                {
                    b.Image = FGLUtils.getImageFromName("zoom");
                }
                else
                {
                    b.Image = FGLUtils.getImageFromName((string)configSettings["IMAGE"]);
                }

                b.Left = tNullable.Width + 1;
                //b.Left = GuiLayout.get_gui_x(column) ;     /* thats 2 pixels - not 2 characters */
                b.Visible = true;
            }
            else
            {
                b = null;
            }

            p.Controls.Add(tNullable);

            if (b != null)
            {
                p.Controls.Add(b);
            }

            // p.Size = l.Size;

            tNullable.CausesValidation = true;
            tNullable.KeyDown         += new KeyEventHandler(t_KeyDown);
            tNullable.KeyPress        += new KeyPressEventHandler(t_KeyPress);
            tNullable.Validating      += new System.ComponentModel.CancelEventHandler(t_Validating);
            tNullable.Enter           += new EventHandler(t_GotFocus);
            tNullable.TextChanged     += new EventHandler(t_TextChanged);
            //t.Validating += new System.ComponentModel.CancelEventHandler(t_Validating);
            if (b != null)
            {
                b.Click += new EventHandler(t_Click);
            }
            else
            {
                tNullable.Click += new EventHandler(t_Click);
            }
            tNullable.Visible = true;

            this.id          = id;
            this.ContextType = FGLContextType.ContextNone;

            adjustDisplayPropertiesForContext();
        }
Esempio n. 20
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"));
            }
        }
Esempio n. 21
0
        public string getSyncValues()
        {
            string s;
            string subscript_string;
            int    row;



            //  Data.AcceptChanges();

            // Originally - I used the DataTable - but that just doesn't sync properly
            // I'm only using that at all because otherwise the autoinsert new row
            // doesn't seem to work..
            //
            // Basically - the DataGridView isn't being very helpful...
            //
            s = "\n<SYNCROWS>\n";

            for (row = 0; row < inputArrayGrid.Rows.Count; row++)
            {
                string rowData;
                subscript_string = "" + (row + 1);
                if (row >= maxRows)
                {
                    continue;
                }

                rowData  = " <ROW SUBSCRIPT=\"" + subscript_string + "\">\n";
                rowData += "  <SVS>\n";

                for (int col = 0; col < this.nCols; col++)
                {
                    string           rval = "";
                    DataGridViewCell c    = inputArrayGrid.Rows[row].Cells[col + 1];

                    if (c.IsInEditMode)
                    {
                        // We're still in edit mode - so its probably a ON KEY - so set the fldbuf values..
                        if (c.EditedFormattedValue is DBNull)
                        {
                            rval = "";
                        }
                        else
                        {
                            if (c.FormattedValueType == typeof(Boolean))
                            {
                                DataGridViewCheckBoxCell ch;
                                ch = (DataGridViewCheckBoxCell)c;
                                if (ch.EditedFormattedValue == null)
                                {
                                    s = null;
                                }
                                if (c.EditedFormattedValue is string)
                                {
                                    rval = (string)c.EditedFormattedValue;
                                }
                                else
                                {
                                    if ((Boolean)c.EditedFormattedValue)
                                    {
                                        rval = (string)ch.TrueValue;
                                    }
                                    else
                                    {
                                        rval = (string)ch.FalseValue;
                                    }
                                }
                            }

                            else
                            {
                                rval = FGLUtils.GetString(inputArrayGrid.Rows[row].Cells[col + 1].EditedFormattedValue);   // Data.Rows[row][col + 1];
                            }
                        }
                    }
                    else
                    {
                        if (c.Value is DBNull)
                        {
                            rval = "";
                        }
                        else
                        {
                            rval = FGLUtils.GetString(inputArrayGrid.Rows[row].Cells[col + 1].Value);   // Data.Rows[row][col + 1];
                        }
                    }


                    //   inputArrayGrid.getFieldName

                    if (inputArrayGrid.getDataType(col + 1) == "DTYPE_DECIMAL" || inputArrayGrid.getDataType(col + 1) == "DTYPE_MONEY" ||
                        inputArrayGrid.getDataType(col + 1) == "DTYPE_FLOAT" || inputArrayGrid.getDataType(col + 1) == "DTYPE_SMFLOAT")
                    {
                        if (Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator != ".")
                        {
                            // The protocol should always use "." as the separator...
                            string convert_value;
                            try
                            {
                                convert_value = rval.Replace(Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator, ".");
                                rval          = convert_value;
                            }
                            catch
                            {
                            }
                        }
                    }

                    rowData += "   <SV FN=\"" + inputArrayGrid.getFieldName(col) + "\">" + System.Security.SecurityElement.Escape(rval) + "</SV>\n";
                }

                rowData += "  </SVS>\n";
                rowData += " </ROW>\n";
                if (lastRowData[row] != rowData) // We might want to do this every time
                {                                // Is it different to last time ?
                    lastRowData[row] = rowData;
                    s += rowData;
                }
            }

            s += "</SYNCROWS>\n";



            return(s);
        }
Esempio n. 22
0
        private bool validateField(int row, int col, string Text)
        {
            bool ign = false;
            FormattedCellSettings w;

            //FGLWidget w = null;
            if (col == 0)
            {
                return(true);
            }
            if (movingCellsInternally > 0)
            {
                return(true);
            }


            w = widgetSettings[col - 1];
            if (w == null)
            {
                return(true);
            }

            // Text = getCellData(row, col);


            if (this.context == FGLContextType.ContextInputArray)
            {
                #region REQUIRED CHECK
                if (w.Required)
                {
                    if (Text.Length == 0)
                    {
                        if (fieldValidationFailed != null)
                        {
                            fieldValidationFailed(w, "FIELD_REQD_MSG", out ign);
                        }
                        if (!ign)
                        {
                            return(false);
                        }
                    }
                }
                #endregion
                #region Datatype Check
                if (!FGLUtils.IsValidForType(w.datatype, Text, w.format, w.datatype_length))
                {
                    if (fieldValidationFailed != null)
                    {
                        fieldValidationFailed(w, "FIELD_ERROR_MSG", out ign);
                    }
                    if (!ign)
                    {
                        return(false);
                    }
                }
                #endregion
                #region Include value check
                if (w.includeValues != null)
                {
                    bool ok = false;
                    foreach (string s in w.includeValues)
                    {
                        if (s.Contains(":"))
                        {
                            string   l, r;
                            string[] arr;
                            arr = s.Split(':');
                            l   = arr[0];
                            r   = arr[1];

                            if (FGLUtils.compare_range(Text, l, r, w.datatype, w.datatype_length, w.format))
                            {
                                ok = true;
                            }
                        }
                        else
                        {
                            if (s == "NULL" && Text == "")
                            {
                                ok = true;
                                break;
                            }
                            if (s == Text)
                            {
                                ok = true;
                                break;
                            }
                        }
                    }

                    ign = false;
                    if (!ok)
                    {
                        fieldValidationFailed(w, "FIELD_INCL_MSG", out ign);


                        if (!ign)
                        {
                            return(false);
                        }
                    }
                }
                #endregion
            }



            return(true);
        }
Esempio n. 23
0
 private static bool isConstructValueValid(FGLUtils.FGLDataTypes dtype, int dtype_size, string p)
 {
     return(FGLUtils.IsValidForType(dtype, p, null, dtype_size));
 }
Esempio n. 24
0
 internal void SetToolbarImage(AubitTSBtn btn, ADDTOTOOLBAR o)
 {
     btn.Image = FGLUtils.getImageFromName(o.IMAGE);
     //throw new NotImplementedException();
 }
Esempio n. 25
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;
                }
            }
        }
        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++];
                }
            }
        }
        private void createComboBoxWidget(ATTRIB thisAttribute, AubitDesktop.Xml.XMLForm.Matrix ma, int row, int index, int column, int rows, int columns, string widget, string config, int id, string tabcol, string action, int attributeNo, string incl, string txt)
        {
            this.SetWidget(thisAttribute, ma, row, index, column, rows, columns, widget, config, id, tabcol, action, attributeNo, incl);

            p  = new Panel();
            l  = new Label();
            pb = new Button();
            t  = new Gizmox.WebGUI.Forms.TextBox();

            l.TextAlign = ContentAlignment.MiddleLeft;

            onActionID = "";


            string[] str = config.Split(' ');

            fakeKeyId = -1;
            if (str.Length == 2)
            {
                Gizmox.WebGUI.Common.Resources.ResourceHandle i;
                i = FGLWebUtils.getImageFromName(str[0]);
                if (i == null)
                {
                    i = FGLWebUtils.getImageFromName("zoom");
                }
                if (i != null)
                {
                    //pb.AutoSize = true;
                    pb.Image = i;

                    pb.AutoSizeMode = AutoSizeMode.GrowAndShrink; pb.AutoSize = true;
                    fakeKeyId       = FGLUtils.getKeyCodeFromKeyName(str[1]);
                }
            }

            if (txt != null && txt.Length > 0)
            {
                pb.Text = txt;
            }
            if (str.Length == 1)
            {
                Gizmox.WebGUI.Common.Resources.ResourceHandle i;

                i = FGLWebUtils.getImageFromName("zoom");
                if (i != null)
                {
                    pb.Image = i;
                }
                fakeKeyId = FGLUtils.getKeyCodeFromKeyName(str[0]);
            }

            pb.Click += new EventHandler(pb_Click);

            pb.Dock = DockStyle.Right;

            pb.Margin  = new Padding(0, 0, 0, 0);
            pb.Padding = new Padding(0, 0, 0, 0);
            p.Margin   = new Padding(0, 0, 0, 0);
            p.Padding  = new Padding(0, 0, 0, 0);
            l.Margin   = new Padding(0, 0, 0, 0);
            l.Padding  = new Padding(0, 0, 0, 0);
            t.Margin   = new Padding(0, 0, 0, 0);
            t.Padding  = new Padding(0, 0, 0, 0);
            t.Visible  = true;
            t.Enabled  = true;
            pb.Visible = true;
            pb.TabStop = false;
            SizeControl(ma, index, p);

            t.Height = p.Size.Height;
            t.Width  = p.Size.Width - pb.Width;


            t.TextChanged += new EventHandler(t_TextChanged);

            // Any columns used for the button must be subtracted from the length of the
            // textbox..

/*
 *          if (columns > 2)
 *          {
 *              p.Width = GuiLayout.get_gui_w(columns + 1);
 *          }
 *          else
 *          {
 *              p.Width = GuiLayout.get_gui_w(3);
 *          }
 */

            t.MaxLength = columns;


            l.Size = t.Size;


            l.BorderStyle = BorderStyle.Fixed3D;
            // l.Dock = DockStyle.Fill;


            p.Controls.Add(t);
            p.Controls.Add(l);
            p.Controls.Add(pb);



            // p.Size = l.Size;


            t.GotFocus += new EventHandler(t_GotFocus);
            //t.Click += new EventHandler(t_Click);


            this.id = id;
            adjustDisplayPropertiesForContext();
        }
Esempio n. 28
0
 private void tbInterruptKey_TextChanged(object sender, EventArgs e)
 {
     lblKeyCode.Text = FGLUtils.getKeyCodeFromKeyName(tbInterruptKey.Text).ToString();
 }
Esempio n. 29
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
            {
            }
        }