/// <summary>
        /// add children to the control
        /// </summary>
        public override void AddChildren(TFormWriter writer, TControlDef container)
        {
            if (container.Children.Count > 0)
            {
                string addChildren = string.Empty;

                foreach (TControlDef child in container.Children)
                {
                    if (addChildren.Length > 0)
                    {
                        addChildren += "," + Environment.NewLine + "            ";
                    }

                    if ((addChildren.Length == 0) && child.controlName.StartsWith("tbbSeparator"))
                    {
                        // ignore separators at the front of a toolbar, needed for localised winforms
                        continue;
                    }

                    addChildren += child.controlName;
                }

                writer.CallControlFunction(container.controlName,
                                           "Items.AddRange(new System.Windows.Forms.ToolStripItem[] {" + Environment.NewLine +
                                           "               " + addChildren +
                                           "})");
            }
        }
        /// <summary>write the code for the designer file where the properties of the control are written</summary>
        public override ProcessTemplate SetControlProperties(TFormWriter writer, TControlDef ctrl)
        {
            base.SetControlProperties(writer, ctrl);
            writer.SetControlProperty(ctrl, "FixedRows", "1");
            writer.Template.AddToCodelet("INITMANUALCODE", ctrl.controlName + ".CancelEditingWithEscapeKey = false;" + Environment.NewLine);

            // Grid AutoFind definition.  Unlike normal grids this applies whether columns and sorting are defined or not.
            // Checked list boxes enable first character auto find by default using column 1/
            // If you want something different it must be specified in YAML
            string autoFindStr = ctrl.controlName + ".AutoFindMode = TAutoFindModeEnum.";

            if (ctrl.HasAttribute("AutoFindMode"))
            {
                autoFindStr += ctrl.GetAttribute("AutoFindMode");
                TLogging.Log("Info: AutoFindMode for checked list box was set from explicit YAML attribute: " + ctrl.controlName);
            }
            else
            {
                autoFindStr += "FirstCharacter";
                TLogging.Log("Info: AutoFindMode for checked list box was set implicitly for: " + ctrl.controlName);
            }

            writer.Template.AddToCodelet("INITMANUALCODE", autoFindStr + ";" + Environment.NewLine);

            if (ctrl.HasAttribute("AutoFindColumn"))
            {
                writer.Template.AddToCodelet("INITMANUALCODE",
                                             ctrl.controlName + ".AutoFindColumn = " + ctrl.GetAttribute("AutoFindColumn") + ";" + Environment.NewLine);
            }

            return(writer.FTemplate);
        }
        /// <summary>
        /// get the controls that belong to the toolstrip
        /// </summary>
        public override void ProcessChildren(TFormWriter writer, TControlDef container)
        {
            // add all the children

            // TODO add Container elements in statusbar
            if (container.controlName.StartsWith("stb"))
            {
                return;
            }

            List <XmlNode> childrenlist;

            if (TYml2Xml.GetChild(container.xmlNode, "Controls") != null)
            {
                // this is for generated toolbar, eg. for the PrintPreviewControl
                StringCollection childrenNames = TYml2Xml.GetElements(container.xmlNode, "Controls");
                childrenlist = new List <XmlNode>();

                foreach (string name in childrenNames)
                {
                    childrenlist.Add(container.xmlNode.OwnerDocument.CreateElement(name));
                }
            }
            else
            {
                // usually, the toolbar buttons are direct children of the toolbar control
                childrenlist = TYml2Xml.GetChildren(container.xmlNode, true);
            }

            //Console.WriteLine("Container: " + container.controlName);
            foreach (XmlNode child in childrenlist)
            {
                // Console.WriteLine("Child: " + child.Name);

                /* Get unique name if we need it
                 * at the moment we need it only for menu separators
                 */
                String      UniqueChildName = child.Name;
                TControlDef ControlDefChild = container.FCodeStorage.GetControl(child.Name);

                if (ControlDefChild == null)
                {
                    UniqueChildName = TYml2Xml.GetAttribute(child, "UniqueName");
                    ControlDefChild = container.FCodeStorage.GetControl(UniqueChildName);
                }

                container.Children.Add(ControlDefChild);

                if (ControlDefChild != null)
                {
                    IControlGenerator ctrlGenerator = writer.FindControlGenerator(ControlDefChild);

                    // add control itself
                    if (ctrlGenerator != null)
                    {
                        ctrlGenerator.GenerateControl(writer, ControlDefChild);
                    }
                }
            }
        }
