Modal form doesn't have focus if parent window is inactive

Skip to first unread message

Jul 26, 2006, 3:15:13 PM7/26/06
I have a main windows form called frmMain and another form called
frmLogin. I don't want frm Main to display until the user successfully
logins in. I call frmLogin.ShowModal from within the OnLoad event of
frmMain. This displays frmLogin but the focus is not really on the
form even though the cursor is blinking in the first textbox. If you
start typing, it windows will type into what ever is behind frmLogin.
So I found this article that solved my focus problem:

However, now if I minimize a window that is behind frmLogin, frmLogin
is closed and frmMain is activated. Here are the steps to re-create:

1. Launch an App (say NotePad)
2. Launch frmMain which is not shown yet but shows frmLogin
3. Minimize Notepad
4. frmLogin is closed and frmMain is activated

Anyone have a clue?


Riki Wiki

Jul 29, 2006, 5:44:16 AM7/29/06
On 26 Jul 2006 12:15:13 -0700, wrote:

> Anyone have a clue?

Hoi Tony

You need to repost your question on the Borland news server to make
everybody see it and possibly answer your question. Further, this news
group do not officially exist, the group to use is

How to post to Delphi newsgroups:

Sep 27, 2012, 1:43:13 AM9/27/12
Hello unknown man... you most call the frmLogin before frmMain... thast the trick!
Reply all
Reply to author
0 new messages