本来我想在(actions[1] as taction)的后面取enable属性的(如下代码样就行了),但是却怎么也取不到enable属性,输入'e'进去只能取到execute开头的属性,不解!?,不知为何,在线急待procedure Tlandingfrm.FormHide(Sender: TObject);
var
astr:string;
begin
astr:=mindatamodule.adolog.FieldValues['permit'];
begin
with mainpagefrm.ActionList1 do
begin
  if astr[1]:='1' then
  (actions[1] as taction).enable:=true
  else
  (actions[1] as taction).enable:=true;
if astr[2]:='1' then
  (actions[2] as taction).enable:=true
  else
  (actions[2] as taction).enable:=true;
....
end;
end;

解决方案 »

  1.   

    actions[1] as taction)换成:TAction(actionlist1.Actions[1])试试
      

  2.   

    zhangl_cn提供的办法是正确的,你原来的写法也是没有问题的
    我这里测试都是正确的。
      

  3.   

    是不是不能放在hide事件中,因为我在从landingfrm窗体进入mainpagefrm窗体时,使用hide事件以隐藏landingfrm窗体,如此是不是会受影响,同时我还调用了一个数据表的数据来作判断
      

  4.   

    现在我还不知道到底是什么的原因,但是已基本其取不到enable属性的错误之处,是由于使用或不正当的使用了数据为adolog的原因,只去这断代码,就行,有谁能讲出为什么吗,后来我改正确之后,即可以取到enable了
    begin
    with mindatamodule.adolog do
    begin
    close;
    sql.Clear;
    sql.Add('select permit from tuser where login='+char(39)+landingfrm.landedt1.Text+char(39));
    open;
    astr:=mindatamodule.adolog.FieldValues['permit'];
    if astr[3]='1' then
     (actionlist1.Actions[1] as taction).Enabled:=true
    else
     (actionlist1.Actions[1] as taction).Enabled:=false;
     if astr[2]='1' then
     (actionlist1.Actions[2] as taction).Enabled:=true
     else
     (actionlist1.Actions[3] as taction).Enabled:=false;
    ......