Beispiel #4
0
        /// <summary>write the code for the designer file where the properties of the control are written</summary>
        public override ProcessTemplate SetControlProperties(TFormWriter writer, TControlDef ctrl)
        {
            if (IsMniFilterFindClickAndIgnore(writer, ctrl, false))
            {
                return(writer.FTemplate);
            }

            base.SetControlProperties(writer, ctrl);

            // deactivate menu items that have no action assigned yet.
            if ((ctrl.GetAction() == null) && !ctrl.HasAttribute("ActionClick") && !ctrl.HasAttribute("ActionOpenScreen") &&
                (ctrl.NumberChildren == 0) && !(this is MenuItemSeparatorGenerator))
            {
                string ActionEnabling = ctrl.controlName + ".Enabled = false;" + Environment.NewLine;
                writer.Template.AddToCodelet("ACTIONENABLINGDISABLEMISSINGFUNCS", ActionEnabling);
            }

            writer.SetControlProperty(ctrl, "Text", "\"" + ctrl.Label + "\"");

            if (ctrl.HasAttribute("ShortcutKeys"))
            {
                writer.SetControlProperty(ctrl, "ShortcutKeys", ctrl.GetAttribute("ShortcutKeys"));
            }

            // todo: this.toolStripMenuItem1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;

            return(writer.FTemplate);
        }
Beispiel #5
0
        /// <summary>
        /// create a new panel for the layout. eg. needed for radio buttons with depending controls
        /// </summary>
        public TControlDef CreateNewPanel(TFormWriter writer, TControlDef parentContainer)
        {
            TControlDef newTableLayoutPanel = writer.CodeStorage.FindOrCreateControl(CalculateName(), parentContainer.controlName);

            GenerateControl(writer, newTableLayoutPanel);
            return(newTableLayoutPanel);
        }
        /// <summary>
        /// declare the control
        /// </summary>
        public override void GenerateDeclaration(TFormWriter writer, TControlDef ctrl)
        {
            string      hostedControlName = TYml2Xml.GetAttribute(ctrl.xmlNode, "HostedControl");
            TControlDef hostedCtrl        = FCodeStorage.FindOrCreateControl(hostedControlName, ctrl.controlName);

            IControlGenerator ctrlGenerator = writer.FindControlGenerator(hostedCtrl);

            // add control itself
            if ((hostedCtrl != null) && (ctrlGenerator != null))
            {
                ctrlGenerator.GenerateDeclaration(writer, hostedCtrl);
            }

            string localControlType = ControlType;

            if (ctrl.controlType.Length > 0)
            {
                localControlType = ctrl.controlType;
            }

            writer.Template.AddToCodelet("CONTROLDECLARATION", "private " + localControlType + " " + ctrl.controlName + ";" +
                                         Environment.NewLine);
            writer.Template.AddToCodelet("CONTROLCREATION", "this." + ctrl.controlName + " = new " + localControlType + "(" +
                                         TYml2Xml.GetAttribute(ctrl.xmlNode, "HostedControl") + ");" + Environment.NewLine);
        }
 /// <summary>
 /// declare the control
 /// </summary>
 /// <param name="writer"></param>
 /// <param name="ctrl"></param>
 public override void GenerateDeclaration(TFormWriter writer, TControlDef ctrl)
 {
     if (!IsMniFilterFindClickAndIgnore(writer, ctrl, false))
     {
         base.GenerateDeclaration(writer, ctrl);
     }
 }
