Bug in OpenPictureDialog lazarus / 31-LCL ---------------------------------------------------------------------- winni · 2020-09-26 16:54 HI1! In the TOpenPictureDialog is a option ofAutoPreview. Enabling this option the dialog shows a small preview at the right side of the dialog. Whatever you do: the preview is not shown if you execute it for the first time. If you execute it the next times the preview is shown - ok. There must be a problem while initialising the dialog. Have not yet looked inside the code. Lin64 Laz 2.0.10 Winni ---------------------------------------------------------------------- jamie · 2020-09-26 18:24 That isn't the only problem... In windows if you enable the use of the Old style Dialog, when displayed, moves the Main form to the center of the screen and the dialog is shown where the main form was. what kind of logic is that? ---------------------------------------------------------------------- winni · 2020-09-26 19:32 Hi! Magic behaviour. Microsoft would call that  a wizard! I will test in Linux. Winni ---------------------------------------------------------------------- winni · 2020-09-26 19:38 Hi! Nope. In Linux the Dialog does not do such magic nonsense. Look into the code. Somewhere they must have exchanged the mainForm and the DialogForm. This can happen with the heavy use of "with": Sometimes you don't know to which component the action goes! Winni ---------------------------------------------------------------------- winni · 2020-09-26 20:29 Quote from: winni on September 26, 2020, 06:54:57 pmHI1! In the TOpenPictureDialog is a option ofAutoPreview. Enabling this option the dialog shows a small preview at the right side of the dialog. Whatever you do: the preview is not shown if you execute it for the first time. If you execute it the next times the preview is shown - ok. There must be a problem while initialising the dialog. Have not yet looked inside the code. Lin64 Laz 2.0.10 Winni Bug report submitted https://bugs.freepascal.org/view.php?id=37820 ---------------------------------------------------------------------- jamie · 2020-09-27 01:56 It looks like I've found the problem with the Dialogs positioning the active form instead of itself.. I find it ironic at times how these bugs mysteriously crop up, or maybe not so mysterious.  In the "Win32WSDialogs" unit.. Around line 500 or so, Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function OpenFileDialogCallBack(Wnd: HWND; uMsg: UINT; wParam: WPARAM;  Down a little bit.. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i begin  Result := 0;  if uMsg = WM_INITDIALOG then  begin    // Windows asks us to initialize dialog. At this moment controls are not    // arranged and this is that moment when we should set bounds of our dialog    //Reposition(GetParent(Wnd));  << Commented this out ! JP   Reposition(Wnd); //Added this JP   end  else  if uMsg = WM_NOTIFY then  begin                         Why do you get the parent of a dialog box when you are suppose to be adjusted the dialog box itself ? ---------------------------------------------------------------------- jamie · 2020-09-27 13:45 Apparently that fix isn't 100%. It works exactly like my old Delphi does now, places the Dialog at the center of the screen and does not move the active form.   But this isn't so well either..  Testing recent Delphi 10.3, it would appear the old dialog option is ignored when testing with TopenDialog, it simply uses the OS Vista style. I don't know if this is a bug in Delphi or intentional ?  I've found that if I comment out the call to "Reposition", it works exactly like the Vista style and up Dialogs in windows, The dialog when showing follows the active form and I think that is more desirable and you still get the old style dialog showing as it should be.  Maybe a proper patch could be made to simply comment out the "Reposition" call... ? ---------------------------------------------------------------------- jamie · 2020-09-27 18:21 I have submitted the patch to the bug page.. https://bugs.freepascal.org/view.php?id=37821