Jump to content
emileverh

NameOf() in D13 to get the name of the current method

Recommended Posts

Hi guys!

 

I want to use in Delphi 13 the NameOf() function to get the current function name ( "UploadCardParseResult" in example below). Is that possible?!

 

procedure TdtmPeppolInvoices.UploadCardParseResult(const AJsonString: string; const AHxr: THXR);
begin
  ShowMessage( NameOf(????) );

 

  

Share this post


Link to post
37 minutes ago, emileverh said:

I want to use in Delphi 13 the NameOf() function to get the current function name

That's not what NameOf does: https://docwiki.embarcadero.com/RADStudio/Florence/en/What's_New#NameOf_Instrict_Function

In short, there's no function to get the current function name.

 

You can search these fora for various hacks, and I'm sure someone will post suggestions, but I wouldn't recommend any of them.

Share this post


Link to post
1 hour ago, emileverh said:

I want to use in Delphi 13 the NameOf() function to get the current function name ( "UploadCardParseResult" in example below). Is that possible?!

procedure TdtmPeppolInvoices.UploadCardParseResult(const AJsonString: string; const AHxr: THXR);
begin
  ShowMessage( NameOf(TdtmPeppolInvoices.UploadCardParseResult) ); 

 

Share this post


Link to post

With the introduction of NameOf there are still gaps where it doesn't work (partly huge ones). I guess we can expect extensions to NameOf targets in future updates and releases.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×