How to Assign OnGetAlignment dynamically?

Hello!

I have to assign "OnGetAlignment" (on a AdvStringGrid) at runtime.
But the assignment

sgAgeDev.OnGetAlignment := sgGetAlignment;

results in an compiler error:

[DCC Error] uFrmMain.pas(3846): E2010 Inkompatible Types: 'AdvObj.TVAlignment' and 'uFrmMain.TVAlignment'

Anyway *.TVAlignment is totaly wrong here.

sgGetAlignment is defined like
procedure sgGetAlignment(Sender: TObject; ARow, ACol: Integer;
      var HAlign: TAlignment; var VAlign: TVAlignment);

which was automatically build at design time.

I did not found any solution by type casting...

Do you have any idea?


This is a shortcoming of the Delphi HPP file generator.

Prefix the parameter type with its namespace in the event handler declaration in both cpp & hpp file (i.e. add the prefix 'AdvObj::')

Thank's for your reply, Bruno!
Sorry, but how to do it in PASCAL?

Did you add the unit AdvObj to the uses list?

Short answer: yes 

When unit AdvObj is added, I cannot see a problem here implementing OnGetAlignment of TAdvStringGrid in Delphi.

Hello Bruno!

Thank you for your hint. It seems it depends on the order in the "uses list".
I put AdvObj to the end of the list and now the source compiles...