本文整理汇总了C#中TControlDef类的典型用法代码示例。如果您正苦于以下问题:C# TControlDef类的具体用法?C# TControlDef怎么用?C# TControlDef使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TControlDef类属于命名空间,在下文中一共展示了TControlDef类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
}
}
示例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);
}
}
示例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;
}
}
示例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;
}
示例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 + ";";
}
示例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)";
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例11: ApplyDerivedFunctionality
/// e.g. used for controls on Reports (readparameter, etc)
public virtual void ApplyDerivedFunctionality(TFormWriter writer, TControlDef control)
{
}
示例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);
}
}
}
}
示例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 + "\"");
}
}
示例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");
}
示例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);
}