1

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

Michael Myers
  • 188,989
  • 46
  • 291
  • 292
Rajesh
  • 11
  • 2

2 Answers2

8

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;
Marjan Venema
  • 19,136
  • 6
  • 65
  • 79
  • Note that [QualityCentral has now been shut down](https://community.embarcadero.com/blogs/entry/quality-keeps-moving-forward), so you can't access `qc.embarcadero.com` links anymore. If you need access to old QC data, look at [QCScraper](http://www.uweraabe.de/Blog/2017/06/09/how-to-save-qualitycentral/). – Remy Lebeau Jun 09 '17 at 17:54
1

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;
Christian Specht
  • 35,843
  • 15
  • 128
  • 182
lim
  • 11
  • 1