本文整理汇总了C#中TControlDef.GetAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# TControlDef.GetAttribute方法的具体用法?C# TControlDef.GetAttribute怎么用?C# TControlDef.GetAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TControlDef
的用法示例。
在下文中一共展示了TControlDef.GetAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateAutoValidationCodeForControl
/// <summary>
/// Determines whether automatic Data Validation code should be created for a certain Control in a YAML file.
/// </summary>
/// <param name="AControl">Control in YAML file.</param>
/// <param name="AHasDataField"></param>
/// <param name="AMasterOrDetailTable">Pass in 'true' if the YAML file has got a 'MasterTable' or 'DetailTable' Element. </param>
/// <param name="AIncludeMasterOrDetailTableControl"></param>
/// <param name="AScope">Scope of the Data Validation that should be checked for. Specify <see cref="TAutomDataValidationScope.advsAll"/>
/// to find out if any of the scopes should be checked against, or use any other value of that enum to specifiy a specific scope.</param>
/// <param name="AReasonForAutomValidation">Contains the reason why automatic data validation code needs to be generated.</param>
/// <returns>True if automatic Data Validation code should be created for the Control in a YAML that was passed in in <paramref name="AControl" /> for
/// the scope that was specified with <paramref name="AScope" />, otherwise false. This Method also returns false if the Control specified in
/// <paramref name="AControl" /> isn't linked to a DB Table Field.</returns>
public static bool GenerateAutoValidationCodeForControl(TControlDef AControl, bool AHasDataField, bool AMasterOrDetailTable,
bool AIncludeMasterOrDetailTableControl, TAutomDataValidationScope AScope, out string AReasonForAutomValidation)
{
TTableField DBField = null;
bool IsDetailNotMaster;
AReasonForAutomValidation = String.Empty;
if (AHasDataField)
{
DBField = TDataBinding.GetTableField(AControl, AControl.GetAttribute("DataField"), out IsDetailNotMaster, true);
}
else if (AMasterOrDetailTable && AIncludeMasterOrDetailTableControl)
{
DBField = TDataBinding.GetTableField(AControl, AControl.controlName.Substring(
AControl.controlTypePrefix.Length), out IsDetailNotMaster, false);
}
if (DBField != null)
{
return GenerateAutoValidationCodeForDBTableField(DBField, AScope, null, out AReasonForAutomValidation);
}
else
{
return false;
}
}
示例2: SetControlProperties
/// <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 (ctrl.GetAttribute("AutoComplete").EndsWith("History"))
{
writer.SetControlProperty(ctrl, "AcceptNewValues", "true");
writer.SetEventHandlerToControl(ctrl.controlName,
"AcceptNewEntries",
"TAcceptNewEntryEventHandler",
"FPetraUtilsObject.AddComboBoxHistory");
writer.CallControlFunction(ctrl.controlName, "SetDataSourceStringList(\"\")");
writer.Template.AddToCodelet("INITUSERCONTROLS",
"FPetraUtilsObject.LoadComboBoxHistory(" + ctrl.controlName + ");" + Environment.NewLine);
}
return writer.FTemplate;
}
示例3: LinkControlDataField
private void LinkControlDataField(TFormWriter writer, TControlDef ctrl, TTableField AField, bool AIsDetailNotMaster)
{
ProcessTemplate snippetValidationControlsDictAdd;
bool AutomDataValidation;
string ReasonForAutomValidation;
string ColumnIDStr;
bool OKToGenerateDVCode = true;
if (AField == null)
{
return;
}
string tablename = TTable.NiceTableName(AField.strTableName);
string fieldname = TTable.NiceFieldName(AField);
string RowName = "FMainDS." + tablename + "[0]";
string TestForNullTable = "FMainDS." + tablename;
if ((tablename == writer.CodeStorage.GetAttribute("DetailTable")) || (tablename == writer.CodeStorage.GetAttribute("MasterTable")))
{
RowName = "ARow";
TestForNullTable = "";
}
string targetCodelet = "SHOWDATA";
if (tablename == writer.CodeStorage.GetAttribute("DetailTable"))
{
targetCodelet = "SHOWDETAILS";
}
ProcessTemplate snippetShowData = GenerateShowDataSnippetCode(ref fieldname, ref RowName, ref TestForNullTable, writer, ctrl, AField);
writer.Template.InsertSnippet(targetCodelet, snippetShowData);
if (AField.bPartOfPrimKey)
{
// check if the current row is new; then allow changing the primary key; otherwise make the control readonly
writer.Template.AddToCodelet(targetCodelet, ctrl.controlName + "." + (FHasReadOnlyProperty ? "ReadOnly" : "Enabled") + " = " +
"(" + RowName + ".RowState " + (FHasReadOnlyProperty ? "!=" : "==") + " DataRowState.Added);" + Environment.NewLine);
writer.Template.AddToCodelet("PRIMARYKEYCONTROLSREADONLY",
ctrl.controlName + "." + (FHasReadOnlyProperty ? "ReadOnly = " : "Enabled = !") + "AReadOnly;" + Environment.NewLine);
}
if (ctrl.GetAttribute("ReadOnly").ToLower() != "true")
{
targetCodelet = targetCodelet.Replace("SHOW", "SAVE");
ProcessTemplate snippetGetData = writer.Template.GetSnippet("GETDATAFORCOLUMNTHATCANBENULL");
if (AField.GetDotNetType().ToLower().Contains("string"))
{
snippetGetData.SetCodelet("GETVALUEORNULL", "{#ROW}.{#COLUMNNAME} = {#CONTROLVALUE};");
snippetGetData.InsertSnippet("GETROWVALUEORNULL", writer.Template.GetSnippet("GETROWVALUEORNULLSTRING"));
}
else
{
snippetGetData.InsertSnippet("GETVALUEORNULL", writer.Template.GetSnippet("GETVALUEORNULL"));
snippetGetData.InsertSnippet("GETROWVALUEORNULL", writer.Template.GetSnippet("GETROWVALUEORNULL"));
}
snippetGetData.SetCodelet("CANBENULL", !AField.bNotNull && (this.GetControlValue(ctrl, null) != null) ? "yes" : "");
snippetGetData.SetCodelet("NOTDEFAULTTABLE", TestForNullTable);
snippetGetData.SetCodelet("DETERMINECONTROLISNULL", this.GetControlValue(ctrl, null));
snippetGetData.SetCodelet("ROW", RowName);
snippetGetData.SetCodelet("COLUMNNAME", fieldname);
snippetGetData.SetCodelet("CONTROLVALUE", this.GetControlValue(ctrl, AField.GetDotNetType()));
snippetGetData.SetCodelet("CONTROLNAME", ctrl.controlName);
writer.Template.InsertSnippet(targetCodelet, snippetGetData);
}
// setstatusbar tooltips for datafields, with getstring plus value from petra.xml
string helpText = AField.strHelp;
if (helpText.Length == 0)
{
helpText = AField.strDescription;
}
if ((helpText.Length > 0) && (ctrl.GetAttribute("Tooltip").Length == 0))
{
writer.Template.AddToCodelet("INITUSERCONTROLS", "FPetraUtilsObject.SetStatusBarText(" + ctrl.controlName +
", Catalog.GetString(\"" +
helpText.Replace("\"", "\\\"") + // properly escape double quotation marks
"\"));" + Environment.NewLine);
}
// Data Validation
if (GenerateDataValidationCode(writer, ctrl, out AutomDataValidation, out ReasonForAutomValidation))
{
string targetCodeletValidation = "ADDCONTROLTOVALIDATIONCONTROLSDICT";
ColumnIDStr = "FMainDS." + tablename + ".Columns[(short)FMainDS." + tablename + ".GetType().GetField(\"Column" + fieldname +
"Id\", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy).GetValue(FMainDS." + tablename +
".GetType())]";
if (writer.Template.FCodelets.Keys.Contains(targetCodeletValidation))
{
// Check if code for the addition of a certain DataColumn is is already contained in Template;
//.........这里部分代码省略.........
示例4: LinkControlPartnerShortNameLookup
/// <summary>
/// fetch the partner short name from the server;
/// this control is readonly, therefore we don't need statusbar help
/// </summary>
/// <param name="writer"></param>
/// <param name="ctrl"></param>
private void LinkControlPartnerShortNameLookup(TFormWriter writer, TControlDef ctrl)
{
string PartnerShortNameLookup = ctrl.GetAttribute("PartnerShortNameLookup");
bool IsDetailNotMaster;
TTableField field = TDataBinding.GetTableField(ctrl, PartnerShortNameLookup, out IsDetailNotMaster, true);
string showData = "TPartnerClass partnerClass;" + Environment.NewLine;
string RowName = "FMainDS." + TTable.NiceTableName(field.strTableName) + "[0]";
if ((TTable.NiceTableName(field.strTableName) == writer.CodeStorage.GetAttribute("DetailTable"))
|| (TTable.NiceTableName(field.strTableName) == writer.CodeStorage.GetAttribute("MasterTable")))
{
RowName = "ARow";
}
showData += "string partnerShortName;" + Environment.NewLine;
showData += "TRemote.MPartner.Partner.ServerLookups.WebConnectors.GetPartnerShortName(" + Environment.NewLine;
showData += " " + RowName + "." + TTable.NiceFieldName(field.strName) + "," +
Environment.NewLine;
showData += " out partnerShortName," + Environment.NewLine;
showData += " out partnerClass);" + Environment.NewLine;
showData += ctrl.controlName + ".Text = partnerShortName;" + Environment.NewLine;
writer.Template.AddToCodelet("SHOWDATA", showData);
}
示例5: SetControlProperties
/// <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, "SelectedRowActivates"))
{
// TODO: this function needs to be called by the manual code at the moment when eg a search finishes
// TODO: call "Activate" + TYml2Xml.GetAttribute(ctrl.xmlNode, "SelectedRowActivates")
}
StringCollection Columns = TYml2Xml.GetElements(ctrl.xmlNode, "Columns");
if (Columns.Count > 0)
{
writer.Template.AddToCodelet("INITMANUALCODE", ctrl.controlName + ".Columns.Clear();" + Environment.NewLine);
foreach (string ColumnFieldName in Columns)
{
bool IsDetailNotMaster;
TTableField field = null;
// customfield, eg. UC_GLTransactions, ATransaction.DateEntered and ATransaction.AnalysisAttributes
// there needs to be a list of CustomColumns
XmlNode CustomColumnsNode = TYml2Xml.GetChild(ctrl.xmlNode, "CustomColumns");
XmlNode CustomColumnNode = null;
if (CustomColumnsNode != null)
{
CustomColumnNode = TYml2Xml.GetChild(CustomColumnsNode, ColumnFieldName);
}
if (CustomColumnNode != null)
{
//string ColumnType = "System.String";
/* TODO DateTime (tracker: #58)
* if (TYml2Xml.GetAttribute(CustomColumnNode, "Type") == "System.DateTime")
* {
* ColumnType = "DateTime";
* }
*/
// TODO: different behaviour for double???
if (TYml2Xml.GetAttribute(CustomColumnNode, "Type") == "Boolean")
{
//ColumnType = "CheckBox";
}
writer.Template.AddToCodelet("INITMANUALCODE", ctrl.controlName + ".Columns.Add(" +
"FMainDS." + ctrl.GetAttribute("TableName") + ".Get" + ColumnFieldName + "DBName(), \"" +
TYml2Xml.GetAttribute(CustomColumnNode, "Label") + "\");" + Environment.NewLine);
}
else if (ctrl.HasAttribute("TableName"))
{
field =
TDataBinding.GetTableField(null, ctrl.GetAttribute("TableName") + "." + ColumnFieldName,
out IsDetailNotMaster,
true);
}
else
{
field = TDataBinding.GetTableField(null, ColumnFieldName, out IsDetailNotMaster, true);
}
if (field != null)
{
//string ColumnType = "System.String";
/* TODO DateTime (tracker: #58)
* if (field.GetDotNetType() == "System.DateTime")
* {
* ColumnType = "DateTime";
* }
*/
// TODO: different behaviour for double???
if (field.GetDotNetType() == "Boolean")
{
//ColumnType = "CheckBox";
}
writer.Template.AddToCodelet("INITMANUALCODE", ctrl.controlName + ".Columns.Add(" +
TTable.NiceTableName(field.strTableName) + "Table.Get" +
TTable.NiceFieldName(field.strName) + "DBName(), \"" +
field.strLabel + "\");" + Environment.NewLine);
}
}
}
if (ctrl.HasAttribute("ActionLeavingRow"))
{
AssignEventHandlerToControl(writer, ctrl, "Selection.FocusRowLeaving", "SourceGrid.RowCancelEventHandler",
ctrl.GetAttribute("ActionLeavingRow"));
}
if (ctrl.HasAttribute("ActionFocusRow"))
{
// TODO AssignEventHandlerToControl(writer, ctrl, "Selection.FocusRowEntered", "SourceGrid.RowEventHandler",
// ctrl.GetAttribute("ActionFocusRow"));
//.........这里部分代码省略.........
示例6: AdjustLabel
private static void AdjustLabel(XmlNode node, TCodeStorage CodeStorage, XmlDocument AOrigLocalisedYaml)
{
XmlNode TranslatedNode = TXMLParser.FindNodeRecursive(AOrigLocalisedYaml, node.Name);
string TranslatedLabel = string.Empty;
if (TranslatedNode != null)
{
TranslatedLabel = TXMLParser.GetAttribute(TranslatedNode, "Label");
}
TControlDef ctrlDef = new TControlDef(node, CodeStorage);
string Label = ctrlDef.Label;
if ((ctrlDef.GetAttribute("NoLabel") == "true") || (ctrlDef.controlTypePrefix == "pnl")
|| (TXMLParser.FindNodeRecursive(node.OwnerDocument, "act" + ctrlDef.controlName.Substring(ctrlDef.controlTypePrefix.Length)) != null)
|| ctrlDef.GetAttribute("Action").StartsWith("act"))
{
Label = string.Empty;
}
if ((ctrlDef.controlTypePrefix == "rgr") && (TXMLParser.GetChild(node, "OptionalValues") != null))
{
ProcessRadioGroupLabels(node);
}
else if (ctrlDef.controlTypePrefix == "mni")
{
// drop all attributes
node.Attributes.RemoveAll();
foreach (XmlNode menu in node.ChildNodes)
{
if (menu.Name.Contains("Separator"))
{
continue;
}
AdjustLabel(menu, CodeStorage, AOrigLocalisedYaml);
}
}
else
{
// drop all attributes and children nodes
node.RemoveAll();
}
if (Label.Length > 0)
{
if ((TranslatedLabel != Label) && (TranslatedLabel != Catalog.GetString(Label)) && (TranslatedLabel.Length > 0))
{
// add to po file
if (!NewTranslations.ContainsKey(Label))
{
NewTranslations.Add(Label, TranslatedLabel);
}
TXMLParser.SetAttribute(node, "Label", TranslatedLabel);
}
else
{
TXMLParser.SetAttribute(node, "Label", Catalog.GetString(Label));
}
}
}
示例7: WriteTableLayout
//.........这里部分代码省略.........
StringCollection widthStringCollection = new StringCollection();
for (int columnCounter = 0; columnCounter < FColumnCount; columnCounter++)
{
widthStringCollection.Add(ColumnWidth[columnCounter].ToString());
}
TLogging.Log("column width for " + LayoutCtrl.controlName + ": " + StringHelper.StrMerge(widthStringCollection, ','));
for (int rowCounter = 0; rowCounter < FRowCount; rowCounter++)
{
string rowText = string.Empty;
for (int columnCounter = 0; columnCounter < FColumnCount; columnCounter++)
{
if (FGrid[columnCounter, rowCounter] != null)
{
TControlDef childctrl = FGrid[columnCounter, rowCounter];
for (int countspan = 0; countspan < childctrl.colSpanWithLabel; countspan++)
{
rowText += string.Format("{0}:{1} ", columnCounter + countspan, childctrl.controlName);
}
}
}
TLogging.Log(String.Format(" Row{0}: {1}", rowCounter, rowText));
}
}
int Width = 0;
int Height = 0;
int CurrentLeftPosition = Convert.ToInt32(LayoutCtrl.GetAttribute("MarginLeft", MARGIN_LEFT.ToString()));
for (int columnCounter = 0; columnCounter < FColumnCount; columnCounter++)
{
int CurrentTopPosition;
if (LayoutCtrl.IsHorizontalGridButtonPanel)
{
TLogging.LogAtLevel(1,
"Setting CurrentTopPosition to 3 for all Controls on Control '" + LayoutCtrl.controlName +
"' as it is a horizontal Grid Button Panel (used for Buttons).");
CurrentTopPosition = 3;
}
else
{
CurrentTopPosition = Convert.ToInt32(LayoutCtrl.GetAttribute("MarginTop", MARGIN_TOP.ToString()));
}
// only twice the margin for groupboxes
if ((LayoutCtrl.controlTypePrefix == "grp") || (LayoutCtrl.controlTypePrefix == "rgr"))
{
CurrentTopPosition += MARGIN_TOP;
}
for (int rowCounter = 0; rowCounter < FRowCount; rowCounter++)
{
if (FGrid[columnCounter, rowCounter] != null)
{
TControlDef childctrl = FGrid[columnCounter, rowCounter];
if (childctrl.GetAttribute("Stretch") == "horizontally")
{
// use the full column width
示例8: SetControlProperties
/// <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;
}
示例9: SetControlProperties
/// <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;
}
示例10: GetControlValue
/// <summary>
/// how to get the value from the control
/// </summary>
protected override string GetControlValue(TControlDef ctrl, string AFieldTypeDotNet)
{
if (AFieldTypeDotNet == null)
{
return ctrl.controlName + ".Text.Length == 0";
}
if (ctrl.GetAttribute("Type") == "ShortTime")
{
return "(int)new Ict.Common.TypeConverter.TShortTimeConverter().ConvertTo(" + ctrl.controlName + ".Text, typeof(int))";
}
else if (ctrl.GetAttribute("Type") == "LongTime")
{
return "(int)new Ict.Common.TypeConverter.TLongTimeConverter().ConvertTo(" + ctrl.controlName + ".Text, typeof(int))";
}
else if (AFieldTypeDotNet.ToLower().Contains("int64"))
{
return "Convert.ToInt64(" + ctrl.controlName + ".Text)";
}
else if (AFieldTypeDotNet.ToLower().Contains("int"))
{
return "Convert.ToInt32(" + ctrl.controlName + ".Text)";
}
else if (AFieldTypeDotNet.ToLower().Contains("decimal"))
{
return "Convert.ToDecimal(" + ctrl.controlName + ".Text)";
}
return ctrl.controlName + ".Text";
}
示例11: AssignValue
/// <summary>
/// how to assign a value to the control
/// </summary>
protected override string AssignValue(TControlDef ctrl, string AFieldOrNull, string AFieldTypeDotNet)
{
if (AFieldOrNull == null)
{
return ctrl.controlName + ".Text = String.Empty;";
}
if (!AFieldTypeDotNet.ToLower().Contains("string"))
{
if (ctrl.GetAttribute("Type") == "PartnerKey")
{
// for readonly text box
return ctrl.controlName + ".Text = String.Format(\"{0:0000000000}\", " + AFieldOrNull + ");";
}
else if (ctrl.GetAttribute("Type") == "ShortTime")
{
// for seconds to short time
return ctrl.controlName + ".Text = new Ict.Common.TypeConverter.TShortTimeConverter().ConvertTo(" + AFieldOrNull +
", typeof(string)).ToString();";
}
else if (ctrl.GetAttribute("Type") == "LongTime")
{
// for seconds to long time
return ctrl.controlName + ".Text = new Ict.Common.TypeConverter.TLongTimeConverter().ConvertTo(" + AFieldOrNull +
", typeof(string)).ToString();";
}
return ctrl.controlName + ".Text = " + AFieldOrNull + ".ToString();";
}
return ctrl.controlName + ".Text = " + AFieldOrNull + ";";
}
示例12: ProcessChildren
/// <summary>
/// Handle 'special' Panels
/// </summary>
public override void ProcessChildren(TFormWriter writer, TControlDef ctrl)
{
SortedSet <int>ButtonWidths = new SortedSet <int>();
SortedSet <int>ButtonTops = new SortedSet <int>();
List <TControlDef>Buttons = new List <TControlDef>();
int NewButtonWidthForAll = -1;
if (ctrl.controlName == PNL_FILTER_AND_FIND)
{
listNumericColumns.Clear();
writer.Template.SetCodelet("FILTERANDFIND", "true");
writer.SetControlProperty(ctrl, "Dock", "Left");
writer.SetControlProperty(ctrl, "BackColor", "System.Drawing.Color.LightSteelBlue");
writer.SetControlProperty(ctrl, "Width", "0");
if (!ctrl.HasAttribute("ExpandedWidth"))
{
writer.Template.SetCodelet("FINDANDFILTERINITIALWIDTH", "150");
}
else
{
writer.Template.SetCodelet("FINDANDFILTERINITIALWIDTH", ctrl.GetAttribute("ExpandedWidth"));
}
if ((ctrl.HasAttribute("InitiallyExpanded"))
&& (ctrl.GetAttribute("InitiallyExpanded").ToLower() != "false"))
{
writer.Template.SetCodelet("FINDANDFILTERINITIALLYEXPANDED", "true");
}
else
{
writer.Template.SetCodelet("FINDANDFILTERINITIALLYEXPANDED", "false");
}
if (!ctrl.HasAttribute("ShowApplyFilterButton"))
{
writer.Template.SetCodelet("FINDANDFILTERAPPLYFILTERBUTTONCONTEXT", "TUcoFilterAndFind.FilterContext.None");
}
else
{
writer.Template.SetCodelet("FINDANDFILTERAPPLYFILTERBUTTONCONTEXT", "TUcoFilterAndFind." +
ctrl.GetAttribute("ShowApplyFilterButton"));
}
if (!ctrl.HasAttribute("ShowKeepFilterTurnedOnButton"))
{
writer.Template.SetCodelet("FINDANDFILTERSHOWKEEPFILTERTURNEDONBUTTONCONTEXT", "TUcoFilterAndFind.FilterContext.None");
}
else
{
writer.Template.SetCodelet("FINDANDFILTERSHOWKEEPFILTERTURNEDONBUTTONCONTEXT", "TUcoFilterAndFind." +
ctrl.GetAttribute("ShowKeepFilterTurnedOnButton"));
}
if (!ctrl.HasAttribute("ShowFilterIsAlwaysOnLabel"))
{
writer.Template.SetCodelet("FINDANDFILTERSHOWFILTERISALWAYSONLABELCONTEXT", "TUcoFilterAndFind.FilterContext.None");
}
else
{
writer.Template.SetCodelet("FINDANDFILTERSHOWFILTERISALWAYSONLABELCONTEXT", "TUcoFilterAndFind." +
ctrl.GetAttribute("ShowFilterIsAlwaysOnLabel"));
}
writer.Template.SetCodelet("CUSTOMDISPOSING",
"if (FFilterAndFindObject != null && FFilterAndFindObject.FilterFindPanel != null)" + Environment.NewLine +
"{" + Environment.NewLine +
" FFilterAndFindObject.FilterFindPanel.Dispose();" + Environment.NewLine +
"}");
XmlNodeList controlAttributesList = null;
XmlNode ctrlNode = ctrl.xmlNode;
foreach (XmlNode child in ctrlNode.ChildNodes)
{
if (child.Name == "ControlAttributes")
{
controlAttributesList = child.ChildNodes;
}
}
ProcessTemplate snippetFilterAndFindDeclarations = writer.Template.GetSnippet("FILTERANDFINDDECLARATIONS");
writer.Template.InsertSnippet("FILTERANDFINDDECLARATIONS", snippetFilterAndFindDeclarations);
ProcessTemplate snippetFilterAndFindMethods = writer.Template.GetSnippet("FILTERANDFINDMETHODS");
writer.Template.SetCodelet("INDIVIDUALFILTERPANELS", "");
writer.Template.SetCodelet("INDIVIDUALEXTRAFILTERPANELS", "");
writer.Template.SetCodelet("INDIVIDUALFINDPANELS", "");
writer.Template.SetCodelet("INDIVIDUALFILTERFINDPANELEVENTS", "");
writer.Template.SetCodelet("INDIVIDUALFILTERFINDPANELPROPERTIES", "");
writer.Template.SetCodelet("NUMERICFILTERFINDCOLUMNS", "");
writer.Template.SetCodelet("FILTERBUTTON", "");
//.........这里部分代码省略.........
示例13: SetControlProperties
/// <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 Width;
base.SetControlProperties(writer, ctrl);
if (ctrl.GetAttribute("Height").ToString() == "36") // 36 is the Height of pnlButtons/pnlDetailButtons Panels that have ControlsOrientation=horizontal and whose Buttons have been shrinked in size to 23 Pixels by the ButtonGenerator - and
{ // whose 'Height' Element hasn't been set in the YAML file...
if (ctrl.IsGridButtonPanel)
{
Width = ctrl.GetAttribute("Width").ToString();
// Somehow we can run into a situation where Width isn't specified. This would lead to writing out an
// invalid Size Property. To prevent that we set it to some value which we can find easily in files and
// which will be ignored anyway at runtime as the Panel will be Docked with 'DockStyle.Bottom'!
if (Width.Length == 0)
{
Width = "1111";
}
FDefaultHeight = 28;
TLogging.LogAtLevel(1, "Adjusted Height of Panel '" + ctrl.controlName + "' as it is a horizontal Grid Button Panel");
writer.SetControlProperty(ctrl, "Size", "new System.Drawing.Size(" +
Width + ", " + FDefaultHeight.ToString() + ")");
writer.SetControlProperty(ctrl, "BackColor", "System.Drawing.Color.Green");
}
}
return writer.FTemplate;
}
示例14: AddChildren
/// <summary>
/// add the children
/// </summary>
public override void AddChildren(TFormWriter writer, TControlDef ctrl)
{
if (ctrl.GetAttribute("UseTableLayout") != "true")
{
// first add the control that has Dock=Fill, then the others
foreach (TControlDef ChildControl in ctrl.Children)
{
if (ChildControl.GetAttribute("Dock") == "Fill")
{
writer.CallControlFunction(ctrl.controlName,
"Controls.Add(this." +
ChildControl.controlName + ")");
}
}
List <TControlDef>ControlsReverse = new List <TControlDef>();
foreach (TControlDef ChildControl in ctrl.Children)
{
ControlsReverse.Insert(0, ChildControl);
}
foreach (TControlDef ChildControl in ControlsReverse)
{
if (ChildControl.GetAttribute("Dock") != "Fill")
{
writer.CallControlFunction(ctrl.controlName,
"Controls.Add(this." +
ChildControl.controlName + ")");
}
}
}
}
示例15: SetControlProperties
/// <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);
ctrlSnippet.SetCodelet("PAGENUMBER", PageCounter.ToString());
if (writer.FTemplate.FCodelets.Keys.Contains("CUSTOMFUNCTIONS"))
{
ctrlSnippet.SetCodelet("CUSTOMFUNCTIONS", writer.FTemplate.FCodelets["CUSTOMFUNCTIONS"].ToString());
writer.FTemplate.FCodelets.Remove("CUSTOMFUNCTIONS");
}
else
{
ctrlSnippet.SetCodelet("CUSTOMFUNCTIONS", String.Empty);
}
if (writer.FTemplate.FCodelets.Keys.Contains("ONSHOW"))
{
ctrlSnippet.SetCodelet("ONSHOW", writer.FTemplate.FCodelets["ONSHOW"].ToString());
writer.FTemplate.FCodelets.Remove("ONSHOW");
}
if (writer.FTemplate.FCodelets.Keys.Contains("ISVALID"))
{
ctrlSnippet.SetCodelet("ISVALID", writer.FTemplate.FCodelets["ISVALID"].ToString());
writer.FTemplate.FCodelets.Remove("ISVALID");
}
if (writer.FTemplate.FCodelets.Keys.Contains("ONHIDE"))
{
ctrlSnippet.SetCodelet("ONHIDE", writer.FTemplate.FCodelets["ONHIDE"].ToString());
writer.FTemplate.FCodelets.Remove("ONHIDE");
}
if (ACtrl.HasAttribute("Height"))
{
ctrlSnippet.AddToCodelet("ONSHOW", String.Format("MainForm.setHeight({0});", ACtrl.GetAttribute("Height")));
}
if (ACtrl.HasAttribute("LabelWidth"))
{
ctrlSnippet.SetCodelet("LABELWIDTH", ACtrl.GetAttribute("LabelWidth"));
}
PageCounter++;
return ctrlSnippet;
}