public void setNextField(string fieldName) { bool found = false; foreach (FGLFoundField f in activeFields) { if (found && f.fglField.NoEntry == false) { setCurrentField = f; break; } if (f.isField(fieldName)) { if (f.fglField.NoEntry == false) { setCurrentField = f; break; } else { found = true; } } } PendingEvents.Clear(); }
public void setNextField(string fieldName) { bool found = false; // lastFiredBeforeField = null; // isnextfield = true; foreach (FGLFoundField f in activeFields) { if (found && f.fglField.NoEntry == false) { setCurrentField = f; // lastFiredBeforeField = f; break; } if (f.isField(fieldName)) { if (f.fglField.NoEntry == false) { setCurrentField = f; // lastFiredBeforeField = f; break; } else { found = true; } } } isacceptfield = isnextfield; PendingEvents.Clear(); }
public void setNextField(string fieldName) { foreach (FGLFoundField f in activeFields) { if (f.isField(fieldName)) { setCurrentField = f; } } PendingEvents.Clear(); }
public void ActionFieldTriggered(object source, string ID, string TriggeredText, UIContext u) { foreach (FGLFoundField f in activeFields) { if (f.fglField == source) { CurrentField = f; break; } } if (ID != "") { sendTrigger(ID); } }
private bool fieldsAreAllOk() { System.ComponentModel.CancelEventArgs ce; ce = new System.ComponentModel.CancelEventArgs(); ce.Cancel = false; foreach (FGLFoundField f in activeFields) { f.fglField.t_Validating(f, ce); if (ce.Cancel) { CurrentField = f; CurrentField.fglField.setFocus(); return(false); } } return(true); }
private void sendTriggers(FGLFoundField pCurrentField, string afterFieldID, FGLFoundField newfield, string beforeFieldID) { // if (afterFieldID != "" && beforeFieldID != "") // { // Yah ! - send them both... //string str = getTriggeredTag(afterFieldID, 1, 2, pCurrentField); // CurrentField = pCurrentField; // str += "\n"+getTriggeredTag(beforeFieldID, 2, 2,newfield); // this.EventTriggered(null, "", str, this); // this.EventTriggered = null; // } // else // { if (afterFieldID != "") { if (this.EventTriggered != null) { this.EventTriggered(null, afterFieldID, getTriggeredTag(afterFieldID, pCurrentField), this); this.EventTriggered = null; } } CurrentField = newfield; if (beforeFieldID != null && beforeFieldID != "") { if (this.EventTriggered != null) { this.EventTriggered(null, beforeFieldID, getTriggeredTag(beforeFieldID, newfield), this); this.EventTriggered = null; } else { PendingEvents.Add(beforeFieldID); } } //} }
public string getTriggeredTag(string ID, int cnt, int maxcnt, FGLFoundField currentField) { string cfield; string cntstring = ""; if (cnt > 0) { cntstring = " CNT=\"" + cnt + "\" MAXCNT=\"" + maxcnt + "\" "; } foreach (FGLFoundField f in activeFields) // NOTWEBGUI { // NOTWEBGUI if (f.fglField.hasFocus) // NOTWEBGUI { // NOTWEBGUI CurrentField = f; // NOTWEBGUI break; // NOTWEBGUI } // NOTWEBGUI } // NOTWEBGUI if (currentField != null) { cfield = " INFIELD=\"" + currentField.useName + "\""; } else { cfield = ""; } if (ID == "ACCEPT") { return("<TRIGGERED ID=\"ACCEPT\" LASTKEY=\"ACCEPT\">" + getSyncValues() + "</TRIGGERED>"); } else { return("<TRIGGERED ID=\"" + ID + "\" " + cfield + cntstring + " LASTKEY=\"" + mainWin.LastKey + "\"" + ">" + getSyncValues() + "</TRIGGERED>"); } }
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 void ActivateContext(UIEventHandler UIInputContext_EventTriggered, V[] values, ROW[] rows) { int cnt = 0; int tstop = 0; careAboutFocus = false; Console.WriteLine("Activating context.."); if (!_contextIsActive) { _contextIsActive = true; } // We should always get a set of values // if we dont - then it must be an INPUT without the WITHOUT DEFAULTS // and this must be the first time around - so we should set up the defaults... foreach (FGLFoundField f in activeFields) { Console.WriteLine(f.fullName); if (values == null) { f.fglField.Text = f.fglField.defaultValue; } else { if (f.fglField.Text == "" || true) { f.fglField.Text = values[cnt++].Text; } else { cnt++; } } f.fglField.tabIndex = tstop++; f.fglField.afterFieldID = ""; f.fglField.beforeFieldID = ""; f.fglField.onActionID = ""; } this.EventTriggered = UIInputContext_EventTriggered; if (PendingEvents.Count > 0) { string s = PendingEvents[0]; PendingEvents.RemoveAt(0); sendTrigger(s); return; } mainWin.SetContext(FGLContextType.ContextInput, activeFields, this, KeyList, onActionList, UIInputContext_EventTriggered); mainWin.setActiveToolBarKeys(KeyList, onActionList); foreach (FGLFoundField f in activeFields) { f.fglField.fieldValidationFailed = inputFieldValidationHandler; f.fglField.onGotFocus = inputGotFocus; f.fglField.onUIEvent = onActionTriggered; } if (setCurrentField != null) // Next field has been registered.. { CurrentField = setCurrentField; careAboutFocus = true; CurrentField.fglField.setFocus(); careAboutFocus = false; setCurrentField = null; } if (CurrentField == null) { CurrentField = activeFields[0]; CurrentField.fglField.setFocus(); } CurrentField.fglField.setFocus(); //mainWin.CommentText = CurrentField.fglField.comment; #region setup after field event IDs // We might want to cache these results.... // Set up the after fields by setting the afterFieldID property of the widget.. // foreach (AFTER_FIELD_EVENT e in afterFieldList) { List <FGLFoundField> ff = mainWin.FindField(e.FIELD); if (ff == null) { throw new ApplicationException("field not found :" + e.FIELD); } if (ff.Count == 0) { throw new ApplicationException("field not found : " + e.FIELD); } foreach (FGLFoundField ffield in ff) { ffield.fglField.afterFieldID = e.ID; } } #endregion #region set up before field event IDs // Set up the after fields by setting the afterFieldID property of the widget.. // foreach (BEFORE_FIELD_EVENT e in beforeFieldList) { List <FGLFoundField> ff = mainWin.FindField(e.FIELD); if (ff == null) { throw new ApplicationException("field not found :" + e.FIELD); } if (ff.Count == 0) { throw new ApplicationException("field not found : " + e.FIELD); } foreach (FGLFoundField ffield in ff) { ffield.fglField.beforeFieldID = e.ID; } } #endregion #region set up "on action" event IDs // Set up the actions by setting the onActionID property of the widget.. // foreach (ON_ACTION_EVENT e in onActionList) { foreach (FGLFoundField ffield in mainWin.FindAction(e.ACTION)) { ffield.fglField.onActionID = e.ID; ffield.fglField.Enabled = true; ffield.fglField.ContextType = FGLContextType.ContextInput; } } #endregion if (isInput == CurrentField.fglField.beforeFieldID) { isBeforeInput = false; } if (isBeforeInput) { if (CurrentField.fglField.beforeFieldID != "") { sendTrigger(CurrentField.fglField.beforeFieldID); isInput = CurrentField.fglField.beforeFieldID; } // isBeforeInput = false; } careAboutFocus = true; mainWin.CommentText = CurrentField.fglField.comment; //Application.DoEvents(); }
void inputGotFocus(object source, string comment) { bool setField = false; FGLFoundField field = null; if (!careAboutFocus) { return; } // source. foreach (FGLFoundField f in activeFields) { if (f.fglField == source) { field = f; break; } } mainWin.CommentText = comment; if (CurrentField == field) { return; } if (field == setCurrentField) { return; } if (CurrentField != null) { if (CurrentField.fglField.afterFieldID != "") { sendTrigger(CurrentField.fglField.afterFieldID); setField = true; } else { sendTrigger("SETYOURID"); setField = true; } } CurrentField = field; if (CurrentField != null) { if (CurrentField.fglField.beforeFieldID != "") { setField = true; sendTrigger(CurrentField.fglField.beforeFieldID); } } if (setField) { // The context will be deactivated - so we need to say where we're going next... setCurrentField = field; } }
void inputGotFocus_o(object source, string comment) { bool setField = false; FGLFoundField field = null; // if (isnextfield == true) { // isnextfield = false; // return; // } if (!careAboutFocus) { return; } foreach (FGLFoundField f in activeFields) { if (f.fglField == source) { field = f; break; } } if (comment == "") { } else { mainWin.CommentText = comment; } // MessageBox.Show("teste1"); if (lastFiredBeforeField2 == field && lastFiredBeforeField == lastFiredBeforeField2) { // sendTriggers(CurrentField, CurrentField.fglField.afterFieldID, field, field.fglField.beforeFieldID); lastFiredBeforeField = null; lastFiredBeforeField2 = null; return; } // if (field == setCurrentField) // { setCurrentField = field; // return; // } if (CurrentField != null) { if (CurrentField.fglField.afterFieldID != "") { // sendTrigger(CurrentField.fglField.afterFieldID); setField = true; } else { //diogo teste sendTrigger("SETYOURID"); setField = true; } } lastFiredBeforeField = CurrentField; if (lastFiredBeforeField2 == setCurrentField) { if (CurrentField.fglField.beforeFieldID != "") { sendTriggers(CurrentField, null, field, field.fglField.beforeFieldID); } lastFiredBeforeField2 = CurrentField; } else { sendTriggers(CurrentField, CurrentField.fglField.afterFieldID, field, field.fglField.beforeFieldID); if (lastFiredBeforeField2 != null) { lastFiredBeforeField2 = CurrentField; } else { lastFiredBeforeField2 = field; } } if (setField) { // The context will be deactivated - so we need to say where we're going next... setCurrentField = field; } }
void inputGotFocus_d(object source, string comment) { bool setField = false; FGLFoundField field = null; // lastFiredBeforeField = null; if (!careAboutFocus) { return; } foreach (FGLFoundField f in activeFields) { if (f.fglField == source) { field = f; break; } } if (comment == "") { } else { mainWin.CommentText = comment; } // if (CurrentField == field) return; if (field == lastFiredBeforeField2) { return; } // lastFiredBeforeField if (lastFiredBeforeField == field) { return; } setCurrentField_x = CurrentField; if (CurrentField != null) { if (CurrentField.fglField.afterFieldID != "") { sendTrigger(CurrentField.fglField.afterFieldID); setField = true; lastFiredBeforeField2 = CurrentField; // lastFiredBeforeField2.fglField.desligacor = 1; //lastFiredBeforeField2.fglField.desligacor = 1; setField = true; } else { // sendTrigger("SETYOURID"); <<<< WTF ? } lastFiredBeforeField = field; CurrentField = field; } if (field != null) { if (field.fglField.beforeFieldID != "") { setField = true; sendTrigger(field.fglField.beforeFieldID); lastFiredBeforeField2 = field; // field.fglField.desligacor = 1; lastFiredBeforeField = null; } else { lastFiredBeforeField = field; } CurrentField = field; if (field.fglField.afterFieldID != "") { lastFiredBeforeField2 = setCurrentField_x; // CurrentField = setCurrentField_x; } } if (setField) { // The context will be deactivated - so we need to say where we're going next... setCurrentField = field; } else { lastFiredBeforeField = lastFiredBeforeField2; lastFiredBeforeField2 = null; } }
void inputGotFocus(object source, string comment) { FGLFoundField field = null; Boolean l_entrou = false; Boolean l_entrou2 = false; if (!careAboutFocus) { return; } foreach (FGLFoundField f in activeFields) { if (f.fglField == source) { field = f; break; } } // field.fglField.desligacor = 0; if (comment == "") { } else { mainWin.CommentText = comment; } if (CurrentField != null && isBeforeField == false && (isBeforeInput == false || CurrentField.fglField.afterFieldID != "")) { setCurrentField_x = CurrentField; // CurrentField.fglField.desligacor = 1; if (CurrentField.fglField.afterFieldID != "") { sendTrigger(CurrentField.fglField.afterFieldID); setCurrentField = field; // setCurrentField_x = field; l_entrou = true; if (isBeforeInput == true) { isBeforeInput = false; } // System.Threading.Thread.Sleep(500); } else { isBeforeInput = true; } } if (field != null && l_entrou == false && isBeforeInput == true) { //setCurrentField_x = CurrentField; if (field.fglField.beforeFieldID != "") { sendTrigger(field.fglField.beforeFieldID); setCurrentField = field; CurrentField = field; setCurrentField_x = field; l_entrou2 = true; isBeforeInput = false; // System.Threading.Thread.Sleep(500); } } if (l_entrou == false && l_entrou2 == false) { CurrentField = field; isBeforeInput = true; } // careAboutFocus = false; }
public string getTriggeredTag(string ID, FGLFoundField currentField) { return(getTriggeredTag(ID, 0, 0, currentField)); }
// 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 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 { } }