Beispiel #8
0
        /// <summary>write the code for the designer file where the properties of the control are written</summary>
        public override ProcessTemplate SetControlProperties(TFormWriter writer, TControlDef ctrl)
        {
            ProcessTemplate ctrlSnippet = base.SetControlProperties(writer, ctrl);

            ProcessTemplate uploadCheckAssistantSnippet = writer.FTemplate.GetSnippet("ASSISTANTPAGEWITHUPLOADVALID");

            ((TExtJsFormsWriter)writer).AddResourceString(uploadCheckAssistantSnippet, "MISSINGUPLOADTITLE", ctrl,
                                                          ctrl.GetAttribute("MissingUploadTitle"));
            ((TExtJsFormsWriter)writer).AddResourceString(uploadCheckAssistantSnippet, "MISSINGUPLOADMESSAGE", ctrl,
                                                          ctrl.GetAttribute("MissingUploadMessage"));

            writer.FTemplate.InsertSnippet("ISVALID", uploadCheckAssistantSnippet);
            writer.FTemplate.InsertSnippet("ONSHOW", writer.FTemplate.GetSnippet("ASSISTANTPAGEWITHUPLOADSHOW"));
            writer.FTemplate.InsertSnippet("ONHIDE", writer.FTemplate.GetSnippet("ASSISTANTPAGEWITHUPLOADHIDE"));

            ProcessTemplate uploadSnippet = writer.FTemplate.GetSnippet("UPLOADFORMDEFINITION");

            if (ctrl.HasAttribute("UploadButtonLabel"))
            {
                ((TExtJsFormsWriter)writer).AddResourceString(uploadCheckAssistantSnippet, "UPLOADBUTTONLABEL", ctrl,
                                                              ctrl.GetAttribute("UploadButtonLabel"));
                uploadSnippet.SetCodelet("UPLOADBUTTONLABEL", ctrl.controlName + "UPLOADBUTTONLABEL");
            }

            writer.FTemplate.InsertSnippet("UPLOADFORM", uploadSnippet);

            ProcessTemplate uploadCheckSnippet = writer.FTemplate.GetSnippet("VALIDUPLOADCHECK");

            writer.FTemplate.InsertSnippet("CHECKFORVALIDUPLOAD", uploadCheckSnippet);

            return(ctrlSnippet);
        }
        /// <summary>add GeneratedReadSetControls</summary>
        public override void ApplyDerivedFunctionality(TFormWriter writer, TControlDef control)
        {
            string paramName = ReportControls.GetParameterName(control.xmlNode);

            if (paramName == null)
            {
                return;
            }

            StringCollection optionalValues =
                TYml2Xml.GetElements(TXMLParser.GetChild(control.xmlNode, "OptionalValues"));

            foreach (string rbtValueText in optionalValues)
            {
                string rbtValue = StringHelper.UpperCamelCase(rbtValueText.Replace("'", "").Replace(" ", "_"), false, false);
                string rbtName  = "rbt" + rbtValue;
                writer.Template.AddToCodelet("READCONTROLS",
                                             "if (" + rbtName + ".Checked) " + Environment.NewLine +
                                             "{" + Environment.NewLine +
                                             "  ACalc.AddParameter(\"" + paramName + "\", \"" + rbtValue + "\");" + Environment.NewLine +
                                             "}" + Environment.NewLine);
                writer.Template.AddToCodelet("SETCONTROLS",
                                             rbtName + ".Checked = " +
                                             "AParameters.Get(\"" + paramName + "\").ToString() == \"" + rbtValue + "\";" +
                                             Environment.NewLine);
            }
        }
Beispiel #10
0
        /// <summary>write the code for the designer file where the properties of the control are written</summary>
        public override ProcessTemplate SetControlProperties(TFormWriter writer, TControlDef ctrl)
        {
            base.SetControlProperties(writer, ctrl);

            if (TYml2Xml.HasAttribute(ctrl.xmlNode, "DefaultValue"))
            {
                writer.SetControlProperty(ctrl,
                                          "Text",
                                          "\"" + TYml2Xml.GetAttribute(ctrl.xmlNode, "DefaultValue") + "\"");
            }

            if ((TYml2Xml.HasAttribute(ctrl.xmlNode, "Multiline")) && (TYml2Xml.GetAttribute(ctrl.xmlNode, "Multiline") == "true"))
            {
                writer.SetControlProperty(ctrl, "Multiline", "true");

                if ((TYml2Xml.HasAttribute(ctrl.xmlNode, "WordWrap")) && (TYml2Xml.GetAttribute(ctrl.xmlNode, "WordWrap") == "false"))
                {
                    writer.SetControlProperty(ctrl, "WordWrap", "false");
                }

                if (TYml2Xml.HasAttribute(ctrl.xmlNode, "ScrollBars"))
                {
                    writer.SetControlProperty(ctrl, "ScrollBars", "ScrollBars." + TYml2Xml.GetAttribute(ctrl.xmlNode, "ScrollBars"));
                }
            }

            writer.Template.AddToCodelet("ASSIGNFONTATTRIBUTES",
                                         "this." + ctrl.controlName + ".Font = TAppSettingsManager.GetDefaultBoldFont();" + Environment.NewLine);

            return(writer.FTemplate);
        }
        /// <summary>write the code for the designer file where the properties of the control are written</summary>
        public override ProcessTemplate SetControlProperties(TFormWriter writer, TControlDef ctrl)
        {
            // Support NoLabel=true
            FGenerateLabel = true;

            if (GenerateLabel(ctrl))
            {
                writer.SetControlProperty(ctrl, "Text", "\"" + ctrl.Label + "\"");
                ctrl.SetAttribute("Width", (PanelLayoutGenerator.MeasureTextWidth(ctrl.Label) + 30).ToString());
            }
            else
            {
                ctrl.SetAttribute("Width", "15");
            }

            base.SetControlProperties(writer, ctrl);

            FGenerateLabel = false;

            if (TYml2Xml.HasAttribute(ctrl.xmlNode, "RadioChecked"))
            {
                writer.SetControlProperty(ctrl,
                                          "Checked",
                                          TYml2Xml.GetAttribute(ctrl.xmlNode, "RadioChecked"));
            }

            return(writer.FTemplate);
        }
