我想做一个通用的清空文本框 过程其中实现如下:(清空tag属性被vatg的Tedit和Tcombobox) for i:=0 to vformname.componentcount-1 do
begin
if (vformname.Components[i].ClassType=Tedit) and (vformname.Components[i].Tag=vtag) then
(vformname.components[i] as Tedit).Text='';
if (vformname.Components[i].ClassType=Tcombobox) and (vformname.Components[i].Tag=vtag) then
(vformname.components[i] as Tedit).Text='';
end;但有个问题是我想以后用第三方控件是还必须得该此过程,因为比如像seskinedit,因为它是继承自:Tseskinedit,而不是Tedit,我想不到时候不用更改此过程;因为tseskinedit,tedit和tcombobox类都只是从Twincontrol继承来的谢谢大家!但如果用Twincontrol,更本就没有text属性;该怎么做!
begin
if (vformname.Components[i].ClassType=Tedit) and (vformname.Components[i].Tag=vtag) then
(vformname.components[i] as Tedit).Text='';
if (vformname.Components[i].ClassType=Tcombobox) and (vformname.Components[i].Tag=vtag) then
(vformname.components[i] as Tedit).Text='';
end;但有个问题是我想以后用第三方控件是还必须得该此过程,因为比如像seskinedit,因为它是继承自:Tseskinedit,而不是Tedit,我想不到时候不用更改此过程;因为tseskinedit,tedit和tcombobox类都只是从Twincontrol继承来的谢谢大家!但如果用Twincontrol,更本就没有text属性;该怎么做!
你的意思是把 (vformname.Components[i].ClassType=Tedit) 改为:(vformname.Components[i].classparent=Twindcontrol)吧,根本就不行,因为edit的是父类是TCustomEdit 而combobox的父类是Tcustomcombobx ,就算在后面再加ClassParent,直到Twincontrol,但还是没有属性text;