Solved

how do I move to a control on delphi form

Posted on 2014-12-08
5
133 Views
Last Modified: 2015-05-30
setfocus
0
Comment
Question by:howdiam1
5 Comments
 
LVL 31

Accepted Solution

by:
Marco Gasi earned 168 total points
ID: 40487913
Maybe you could use some more words, but if you want give focus to a control, as you said, you have to use SetFocus:
Button1.SetFocus;
Edit1.SetFocus;

Open in new window

If you want to know something else, I don't understan what it could be...
0
 
LVL 26

Assisted Solution

by:Sinisa Vuk
Sinisa Vuk earned 166 total points
ID: 40487939
sometimes is good to check if focus is available:
if btn.CanFocus then btn.SetFocus;

Open in new window

0
 
LVL 37

Assisted Solution

by:Geert Gruwez
Geert Gruwez earned 166 total points
ID: 40522619
better is this :
ActiveControl := your_control;

it'll try to move the focus ... if not, nothing happens.

you can even set this in the form properties.
the control you set in that property will be the active control when the form is shown

be aware that it should be a component which can receive focus.
usually a descendant of TControl
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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.

Question has a verified solution.

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

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 Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

791 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