本文整理汇总了C#中Ict.Tools.CodeGeneration.TFormWriter.SetEventHandlerToControl方法的典型用法代码示例。如果您正苦于以下问题:C# TFormWriter.SetEventHandlerToControl方法的具体用法?C# TFormWriter.SetEventHandlerToControl怎么用?C# TFormWriter.SetEventHandlerToControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ict.Tools.CodeGeneration.TFormWriter
的用法示例。
在下文中一共展示了TFormWriter.SetEventHandlerToControl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: AssignEventHandlerToControl
/// <summary>
/// assign event handler to control
/// </summary>
public void AssignEventHandlerToControl(TFormWriter writer, TControlDef ctrl, string AEvent, string AEventHandlerType, string ActionToPerform)
{
if ((AEvent == null) || (AEvent.Length == 0))
{
return;
}
if (ActionToPerform.StartsWith("act"))
{
TActionHandler ActionHandler = writer.CodeStorage.FActionList[ActionToPerform];
if (ActionHandler.actionId.Length > 0)
{
// actionId is managed by FPetraUtilsObject
// need a special function that wraps calls to FPetraUtilsObject, otherwise problems in designer
ActionToPerform = ActionHandler.actionName;
}
else if (ActionHandler.actionClick.Length > 0)
{
if (ActionHandler.actionClick.StartsWith("FPetraUtilsObject"))
{
// need a special function that wraps calls to FPetraUtilsObject, otherwise problems in designer
ActionToPerform = ActionHandler.actionName;
}
else
{
// direct call
ActionToPerform = ActionHandler.actionClick;
}
}
else
{
ActionToPerform = "";
}
}
else
{
// direct call: use ActionToPerform
}
if (ActionToPerform.Length > 0)
{
writer.SetEventHandlerToControl(ctrl.controlName, AEvent, AEventHandlerType, ActionToPerform);
}
}