Beispiel #12
0
        /// <summary>
        /// create the radio buttons and the controls that depend on them
        /// </summary>
        /// <param name="writer"></param>
        /// <param name="curNode"></param>
        /// <returns></returns>
        public override StringCollection FindContainedControls(TFormWriter writer, XmlNode curNode)
        {
            StringCollection Controls =
                TYml2Xml.GetElements(TXMLParser.GetChild(curNode, "Controls"));
            string DefaultValue = Controls[0];

            if (TXMLParser.HasAttribute(curNode, "DefaultValue"))
            {
                DefaultValue = TXMLParser.GetAttribute(curNode, "DefaultValue");
            }

            foreach (string controlName in Controls)
            {
                TControlDef radioButton = writer.CodeStorage.GetControl(controlName);

                if (radioButton == null)
                {
                    throw new Exception("cannot find control " + controlName + " used in RadioGroup " + curNode.Name);
                }

                if (StringHelper.IsSame(DefaultValue, controlName))
                {
                    radioButton.SetAttribute("RadioChecked", "true");
                }
            }

            return(Controls);
        }
Beispiel #13
0
 /// <summary>write the code for the designer file where the properties of the control are written</summary>
 public override ProcessTemplate SetControlProperties(TFormWriter writer, TControlDef ctrl)
 {
     base.SetControlProperties(writer, ctrl);
     writer.SetControlProperty(ctrl, "FixedRows", "1");
     writer.Template.AddToCodelet("INITMANUALCODE", ctrl.controlName + ".CancelEditingWithEscapeKey = false;" + Environment.NewLine);
     return(writer.FTemplate);
 }
Beispiel #14
0
        /// <summary>write the code for the designer file where the properties of the control are written</summary>
        public override ProcessTemplate SetControlProperties(TFormWriter writer, TControlDef ctrl)
        {
            string NumberFormat = String.Empty;

            base.SetControlProperties(writer, ctrl);

            if ((ctrl.HasAttribute("ShowLabel") && (ctrl.GetAttribute("ShowLabel").ToLower() == "false")))
            {
                writer.SetControlProperty(ctrl, "ShowLabel", "false");
            }

            // Note: the control defaults to 'ShowLabel' true, so this doesn't need to be set to 'true' in code.

            // Order is important: set Context before ControlMode and before DecimalPlaces
            writer.SetControlProperty(ctrl, "Context", "this");
            writer.SetControlProperty(ctrl, "ControlMode", "TTxtNumericTextBox.TNumericTextBoxMode." + FControlMode);
            writer.SetControlProperty(ctrl, "DecimalPlaces", FDecimalPrecision.ToString());
            writer.SetControlProperty(ctrl, "NullValueAllowed", FNullValueAllowed.ToString().ToLower());

            if (ctrl.HasAttribute("Format"))
            {
                NumberFormat = ctrl.GetAttribute("Format");
            }

            if ((NumberFormat.StartsWith("PercentInteger")) ||
                (NumberFormat.StartsWith("PercentDecimal")))
            {
                writer.SetControlProperty(ctrl, "ShowPercentSign", "true");
            }

            return(writer.FTemplate);
        }
Beispiel #15
0
        /// <summary>write the code for the designer file where the properties of the control are written</summary>
        public override ProcessTemplate SetControlProperties(TFormWriter writer, TControlDef ACtrl)
        {
            ProcessTemplate ctrlSnippet = base.SetControlProperties(writer, ACtrl);

            ((TExtJsFormsWriter)writer).AddResourceString(ctrlSnippet,
                                                          "URL",
                                                          ACtrl,
                                                          TYml2Xml.GetAttribute(ACtrl.xmlNode, "url"));
            ((TExtJsFormsWriter)writer).AddResourceString(ctrlSnippet,
                                                          "BROWSERMISSINGIFRAMESUPPORT",
                                                          null,
                                                          "Your browser is not able to display embedded documents. Please click on the following link to read the text: ");
            ((TExtJsFormsWriter)writer).AddResourceString(ctrlSnippet,
                                                          "IFRAMEINBIGGERWINDOW",
                                                          null,
                                                          "Open this document in a bigger window");

            ctrlSnippet.SetCodelet("HEIGHT", "250");

            if (ACtrl.HasAttribute("Height"))
            {
                ctrlSnippet.SetCodelet("HEIGHT", ACtrl.GetAttribute("Height"));
            }

            return(ctrlSnippet);
        }
