I create a drop down menu for a TActionClientItem with list of TAction. I would like to know how can I hook the drawing event for the menu or each TAction inside to display the caption of those TAction in differente way !? Something like TAction.OnDrawItem or TActionClientItem .OnDrawItem ...
procedure xxxxx.BuildActionMenu;
var
iLoop : Integer;
oItem : TAction;
oClientItem : TActionClientItem;
begin
if Assigned(oClientItem) then
for iLoop := oClientItem.Items.Count - 1 downto 0 do
oClientItem.Items.Delete(iLoop);
for iLoop := 0 to List.Count - 1 do
begin
oItem := TAction.Create(actionList);
oItem.Caption := List[iLoop].Name;
oItem.Tag := iLoop;
oItem.OnExecute := HandleOnExecuteMenuItem;
**oItem.OnDraw = WhateverFunction**
oClientItem .Items.Add.Action := oItem;
end;
if Assigned(oClientItem) then
begin
if oClientItem.CommandProperties is TButtonProperties then
TButtonProperties(oClientItem.CommandProperties).ButtonType := btSplit;
TAction(oClientItem.Action).OnExecute := HandleOnExecuteParentItem;
**oClientItem.OnDraw = WhateverFunction**
end;
end;
Cheers.
Custom drawing event handlers are always attached to the UI components and not to actions. So with the plain VCL you cannot do what you ask.
It would be simple enough to derive your own action class that added an OnDraw event. You would also have to derive your own dropdown menu class to provide the other end of the connection.