Search code examples
delphivclfastreport

Get selected component in Fastreport editor?


Is there any way of getting the object/component the user selects on the report's editor? I mean, is there any way of Delphi application being aware of which item/object/component has been selected?

for instance, if I click on a TfrxMemoView or TfrxPictureView I would like my Delphi app to identify that object so that you can work with it, something like this...

myMemo := myDesigner.getSelected;

or

myMemo := myReport.getSelected;

I am using FastReports VCL 6.

If you know how to achieve that it would be pretty helpful.


Solution

  • well, in case you need to do the same as I needed, I managed to do so by this:

    for I := 0 to Report.Designer.SelectedObjects.Count - 1 do
        begin
         ShowMessage(TfrxComponent(Report.Designer.SelectedObjects.Items[i]).Name);
          if TfrxComponent(Report.Designer.SelectedObjects.Items[i]) is TfrxMemoView then
           begin
             TfrxMemoView(Report.Designer.SelectedObjects.Items[i]).Align:= baLeft;
             Report.Designer.ReloadObjects();{to refresh the designer as it was embedded in a panel and I wanted to change components properties on "realtime"}
           end;
        end;