- in trial: ReadMe.chm | License
- in full version: Install.chm | License
In a normal application, a state of all actions (Enabled, Checked) is updated periodically when this application is idle.
In DLL or ActiveX, it does not happen.
The solution is creating a timer and calling UpdateTarget in OnTimer.
1) Example for TRichViewEdit.
This example assumes that all actions work with RichViewEdit1, and all of them are placed on rvActionsResource datamodule.
Place Timer1: TTimer on the form.
Assign Timer1.Interval = 300.
Timer1.OnTimer:
Code: Select all
procedure TForm3.Timer1Timer(Sender: TObject);
var i: Integer;
begin
for i := 0 to rvActionsResource.ComponentCount-1 do
if rvActionsResource.Components[i] is TAction then
TAction(rvActionsResource.Components[i]).UpdateTarget(RichViewEdit1);
end;
Code: Select all
procedure TForm3.DoActionsExecute(Sender: TObject);
begin
TAction(Sender).ExecuteTarget(RichViewEdit1);
end;
Code: Select all
for i := 0 to rvActionsResource.ComponentCount-1 do
if rvActionsResource.Components[i] is TAction then
TAction(rvActionsResource.Components[i]).OnExecute := DoActionsExecute;