假设有多个action对象,名字分别为:ac001,ac002,ac003...ac[n],tag值分别为1,2,3,n .现在有一菜单menu,通过变量i,指定menu的不同的ACTION,即当i为1的时候,menu.action:=ac001,当i=2时,menu.action:=ac002,i=n时,menu.action:=ac[n].
这句话该怎么写?通过名字怎么写?通过tag又怎么写?
注:不要用判断语句if i=1 then menu.action :=ac001等。
这句话该怎么写?通过名字怎么写?通过tag又怎么写?
注:不要用判断语句if i=1 then menu.action :=ac001等。
解决方案 »
- 请教类似迅雷右下角广告弹出怎么做?
- delphi中,TXmlDocument怎样直接设置某个节点的XML值?
- 求:系统接口的解决方案
- 哪位大佬连我测试“结贴”功能发的2分贴也删除?
- [散分2]明天最后一天,祝兄弟姐妹们开心,快乐...不要像我这样郁闷
- 许久没有接触Delphi,又开始使用Delphi做东西了!(散分)
- 菜鸟送分题,大家帮忙
- 等--------------如何把WORD文件另存为别的文件
- 100分问题!来的都有分
- 做广告有什么不对的,比一比看谁的论坛速度更快>>>>
- 调用华为SMEIDLL.dll中的SubmitAExEx函数发送返回总是4,还请高手指教!(解决后另赠100分)
- 看看这个问题。。。。数据显示同步的问题
var
iLoop : Integer;
begin
Result := nil;
for iLoop := 0 to ActionList1.ActionCount - 1 do
begin
if ActionList1.Actions[iLoop].Name = sName then
begin
Result := ActionList1.Actions[iLoop];
break;
end;
end;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
Menu.Action := GetAction('001');
end;
for example
var
sName;
sName := '000'+IntToStr(i);
sName := 'ac'+SubString(sName, Length(sName)-2, 3);
if (FindComponent(sName) != nil and FindComponent(sName).InheritsFrom(TACTION)) then
menu.action := TACTION(FindComponent(sName));