Pergunta

So, I have this virtual keyboard...

It's inside a dll, and based on a StayOnTop Modal form. It's called by a function, that returns a WideString with the typed text. This virtual keyboard has it's own TEdit where the user writes and see's what he's writing.

The required behavior is for they KB form to stay on top, and with focus, until the Esc or Enter keys are pressed.

One of the calls to this keyboard happens within the OnShow event of the main form, so it is not visible by the time the keyboard is called the first time.

This always happened until now.

I created a splash form to guide the user through the various steps that are happening until the moment the main form actually loads: Skin loading, plugin loading, db initializing, etc.

The splash screen shows up as soon as the DataModule OnCreate is executed, and is closed on the OnActivate of the main form. So this splash form is not StayOnTop - It doesn't need to be, as it is to close right in the moment the main form shows up.

Somewhere in the middle, the keyboard shows up, so the user can input some required data.

By my account, the keyboard should grab the focus, as it is a modal window, but truth is, the splash form has the focus until I click on the keyboard form, which is what I want to avoid.

If the splash form is called prior to the keyboard, no Modal, no StayOnTop, can someone tell me why it keeps in focus, and how to avoid it if possible.

PS: I did find other questions in SO regarding similar problems, but turns out to be the opposite: Wanting the StayOnTop form to loose focus to the main one. That's not what I need.

Foi útil?

Solução

Well, I solved my problem. And a simple one it was...

I just added Application.ProcessMessages right before calling the keyboard.

The focus now goes to the keyboard for as long as it is visible.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top