How to force a delphi form to be in foreground in windows 10 tablet mode -
this setting:
i have 2 views implemented within 2 different vcl forms. 1 of applied style make touch optimized metro app. forms can switched according application's setting. (show touch optimized view on/off)
this works pretty good. override application.mainform
, old form closes, new form appears (and takes focus).
i want automated in windows 10. additional view mode offer option "auto detect":
- i listening windows message
wm_settingchange
. sent switching between desktop mode , tablet mode. - then check registry value of
hkey_current_user\software\microsoft\windows\currentversion\immersiveshell\tabletmode
- if it's 1 switch touch optimized view.
and problem:
the old form destroyed, new form pops , application.mainform
references new form. buf afterwards start screen of tablet mode pops , shows on top of windows. new touch optimized form disappears behind screen , loses focus. behavior doesn't appear if set view fixed desktop view , switch windows 10 tablet mode. in case, application keeps focus , maximizes (that way there's no form created of course).
what i've tried far:
- the obvious approach call of
application.mainform.bringtofront
.this doesn't work. - my second approach create hidden "helperform" takes
formstyle := fsstayontop
(this way focus should taken) , callssetforeground(application.mainform.handle)
winapi.
any ideas?
Comments
Post a Comment