Beispiel #16
0
        /// <summary>write the code for the designer file where the properties of the control are written</summary>
        public override ProcessTemplate SetControlProperties(TFormWriter writer, TControlDef ctrl)
        {
            ProcessTemplate ctrlSnippet = base.SetControlProperties(writer, ctrl);

            if (ctrlSnippet.FTemplateCode.Contains("{#REDIRECTONSUCCESS}"))
            {
                ProcessTemplate redirectSnippet = writer.FTemplate.GetSnippet("REDIRECTONSUCCESS");

                ctrlSnippet.SetCodelet("REDIRECTONSUCCESS", redirectSnippet.FTemplateCode.ToString());
            }

            if (ctrl.HasAttribute("AjaxRequestUrl"))
            {
                ((TExtJsFormsWriter)writer).AddResourceString(ctrlSnippet, "VALIDATIONERRORTITLE", ctrl, ctrl.GetAttribute("ValidationErrorTitle"));
                ((TExtJsFormsWriter)writer).AddResourceString(ctrlSnippet, "VALIDATIONERRORMESSAGE", ctrl, ctrl.GetAttribute("ValidationErrorMessage"));
                ((TExtJsFormsWriter)writer).AddResourceString(ctrlSnippet, "SENDINGDATATITLE", ctrl, ctrl.GetAttribute("SendingMessageTitle"));
                ((TExtJsFormsWriter)writer).AddResourceString(ctrlSnippet, "SENDINGDATAMESSAGE", ctrl, ctrl.GetAttribute("SendingMessage"));

                if (ctrl.HasAttribute("SuccessMessage"))
                {
                    ((TExtJsFormsWriter)writer).AddResourceString(ctrlSnippet, "REQUESTSUCCESSTITLE", ctrl, ctrl.GetAttribute("SuccessMessageTitle"));
                    ((TExtJsFormsWriter)writer).AddResourceString(ctrlSnippet, "REQUESTSUCCESSMESSAGE", ctrl, ctrl.GetAttribute("SuccessMessage"));
                }

                ((TExtJsFormsWriter)writer).AddResourceString(ctrlSnippet, "REQUESTFAILURETITLE", ctrl, ctrl.GetAttribute("FailureMessageTitle"));
                ((TExtJsFormsWriter)writer).AddResourceString(ctrlSnippet, "REQUESTFAILUREMESSAGE", ctrl, ctrl.GetAttribute("FailureMessage"));
            }

            ctrlSnippet.SetCodelet("REQUESTURL", ctrl.GetAttribute("AjaxRequestUrl"));
            ((TExtJsFormsWriter)writer).AddResourceString(ctrlSnippet, "REDIRECTURLONSUCCESS", ctrl, ctrl.GetAttribute("RedirectURLOnSuccess"));

            if (ctrl.GetAttribute("DownloadOnSuccess").StartsWith("jsonData"))
            {
                ctrlSnippet.SetCodelet("REDIRECTDOWNLOAD", ctrl.GetAttribute("DownloadOnSuccess"));
            }

            ((TExtJsFormsWriter)writer).AddResourceString(ctrlSnippet, "REDIRECTURLONCANCEL", ctrl, ctrl.GetAttribute("RedirectURLOnCancel"));
            ((TExtJsFormsWriter)writer).AddResourceString(ctrlSnippet, "CANCELQUESTIONTITLE", ctrl, ctrl.GetAttribute("CancelQuestionTitle"));
            ((TExtJsFormsWriter)writer).AddResourceString(ctrlSnippet, "CANCELQUESTIONMESSAGE", ctrl, ctrl.GetAttribute("CancelQuestionMessage"));

            XmlNode AjaxParametersNode = TYml2Xml.GetChild(ctrl.xmlNode, "AjaxRequestParameters");

            if (AjaxParametersNode != null)
            {
                string ParameterString = String.Empty;

                foreach (XmlAttribute attr in AjaxParametersNode.Attributes)
                {
                    if (!attr.Name.Equals("depth"))
                    {
                        ParameterString += attr.Name + ": '" + attr.Value + "', ";
                    }
                }

                ctrlSnippet.SetCodelet("REQUESTPARAMETERS", ParameterString);
                writer.FTemplate.SetCodelet("REQUESTPARAMETERS", "true");
            }

            return(ctrlSnippet);
        }
