• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 166
  • Last Modified:

Current component

Hi.

How can i get the name os current component selected on the form?

I'm build a delphi-like IDE and i need to know current component selected do make some changes and other things.
0
Jmaurin
Asked:
Jmaurin
  • 2
1 Solution
 
Russell LibbySoftware Engineer, Advisory Commented:
The ActiveControl property of the form will return this

Regards,
Russell
0
 
pcsentinelCommented:

[formName].ActiveControl.Name;

regards
0
 
Russell LibbySoftware Engineer, Advisory Commented:
Its best to check the ActiveControl first, as it can be nil which would cause an access violation if the following was executed

Form.ActiveControl.Name

It should be changed to the something similar to the following (check for nil first):

  if Assigned(ActiveControl) then
     ShowMessage(ActiveControl.Name);


Russell
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now