Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 162
  • 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

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

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