Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2004-09-17
2
215 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
code issue 8 154
drawing animated level bar based on numbers 3 104
can't find the executable in Simulator 1 100
Tembedded WB animatid gifs not animated on some pcs 2 84
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

860 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