I have a drop-down menu attached to drop-down button on a toolbar. It may be that some items of this menu are disabled, while others are not. Problem is that if Action, associated with the button is disabled, then not only the button itself, but also arrow which invokes the menu is disabled.
So, is it possible to access drop-down menu when the action, associated with the button, is disabled?
Thank you in advance!
Upd:
As a workaround I did following: wrote a function which, if a button is disabled, finds enabled Item in its menu and associates this item with the button:
procedure TMainForm.FindActiveAction(Btn: TToolButton);
var
I: Integer;
TheAction:TAction;
begin
with Btn do
begin
if (Style <> tbsDropDown) or Enabled then Exit;
for I := 0 to DropDownMenu.Items.Count - 1 do
begin
TheAction := TAction(DropDownMenu.Items[I].Action);
if Assigned(TheAction) and TheAction.Enabled then
Action := TheAction;
end;
end;
end;
and call this from Idle for each button where such situation is possible.
So, whenever a "title" action is disabled for a button with drop-donw menu, it is replaced with an active one.