本文整理汇总了C#中TControlDef类的典型用法代码示例。如果您正苦于以下问题:C# TControlDef类的具体用法?C# TControlDef怎么用?C# TControlDef使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TControlDef类属于命名空间,在下文中一共展示了TControlDef类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SetControlProperty
/// <summary>
/// check if the control has an attribute with the property name in the xml definition
/// if such an attribute exists, then set it
/// </summary>
/// <param name="ACtrl"></param>
/// <param name="APropertyName"></param>
public virtual void SetControlProperty(TControlDef ACtrl, string APropertyName)
{
if (TYml2Xml.HasAttribute(ACtrl.xmlNode, APropertyName))
{
SetControlProperty(ACtrl, APropertyName, TYml2Xml.GetAttribute(ACtrl.xmlNode, APropertyName));
}
}
开发者ID:js1987,项目名称:openpetragit,代码行数:13,代码来源:FormWriter.cs
示例2: GenerateDeclaration
/// <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);
}
}
开发者ID:Davincier,项目名称:openpetra,代码行数:12,代码来源:ControlGeneratorBars.cs
示例3: 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;
}
}
开发者ID:Davincier,项目名称:openpetra,代码行数:40,代码来源:Validation.cs
示例4: 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)
{
// 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;
}
开发者ID:Davincier,项目名称:openpetra,代码行数:9,代码来源:ControlGeneratorProvider.cs
示例5: 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 + ".Date = null;";
}
return ctrl.controlName + ".Date = " + AFieldOrNull + ";";
}
开发者ID:js1987,项目名称:openpetragit,代码行数:12,代码来源:ControlGeneratorTextboxes.cs
示例6: 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 + ".Date == null";
}
if (AFieldTypeDotNet.Contains("Date?"))
{
return ctrl.controlName + ".Date";
}
return "(" + ctrl.controlName + ".Date.HasValue?" + ctrl.controlName + ".Date.Value:DateTime.MinValue)";
}
开发者ID:js1987,项目名称:openpetragit,代码行数:17,代码来源:ControlGeneratorTextboxes.cs
示例7: 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)
{
// 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);
// 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;
}
开发者ID:Davincier,项目名称:openpetra,代码行数:51,代码来源:ControlGenerator.cs
示例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)
{
ProcessTemplate snippetRowDefinition = writer.FTemplate.GetSnippet(FControlDefinitionSnippetName);
((TExtJsFormsWriter)writer).AddResourceString(snippetRowDefinition, "LABEL", ctrl, ctrl.Label);
StringCollection Controls = FindContainedControls(writer, ctrl.xmlNode);
snippetRowDefinition.AddToCodelet("ITEMS", "");
if (Controls.Count > 0)
{
// used for radiogroupbox
foreach (string ChildControlName in Controls)
{
TControlDef childCtrl = FCodeStorage.FindOrCreateControl(ChildControlName, ctrl.controlName);
IControlGenerator ctrlGen = writer.FindControlGenerator(childCtrl);
ProcessTemplate ctrlSnippet = ctrlGen.SetControlProperties(writer, childCtrl);
ctrlSnippet.SetCodelet("COLUMNWIDTH", "");
ctrlSnippet.SetCodelet("ITEMNAME", ctrl.controlName);
ctrlSnippet.SetCodelet("ITEMID", childCtrl.controlName);
if (ctrl.GetAttribute("hideLabel") == "true")
{
ctrlSnippet.SetCodelet("HIDELABEL", "true");
}
else if (ChildControlName == Controls[0])
{
((TExtJsFormsWriter)writer).AddResourceString(ctrlSnippet, "LABEL", ctrl, ctrl.Label);
}
snippetRowDefinition.InsertSnippet("ITEMS", ctrlSnippet, ",");
}
}
else
{
// used for GroupBox, and Composite
TExtJsFormsWriter.InsertControl(ctrl, snippetRowDefinition, "ITEMS", "HiddenValues", writer);
TExtJsFormsWriter.InsertControl(ctrl, snippetRowDefinition, "ITEMS", "Controls", writer);
}
return snippetRowDefinition;
}
开发者ID:Davincier,项目名称:openpetra,代码行数:46,代码来源:ControlGroupGenerator.cs
示例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)
{
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;
}
开发者ID:Davincier,项目名称:openpetra,代码行数:19,代码来源:ControlGeneratorComboboxes.cs
示例10: ProcessChildren
/// <summary>
/// process the children
/// </summary>
public override void ProcessChildren(TFormWriter writer, TControlDef container)
{
// usually, the toolbar buttons are direct children of the toolbar control
List <XmlNode>childrenlist = TYml2Xml.GetChildren(container.xmlNode, true);
foreach (XmlNode childNode in childrenlist)
{
/* Get unique name if we need it
* at the moment we need it only for menu separators
*/
String UniqueChildName = childNode.Name;
TControlDef childCtrl = container.FCodeStorage.GetControl(childNode.Name);
if (childCtrl == null)
{
UniqueChildName = TYml2Xml.GetAttribute(childNode, "UniqueName");
childCtrl = container.FCodeStorage.GetControl(UniqueChildName);
}
container.Children.Add(childCtrl);
IControlGenerator ctrlGenerator = writer.FindControlGenerator(childCtrl);
ctrlGenerator.GenerateControl(writer, childCtrl);
}
}
开发者ID:Davincier,项目名称:openpetra,代码行数:27,代码来源:ControlGeneratorBars.cs
示例11: ApplyDerivedFunctionality
/// e.g. used for controls on Reports (readparameter, etc)
public virtual void ApplyDerivedFunctionality(TFormWriter writer, TControlDef control)
{
}
开发者ID:Davincier,项目名称:openpetra,代码行数:4,代码来源:ControlGeneratorBase.cs
示例12: ProcessChildren
/// <summary>
/// generate the children, and write the size of this control
/// </summary>
public override void ProcessChildren(TFormWriter writer, TControlDef ctrl)
{
XmlNode Controls = TXMLParser.GetChild(ctrl.xmlNode, "Controls");
if (Controls != null)
{
StringCollection childControls = TYml2Xml.GetElements(Controls);
// this is a checkbox that enables another control or a group of controls
ctrl.SetAttribute("GenerateWithOtherControls", "yes");
if (childControls.Count == 1)
{
TControlDef ChildCtrl = ctrl.FCodeStorage.GetControl(childControls[0]);
ChildCtrl.parentName = ctrl.controlName;
ctrl.Children.Add(ChildCtrl);
ChildCtrl.SetAttribute("DependsOnRadioButton", "true");
// use the label of the child control
if (ChildCtrl.HasAttribute("Label"))
{
ctrl.Label = ChildCtrl.Label;
}
}
else
{
foreach (string child in childControls)
{
TControlDef ChildCtrl = ctrl.FCodeStorage.GetControl(child);
if (ChildCtrl == null)
{
throw new Exception("cannot find control " + child + " which should belong to " + ctrl.controlName);
}
ChildCtrl.parentName = ctrl.controlName;
ctrl.Children.Add(ChildCtrl);
ChildCtrl.SetAttribute("DependsOnRadioButton", "true");
IControlGenerator ctrlGenerator = writer.FindControlGenerator(ChildCtrl);
ctrlGenerator.GenerateControl(writer, ChildCtrl);
}
}
}
}
开发者ID:Davincier,项目名称:openpetra,代码行数:50,代码来源:ControlGeneratorBase.cs
示例13: SetControlActionProperties
/// <summary>
/// Sets the properties of a control which are defined under "Actions:" in the .yaml file
/// </summary>
/// <param name="writer"></param>
/// <param name="ctrl"></param>
/// <param name="AActionHandler"></param>
public virtual void SetControlActionProperties(TFormWriter writer, TControlDef ctrl, TActionHandler AActionHandler)
{
if (AActionHandler.actionImage.Length > 0)
{
/* Get the name of the image for the toolbar button
* and put it into the resources.
* The images must be in the directory specified by the ResourceDir command line parameter
*/
writer.SetControlProperty(ctrl, "Image",
"((System.Drawing.Bitmap)resources" + ctrl.controlType + ".GetObject(\"" + ctrl.controlName + ".Glyph\"))");
writer.AddImageToResource(ctrl.controlName, AActionHandler.actionImage, "Bitmap");
}
if ((AActionHandler.actionTooltip.Length > 0) && (ctrl.controlTypePrefix != "btn"))
{
writer.SetControlProperty(ctrl, "ToolTipText", "\"" + AActionHandler.actionTooltip + "\"");
}
}
开发者ID:Davincier,项目名称:openpetra,代码行数:24,代码来源:ControlGeneratorBase.cs
示例14: AddChildUserControlExtraCalls
private static void AddChildUserControlExtraCalls(TFormWriter writer, TControlDef ctrl)
{
Console.WriteLine("adding to codelet: UserControl-specific extensions");
writer.Template.AddToCodelet("USERCONTROLSRUNONCEONACTIVATION", ctrl.controlName + ".RunOnceOnParentActivation();" + Environment.NewLine);
writer.Template.AddToCodelet("SAVEDATA", ctrl.controlName + ".GetDataFromControls();" + Environment.NewLine);
writer.Template.AddToCodelet("PRIMARYKEYCONTROLSREADONLY", ctrl.controlName + ".SetPrimaryKeyReadOnly(AReadOnly);" + Environment.NewLine);
writer.Template.AddToCodelet("USERCONTROLVALIDATION",
ctrl.controlName + ".ValidateAllData(false, TErrorProcessingMode.Epm_None);" + Environment.NewLine);
writer.Template.SetCodelet("PERFORMUSERCONTROLVALIDATION", "true");
}
开发者ID:Davincier,项目名称:openpetra,代码行数:10,代码来源:ControlGeneratorBase.cs
示例15: AssignEventHandlerToControl
/// <summary>
/// overload
/// </summary>
/// <param name="writer"></param>
/// <param name="ctrl"></param>
/// <param name="AEvent">Click or DoubleClick or other</param>
/// <param name="ActionToPerform"></param>
public void AssignEventHandlerToControl(TFormWriter writer, TControlDef ctrl, string AEvent, string ActionToPerform)
{
AssignEventHandlerToControl(writer, ctrl, AEvent, "System.EventHandler", ActionToPerform);
}
开发者ID:Davincier,项目名称:openpetra,代码行数:11,代码来源:ControlGeneratorBase.cs
示例16: UndoValue
/// <summary>
/// how to undo the change of a value of a control
/// </summary>
protected virtual string UndoValue(TControlDef ctrl, string AFieldOrNull, string AFieldTypeDotNet)
{
return AssignValue(ctrl, AFieldOrNull + ".ToString()", AFieldTypeDotNet);
}
开发者ID:Davincier,项目名称:openpetra,代码行数:7,代码来源:ControlGeneratorBase.cs
示例17: AddChildren
/// <summary>
/// add the children to this control
/// </summary>
public virtual void AddChildren(TFormWriter writer, TControlDef ctrl)
{
}
开发者ID:Davincier,项目名称:openpetra,代码行数:6,代码来源:ControlGeneratorBase.cs
示例18: GenerateControl
/// <summary>
/// generate all code for the control
/// </summary>
public void GenerateControl(TFormWriter writer, TControlDef ctrl)
{
GenerateDeclaration(writer, ctrl);
ProcessChildren(writer, ctrl);
SetControlProperties(writer, ctrl);
OnChangeDataType(writer, ctrl.xmlNode, ctrl.controlName);
writer.InitialiseDataSource(ctrl.xmlNode, ctrl.controlName);
writer.ApplyDerivedFunctionality(this, ctrl);
AddChildren(writer, ctrl);
}
开发者ID:Davincier,项目名称:openpetra,代码行数:13,代码来源:ControlGeneratorBase.cs
示例19: SetControlProperties
/// add and install event handler for change of selection
public override ProcessTemplate SetControlProperties(TFormWriter writer, TControlDef ctrl)
{
base.SetControlProperties(writer, ctrl);
writer.Template.AddToCodelet("CHECKEDCHANGED_" + ctrl.controlName, string.Empty);
foreach (TControlDef ChildCtrl in ctrl.Children)
{
// make sure the control is enabled/disabled depending on the selection of the radiobutton
writer.Template.AddToCodelet("CHECKEDCHANGED_" + ctrl.controlName,
ChildCtrl.controlName + ".Enabled = " + ctrl.controlName + ".Checked;" + Environment.NewLine);
}
writer.CodeStorage.FEventHandlersImplementation += "void " + ctrl.controlName + "CheckedChanged(object sender, System.EventArgs e)" +
Environment.NewLine + "{" + Environment.NewLine + " {#CHECKEDCHANGED_" +
ctrl.controlName + "}" + Environment.NewLine +
"}" + Environment.NewLine + Environment.NewLine;
writer.Template.AddToCodelet("INITIALISESCREEN", ctrl.controlName + "CheckedChanged(null, null);" + Environment.NewLine);
writer.Template.AddToCodelet("CONTROLINITIALISATION",
"this." + ctrl.controlName +
".CheckedChanged += new System.EventHandler(this." +
ctrl.controlName +
"CheckedChanged);" + Environment.NewLine);
writer.Template.AddToCodelet("INITACTIONSTATE", ctrl.controlName + "CheckedChanged(null, null);" + Environment.NewLine);
return writer.Template;
}
开发者ID:Davincier,项目名称:openpetra,代码行数:28,代码来源:ControlGeneratorBase.cs
示例20: 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);
}
开发者ID:Davincier,项目名称:openpetra,代码行数:32,代码来源:ControlGeneratorBase.cs
注:本文中的TControlDef类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论