Jump to content
Fabian1648

[FMX][Android]How get control name under the click?

Recommended Posts

Hi,

 

In an Delphi Rio FMX app, how can we get the name of the control if we click on it?

 

In a VCL, we can use:

ctrl := FindVCLWindow(Mouse.CursorPos) ;  
ShowMessage(ctrl.Name);

Is there a similar approach for FMX?

Share this post


Link to post
8 minutes ago, Fabian1648 said:

Hi,

 

In an Delphi Rio FMX app, how can we get the name of the control if we click on it?

 

In a VCL, we can use:


ctrl := FindVCLWindow(Mouse.CursorPos) ;  
ShowMessage(ctrl.Name);

Is there a similar approach for FMX?

ObjectAtPoint should be what you searching for.

Share this post


Link to post

Why are you simply not using the Sender of the click event?

procedure TMyForm.MyControlClick(Sender: TObject);
begin
  ShowMessage(TControl(Sender).Name);
end;

 

Edited by Remy Lebeau
  • Like 2

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

×