Beispiel #17
0
        /// <summary>write the code for the designer file where the properties of the control are written</summary>
        public override ProcessTemplate SetControlProperties(TFormWriter writer, TControlDef ctrl)
        {
            base.SetControlProperties(writer, ctrl);
            writer.SetControlProperty(ctrl, "ListTable", "TCmbAutoPopulated.TListTableEnum." + ctrl.GetAttribute("List"));

            if (ctrl.GetAttribute("List") != "UserDefinedList")
            {
                writer.Template.AddToCodelet("INITUSERCONTROLS", ctrl.controlName + ".InitialiseUserControl();" + Environment.NewLine);

                if (ctrl.HasAttribute("AllowDbNull"))
                {
                    writer.SetControlProperty(ctrl, "AllowDbNull", ctrl.GetAttribute("AllowDbNull"));
                }

                if (ctrl.HasAttribute("NullValueDesciption"))
                {
                    writer.SetControlProperty(ctrl, "NullValueDesciption", "\"" + ctrl.GetAttribute("NullValueDesciption") + "\"");
                }
            }
            else
            {
                // user defined lists have to be either filled in manual code
                // eg UC_GLJournals.ManualCode.cs, BeforeShowDetailsManual
                // or UC_GLTransactions.ManualCode.cs, LoadTransactions
            }

            if (ctrl.HasAttribute("ComboBoxWidth"))
            {
                writer.SetControlProperty(ctrl, "ComboBoxWidth", ctrl.GetAttribute("ComboBoxWidth"));
            }

            return(writer.FTemplate);
        }
        /// <summary>
        /// add children to the control
        /// </summary>
        public override void AddChildren(TFormWriter writer, TControlDef container)
        {
            if (container.Children.Count > 0)
            {
                string addChildren = string.Empty;

                foreach (TControlDef child in container.Children)
                {
                    if (IsMniFilterFindClickAndIgnore(writer, child, child.controlName == "mniEditFind"))
                    {
                        continue;
                    }

                    if (addChildren.Length > 0)
                    {
                        addChildren += "," + Environment.NewLine + "            ";
                    }

                    if ((addChildren.Length == 0) && child.controlName.StartsWith("mniSeparator"))
                    {
                        // ignore separators at the top of a menu, needed for localised winforms
                        continue;
                    }

                    addChildren += child.controlName;
                }

                writer.CallControlFunction(container.controlName,
                                           "DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {" + Environment.NewLine +
                                           "               " + addChildren +
                                           "})");
            }
        }
Beispiel #19
0
        /// <summary>write the code for the designer file where the properties of the control are written</summary>
        public override ProcessTemplate SetControlProperties(TFormWriter writer, TControlDef ctrl)
        {
            ProcessTemplate ctrlSnippet = base.SetControlProperties(writer, ctrl);

            ctrlSnippet.SetCodelet("BOXLABEL", ctrlSnippet.FCodelets["LABEL"].ToString());
            ctrlSnippet.SetCodelet("LABEL", "strEmpty");
            return(ctrlSnippet);
        }
Beispiel #20
0
        /// <summary>write the code for the designer file where the properties of the control are written</summary>
        public override ProcessTemplate SetControlProperties(TFormWriter writer, TControlDef ctrl)
        {
            ProcessTemplate ctrlSnippet = base.SetControlProperties(writer, ctrl);

            writer.FTemplate.SetCodelet("DATAGRID", "true");

            return(ctrlSnippet);
        }
Beispiel #21
0
        /// <summary>write the code for the designer file where the properties of the control are written</summary>
        public override ProcessTemplate SetControlProperties(TFormWriter writer, TControlDef ctrl)
        {
            base.SetControlProperties(writer, ctrl);

            writer.SetControlProperty(ctrl, "LinkType", "TLinkTypes." + FLinkType);

            return(writer.FTemplate);
        }
Beispiel #22
0
        /// <summary>write the code for the designer file where the properties of the control are written</summary>
        public override ProcessTemplate SetControlProperties(TFormWriter writer, TControlDef ctrl)
        {
            base.SetControlProperties(writer, ctrl);

            writer.SetControlProperty(ctrl, "Description", "\"" + ctrl.Label + "\"");

            return(writer.FTemplate);
        }
        /// <summary>write the code for the designer file where the properties of the control are written</summary>
        public override ProcessTemplate SetControlProperties(TFormWriter writer, TControlDef ctrl)
        {
            // don't call base, because it should not have size, location, or name
            writer.Template.AddToCodelet("CONTROLINITIALISATION",
                                         "//" + Environment.NewLine + "// " + ctrl.controlName + Environment.NewLine + "//" + Environment.NewLine);

            return(writer.FTemplate);
        }
