Delphi 清空某个Form的控件内容,用Tag来判断


本文整理自网络,侵删。

 
//清空某个Form的控件内容,用Tag来判断
procedure TBN.ClearEdit(Frm:TForm;iTag:integer);
var
  ChildCtrl:TComponent;
  icnt:Integer;
begin
  for icnt:= Frm.ComponentCount - 1 downto 0 do
  begin
    ChildCtrl:=Frm.Components[icnt];
    if (ChildCtrl is TEdit) and (ChildCtrl.tag=iTag) then
      TEdit(ChildCtrl).clear;
    if (ChildCtrl is TRzEdit) and (ChildCtrl.tag=iTag) then
      TRzEdit(ChildCtrl).clear;
    if (ChildCtrl is TCombobox) and (ChildCtrl.tag=iTag) then
      TCombobox(ChildCtrl).Text:='';
    if (ChildCtrl is TRzCombobox) and (ChildCtrl.tag=iTag) then
      TRzCombobox(ChildCtrl).Text:='';
    if (ChildCtrl is TRzButtonEdit) and (ChildCtrl.tag=iTag) then
      TRzButtonEdit(ChildCtrl).Text:='';
    if (ChildCtrl is TRzMemo) and (ChildCtrl.tag=iTag) then
      TRzMemo(ChildCtrl).Text:='';
    if (ChildCtrl is TMemo) and (ChildCtrl.tag=iTag) then
      TMemo(ChildCtrl).Text:='';
    if (ChildCtrl is TRadioGroup) and (ChildCtrl.Tag=iTag) then
      TRadioGroup(ChildCtrl).ItemIndex:=0;
    if (ChildCtrl is TRzButtonEdit) and (ChildCtrl.Tag=iTag) then
      TRzButtonEdit(ChildCtrl).Text:='';
    if (ChildCtrl is TDatetimePicker) and (ChildCtrl.Tag=iTag) then
      TDatetimePicker(ChildCtrl).DateTime:=now;
  end;
end;

相关阅读 >>

Delphi 取得文件夹及下一级文件夹下的文件列表

Delphi winapi: getmodulefilename、getmodulehandle

进程防杀Delphi版(dll部分)

Delphi [android]获取屏幕的物理分辨率

Delphi 窗体的位置和高宽度-tform:letf、top、width、height、clientwidth、clientheight

Delphi xe10 手机端错误提示:detected problems with api compatibility (visit g.co/dev/appcompat for more info

Delphi with do和for do语句

Delphi tlistview按指定列排序

Delphi webbrowser 表单赋值模拟点击

Delphi tparallel并行性能测试

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...