Solved

how do I move to a control on delphi form

Posted on 2014-12-08
5
123 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
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: …
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

914 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

22 Experts available now in Live!

Get 1:1 Help Now