Beispiel #24
0
        /// <summary>write the code for the designer file where the properties of the control are written</summary>
        public override ProcessTemplate SetControlProperties(TFormWriter writer, TControlDef ctrl)
        {
            // TODO this does not work yet. see EventRole Maintain screen
            if ((!ctrl.HasAttribute("Align")) &&
                (!ctrl.HasAttribute("Width")))
            {
                ctrl.SetAttribute("Stretch", "horizontally");
            }

            base.SetControlProperties(writer, ctrl);

            TControlDef parentCtrl = writer.FCodeStorage.GetControl(ctrl.parentName);

            // We need to over-ride any Anchor requests in the YAML to anchor an attached label to anything other than top-left
            // But pure label controls can be anchored to, say, left-top-right
            if ((ctrl.controlName.Substring(ctrl.controlTypePrefix.Length) == parentCtrl.controlName.Substring(parentCtrl.controlTypePrefix.Length)) ||
                ((ctrl.HasAttribute("Dock") == false) && (ctrl.HasAttribute("Align") == false)))
            {
                // stretch at design time, but do not align to the right
                writer.SetControlProperty(ctrl, "Anchor",
                                          "((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)))");
            }

            string labelText = "";

            if (TYml2Xml.HasAttribute(ctrl.xmlNode, "Text"))
            {
                labelText = TYml2Xml.GetAttribute(ctrl.xmlNode, "Text");
            }
            else
            {
                labelText = ctrl.Label + ":";
            }

            if (ctrl.HasAttribute("Width"))
            {
                ctrl.SetAttribute("Width", ctrl.GetAttribute("Width"));
            }
            else
            {
                ctrl.SetAttribute("Width", (PanelLayoutGenerator.MeasureTextWidth(labelText) + 5).ToString());
            }

            if (ctrl.HasAttribute("Height"))
            {
                ctrl.SetAttribute("Height", ctrl.GetAttribute("Height"));
            }

            writer.SetControlProperty(ctrl, "Text", "\"" + labelText + "\"");
            writer.SetControlProperty(ctrl, "Padding", "new System.Windows.Forms.Padding(0, 5, 0, 0)");

            if (FRightAlign)
            {
                writer.SetControlProperty(ctrl, "TextAlign", "System.Drawing.ContentAlignment.TopRight");
            }

            return(writer.FTemplate);
        }
Beispiel #25
0
        /// <summary>write the code for the designer file where the properties of the control are written</summary>
        public override ProcessTemplate SetControlProperties(TFormWriter writer, TControlDef ctrl)
        {
            Int32 buttonWidth  = 40;
            Int32 textBoxWidth = 80;

            // seems to be hardcoded in csharp\ICT\Petra\Client\CommonControls\Gui\txtAutoPopulatedButtonLabel.Designer.cs
            Int32 controlWidth = 390;

            base.SetControlProperties(writer, ctrl);

            if ((ctrl.HasAttribute("ShowLabel") && (ctrl.GetAttribute("ShowLabel").ToLower() == "false")))
            {
                writer.SetControlProperty(ctrl, "ShowLabel", "false");
                controlWidth = 120;
            }

            // Note: the control defaults to 'ShowLabel' true, so this doesn't need to be set to 'true' in code.

            writer.SetControlProperty(ctrl, "ASpecialSetting", "true");
            writer.SetControlProperty(ctrl, "ButtonTextAlign", "System.Drawing.ContentAlignment.MiddleCenter");
            writer.SetControlProperty(ctrl, "ListTable", "TtxtAutoPopulatedButtonLabel.TListTableEnum." +
                                      FButtonLabelType);
            writer.SetControlProperty(ctrl, "PartnerClass", "\"" + ctrl.GetAttribute("PartnerClass") + "\"");
            writer.SetControlProperty(ctrl, "MaxLength", "32767");
            writer.SetControlProperty(ctrl, "Tag", "\"CustomDisableAlthoughInvisible\"");
            writer.SetControlProperty(ctrl, "TextBoxWidth", textBoxWidth.ToString());

            if (!(ctrl.HasAttribute("ReadOnly") && (ctrl.GetAttribute("ReadOnly").ToLower() == "true")))
            {
                writer.SetControlProperty(ctrl, "ButtonWidth", buttonWidth.ToString());
                writer.SetControlProperty(ctrl, "ReadOnly", "false");
                writer.SetControlProperty(ctrl,
                                          "Font",
                                          "new System.Drawing.Font(\"Verdana\", 8.25f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, (byte)0)");
                writer.SetControlProperty(ctrl, "ButtonText", "\"Find\"");
            }
            else
            {
                writer.SetControlProperty(ctrl, "ButtonWidth", "0");
                writer.SetControlProperty(ctrl, "BorderStyle", "System.Windows.Forms.BorderStyle.None");
                writer.SetControlProperty(ctrl, "Padding", "new System.Windows.Forms.Padding(0, 4, 0, 0)");
            }

            if (!ctrl.HasAttribute("Width"))
            {
                ctrl.SetAttribute("Width", controlWidth.ToString());
            }

            if (TYml2Xml.HasAttribute(ctrl.xmlNode, "DefaultValue"))
            {
                writer.SetControlProperty(ctrl,
                                          "Text",
                                          "\"" + TYml2Xml.GetAttribute(ctrl.xmlNode, "DefaultValue") + "\"");
            }

            return(writer.FTemplate);
        }
        /// <summary>write the code for the designer file where the properties of the control are written</summary>
        public override ProcessTemplate SetControlProperties(TFormWriter writer, TControlDef ctrl)
        {
            base.SetControlProperties(writer, ctrl);

            writer.SetControlProperty(ctrl, "Text", "\"" + ctrl.Label + "\"");
            writer.SetControlProperty(ctrl, "Margin", "new System.Windows.Forms.Padding(3, 7, 3, 0)");

            return(writer.FTemplate);
        }
