예제 #1
0
        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();
        }
예제 #2
0
        private static string[] ui_combo_frontcall(FGLApplicationPanel appPanel, string name, VALUE[] values, string[] retStrings)
        {
            switch (name)
            {
            case "ui.combobox.forname":
            {
                List <FGLFoundField> f = appPanel.FindField(values[0].Text);
                if (f == null)
                {
                    return(null);
                }
                if (f.Count == 0)
                {
                    return(null);
                }
                retStrings[0] = f[0].fullName;
                return(retStrings);
            }


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

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

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

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


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

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

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

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

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

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

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

            case "ui.combobox.gettextof":

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


            default:
                return(null);
            }

            return(retStrings);
        }
예제 #3
0
        private static string[] ui_form_frontcall(FGLApplicationPanel appPanel, string name, V[] values, string[] retStrings)
        {
            switch (name)
            {
            case "ui.form.setpagetitle":
            {
                TabPage f = appPanel.FindPage(values);



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



                return(null);
            }

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


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

                return(null);
            }



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

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



            default:
                return(null);
            }

            return(retStrings);
        }