Solved

How to do a Setfocus on a Dynamically created visual component (Syntax)

Posted on 2004-09-17
2
213 Views
Last Modified: 2010-04-05
Platform D7.

In this project, there are multiple controls dynamically created based on a the contents of a data set that defines them.  That part is all up and running.  As they are created, I set the TAG component and relate it to the DB definition so that I can go back and find the component.

I am using the search components[I] technique below to find the component.
Var TargetComponent: Integer;

        For I:=1 to ComponentCount -1 do
        Begin
          If Components[I].Tag = TargetComponent then
          Begin
            TargetComponentName:= Components[I].Name;
            Components[I]. xxxxx   .SetFocus;                        <================= Help here.          
          End;
        End;

Since components are not established at Design Time, working to locate, and then reference some of the components values, and get Focus set to that control based on another program event.   Having problems with the Syntax to get the .SETFOCUS part to work.  
0
Comment
Question by:chart11610
2 Comments
 
LVL 22

Accepted Solution

by:
Ferruccio Accalai earned 500 total points
ID: 12084407
If Components[i] is TwinControl then
   TwinControl(Components[i]).SetFocus;
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 12084422
//........
            (Components[I] as TWinControl).SetFocus; // Hope this helps ....          
//........

0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This video discusses moving either the default database or any database to a new volume.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now