Beispiel #27
0
        /// <summary>write the code for the designer file where the properties of the control are written</summary>
        public override ProcessTemplate SetControlProperties(TFormWriter writer, TControlDef ACtrl)
        {
            ProcessTemplate ctrlSnippet = base.SetControlProperties(writer, ACtrl);

            string customAttributes = "boxMaxWidth: 175,";

            ctrlSnippet.SetCodelet("CUSTOMATTRIBUTES", customAttributes);

            return(ctrlSnippet);
        }
        /// <summary>write the code for the designer file where the properties of the control are written</summary>
        public override ProcessTemplate SetControlProperties(TFormWriter writer, TControlDef ctrl)
        {
            base.SetControlProperties(writer, ctrl);

            writer.SetControlProperty(ctrl, "Renderer", "new ToolStripProfessionalRenderer(new TOpenPetraMenuColours())");
            writer.SetControlProperty(ctrl, "GripStyle", "ToolStripGripStyle.Visible");
            writer.SetControlProperty(ctrl, "GripMargin", "new System.Windows.Forms.Padding(3)");

            return(writer.FTemplate);
        }
        /// <summary>add GeneratedReadSetControls</summary>
        public override void ApplyDerivedFunctionality(TFormWriter writer, TControlDef control)
        {
            TControlDef ctrl        = writer.CodeStorage.GetControl(control.xmlNode.Name);
            string      numericType = ctrl.GetAttribute("Format");

            if (numericType == "Currency")
            {
                ReportControls.GenerateReadSetControls(writer, control.xmlNode, writer.Template, "DECIMALTEXTBOX");
            }
        }
Beispiel #30
0
        /// <summary>write the code for the designer file where the properties of the control are written</summary>
        public override ProcessTemplate SetControlProperties(TFormWriter writer, TControlDef ctrl)
        {
            base.SetControlProperties(writer, ctrl);

            if (TYml2Xml.HasAttribute(ctrl.xmlNode, "DefaultValue"))
            {
                writer.SetControlProperty(ctrl,
                                          "Text",
                                          "\"" + TYml2Xml.GetAttribute(ctrl.xmlNode, "DefaultValue") + "\"");
            }

            if ((TYml2Xml.HasAttribute(ctrl.xmlNode, "Multiline")) && (TYml2Xml.GetAttribute(ctrl.xmlNode, "Multiline") == "true"))
            {
                writer.SetControlProperty(ctrl, "Multiline", "true");

                if ((TYml2Xml.HasAttribute(ctrl.xmlNode, "WordWrap")) && (TYml2Xml.GetAttribute(ctrl.xmlNode, "WordWrap") == "false"))
                {
                    writer.SetControlProperty(ctrl, "WordWrap", "false");
                }

                if (TYml2Xml.HasAttribute(ctrl.xmlNode, "ScrollBars"))
                {
                    writer.SetControlProperty(ctrl, "ScrollBars", "ScrollBars." + TYml2Xml.GetAttribute(ctrl.xmlNode, "ScrollBars"));
                }

                if (TYml2Xml.HasAttribute(ctrl.xmlNode, "MinimumSize"))
                {
                    writer.SetControlProperty(ctrl, "MinimumSize", "new System.Drawing.Size(" + TYml2Xml.GetAttribute(ctrl.xmlNode,
                                                                                                                      "MinimumSize") + ")");
                }
            }

            if (TYml2Xml.HasAttribute(ctrl.xmlNode, "TextAlign"))
            {
                writer.SetControlProperty(ctrl, "TextAlign", "HorizontalAlignment." + TYml2Xml.GetAttribute(ctrl.xmlNode, "TextAlign"));
            }

            if (TYml2Xml.HasAttribute(ctrl.xmlNode, "CharacterCasing"))
            {
                writer.SetControlProperty(ctrl, "CharacterCasing", "CharacterCasing." +
                                          TYml2Xml.GetAttribute(ctrl.xmlNode, "CharacterCasing"));
            }

            if ((TYml2Xml.HasAttribute(ctrl.xmlNode, "PasswordEntry")) && (TYml2Xml.GetAttribute(ctrl.xmlNode, "PasswordEntry") == "true"))
            {
                writer.SetControlProperty(ctrl, "UseSystemPasswordChar", "true");
            }

            writer.Template.AddToCodelet("ASSIGNFONTATTRIBUTES",
                                         "this." + ctrl.controlName + ".Font = TAppSettingsManager.GetDefaultBoldFont();" + Environment.NewLine);

            return(writer.FTemplate);
        }