我actionlist的enable属性从数据库中读取,但是button却接收不了,要重新赋值
 button1.Action:= TAction(ActionList1.Actions[0])才可以,而用visible属性不用重新赋值,为什么?是不是有什么地方要设置?如果每个button都要重新赋值,那太麻烦了。但是设置visible属性的话,界面又不好看。

解决方案 »

  1.   

    先直接设置Button1.Action属性, 再从数据库中读取Enabled值的值,应该可以的.
      

  2.   

    早就设置好了,就是不行啊,我都搞了一整天了,visible就可以,enable就不行,enable就是要重新赋值,是不是要在onexecute中写什么代码啊?
      

  3.   

    将button的action设置为action1,action1的enable为true
    procedure TForm1.Button2Click(Sender: TObject);
    begin
    TAction(ActionList1.Actions[0]).Enabled:=false;
    end;
    执行后button1的enable并未变为false;
    但是将enable改为visible的话,执行后button1就不可见了,真的很奇怪。
      

  4.   

    procedure TForm1.ActionList1Update(Action: TBasicAction;
      var Handled: Boolean);
    begin
    Handled:=true;
    end;