功能区控件

发布于 2024-09-16 06:31:19 字数 49 浏览 7 评论 0原文

如何使用 Delphi 启用在单击快速访问栏中的“更多命令”按钮后禁用的功能区按钮?

How do I enable ribbon buttons which are disabled after clicking the more commands button in a quickaccessbar using Delphi?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

云胡 2024-09-23 06:31:19

这是质量中心报告 70342 的已知错误

使用功能区控件时,如果有
添加快速访问工具栏,然后
在运行时选择“更多命令”
自定义快速访问工具栏,
许多(尽管并非总是全部)
各种功能区中的动作组件
团体将成为永久
已禁用。

请参阅报告本身以了解更多信息:
http://qc.embarcadero.com/wc/qcmain.aspx?d= 70342

报告仍然开放,所以我认为它可能在 D2011 中也没有得到解决,但 Quality Central 可能会落后一点。

更新

该报告指出没有解决办法,但 Jack Sudarev 在评论中发布了一个解决办法:

procedure TForm6.ActionManager1StateChange(Sender: TObject);
begin
UpdateActions(ActionManager1);
end;

procedure TForm6.UpdateActions(ActionManager: TActionManager);
var
  i: Integer;
begin
  if not Assigned(ActionManager) then
    Exit;

  for i := 0 to ActionManager.ActionCount - 1 do
  begin
    (ActionManager.Actions[i] as TAction).Enabled := False;
    (ActionManager.Actions[i] as TAction).Enabled := True;      
  end;
end;

This is a known bug

Quality Central report 70342:

When using Ribbon Controls, if one
adds a quick access toolbar, and then
at runtime chooses "More Commands" to
customize the quick access toolbar,
many (although not always all) of the
action components in various ribbon
groups will become permanently
disabled.

Please see the report itself for more information:
http://qc.embarcadero.com/wc/qcmain.aspx?d=70342

The report is still open, so I it may not have been solved in D2011 either, but Quality Central could be lagging behind a bit.

Update

The report states there is no work around, but Jack Sudarev posted one in the comments:

procedure TForm6.ActionManager1StateChange(Sender: TObject);
begin
UpdateActions(ActionManager1);
end;

procedure TForm6.UpdateActions(ActionManager: TActionManager);
var
  i: Integer;
begin
  if not Assigned(ActionManager) then
    Exit;

  for i := 0 to ActionManager.ActionCount - 1 do
  begin
    (ActionManager.Actions[i] as TAction).Enabled := False;
    (ActionManager.Actions[i] as TAction).Enabled := True;      
  end;
end;
你怎么这么可爱啊 2024-09-23 06:31:19

这就是我所做的:

procedure TmainTranslatform.MyUpdateActions(ActionManager: TActionManager);
var
  i: Integer;
begin
  if not Assigned(ActionManager) then
    Exit;

  for i := 0 to ActionManager.ActionCount - 1 do
  begin
  if (ActionManager.Actions[i] is TFileOpen)  then
  begin
    (ActionManager.Actions[i] as TFileOpen).Enabled := False;
    (ActionManager.Actions[i] as TFileOpen).Enabled := True;

  end;
  if (ActionManager.Actions[i] is TAction)  then
  begin
    (ActionManager.Actions[i] as TAction).Enabled := False;
    (ActionManager.Actions[i] as TAction).Enabled := True;
  end;
  end;
end;

This is what i did:

procedure TmainTranslatform.MyUpdateActions(ActionManager: TActionManager);
var
  i: Integer;
begin
  if not Assigned(ActionManager) then
    Exit;

  for i := 0 to ActionManager.ActionCount - 1 do
  begin
  if (ActionManager.Actions[i] is TFileOpen)  then
  begin
    (ActionManager.Actions[i] as TFileOpen).Enabled := False;
    (ActionManager.Actions[i] as TFileOpen).Enabled := True;

  end;
  if (ActionManager.Actions[i] is TAction)  then
  begin
    (ActionManager.Actions[i] as TAction).Enabled := False;
    (ActionManager.Actions[i] as TAction).Enabled := True;
  end;
  end;
end;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文