Solved

how do I move to a control on delphi form

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

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 25

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 36

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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 demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

707 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

15 Experts available now in Live!

Get 1:1 Help Now