Registering and using TActionManager

I was hoping to include TActionManager in the IDE palette, then create TActions at run time and associate everything in a script.

Has anyone managed this? Any guidance to how I might approach this?

I can get things registered easily enough:


IDEScripter1.DefineClassByRTTI(TActionManager,            '', [mvpublic, mvpublished], true, TRedefineOption.roInclude);
IDEScripter1.DefineClassByRTTI(TActionList,            '', [mvpublic, mvpublished], true, TRedefineOption.roInclude);
IDEScripter1.DefineClassByRTTI(TAction,            '', [mvpublic, mvpublished], true, TRedefineOption.roInclude);

 With IDEEngine1 do
  begin
    BeginRegisterComponents;
    try
      RegisterComponent('Additional',     TActionManager, 'ActnMan');
      RegisterComponent('Additional',     TActionList, 'ActnList');
    finally
      EndRegisterComponents;
    end;
  end;



But hooking everything up in a script isn't as trivial as I'd hoped...

TIA.

Cheers,
EdB

Hello Ed,


I guess that by "hooking everything up" you mean the design-time editors? Indeed, since those editors are available as design-time packages, they are not available from Scripter IDE. No design-time editor available in Delphi IDE can be automatically added in Scripter IDE, unfortunately.

Hi Wagner, thanks for response, I was looking for run-time code, not design-time.

But even something simpler might work.

In a form module with a button, I have:


var
  actProcessRaw: TAction;  

procedure ActProcessRawExecute(Sender:TObject);
begin
  ShowMessage('hello from process raw');
end;

begin               
   actProcessRaw:= TAction.Create(self);
   actProcessRaw.Caption := 'Click Me';
   actProcessRaw.OnExecute := ActProcessRawExecute; 
   button1.Action := actProcessRaw;        
 end;             



It won't allow the assignment of    actProcessRaw.OnExecute := ActProcessRawExecute;  - complaining that the subroutine is missing a parameter...

Is this sort of thing also not possible?

Thanks.

EdB

It works a lot better if I run:


(sigh)

Thanks.

Did you try putting the event name between quotes:



   actProcessRaw.OnExecute := 'ActProcessRawExecute';

Yeah - it "works a lot better" that way.

:)

EdB