Closed himselfv closed 11 years ago
@r640.
Reported by himselfv
on 2013-08-03 13:23:56
It seems that the reason is that Kanji Details window has a TFormPlacement component
which was rewritten. In the new version it does SetWindowPlacement with the value of
showCmd it received from GetWindowPlacement. As it stands, all values which GetWindowPlacement
can return, activate the window when passed to SetWindowPlacement, which (silently
to Delphi) steals focus from the editor.
The fact that it's silent also explains why Delphi continues to think editor is focused,
and skips attempts at SetFocus().
There are alternative showCmd values which allow for showing the window without activation.
They are to be used with TFormPlacement for secondary forms.
This is probably also a reason for another bug, when TKanjiDetails is configured to
be visible and not docked on the start, its Visible property is thought to be false
although the form is visible.
Reported by himselfv
on 2013-09-24 12:45:39
Nope, TFormPlacement doesn't seem to have to do with this. (It was a cause for other
mentioned bugs though)
Reported by himselfv
on 2013-09-24 13:46:08
Reported by himselfv
on 2013-09-24 13:49:46
Reported by himselfv
on 2013-10-17 19:34:25
Turns out it all depends on a call to
fMenu.aPortraitMode.Checked := not fSettings.setPortraitMode;
fMenu.aPortraitMode.Execute;
If I disable this the focus is not lost, even when KanjiDetails is docked and no matter
what other forms are present and docked.
This probably has to do with that aPortraitModeExecute() undocks and then redocks already
docked forms.
Solution: Add a parameter (Loading:=true) which makes SetPortraitMode only configure
the permanent stuff (button captions, panel placement etc) but not apply the form docking.
In other words, there are two parts to SetPortraitMode:
1. Permanent part: change button captions, configure holder panels to be properly
aligned, etc. This must be done at least once for every portraitness change.
2. Transient part: adjust current state to reflect what would have happened
if we called ChangeDisplay with a new settings (e.g. redock forms).
With "Loading" set, we only apply the permanent part. We do that rather early, and
the transient part does not need to be applied because ChangeDisplay will be called
directly anyway a bit later.
Implemented this and it worked.
Reported by himselfv
on 2013-10-28 10:42:10
@r721.
Reported by himselfv
on 2013-10-28 11:30:34
Fixed
Reported by himselfv
on 2013-10-29 13:58:22
Original report by me.
Originally reported on Google Code with ID 187
Reported by
himselfv
on 2013-08-03 13:21:42