Recent

Author Topic: Bug in OpenPictureDialog  (Read 1809 times)

winni

  • Hero Member
  • *****
  • Posts: 3197
Bug in OpenPictureDialog
« on: September 26, 2020, 06:54:57 pm »
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

  • Hero Member
  • *****
  • Posts: 6090
Re: Bug in OpenPictureDialog
« Reply #1 on: September 26, 2020, 08:24:50 pm »
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?


The only true wisdom is knowing you know nothing

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Bug in OpenPictureDialog
« Reply #2 on: September 26, 2020, 09:32:51 pm »
Hi!

Magic behaviour.
Microsoft would call that  a wizard!

I will test in Linux.

Winni

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Bug in OpenPictureDialog
« Reply #3 on: September 26, 2020, 09:38:53 pm »
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

  • Hero Member
  • *****
  • Posts: 3197
Re: Bug in OpenPictureDialog
« Reply #4 on: September 26, 2020, 10:29:19 pm »
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

Bug report submitted https://bugs.freepascal.org/view.php?id=37820

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Bug in OpenPictureDialog
« Reply #5 on: September 27, 2020, 03:56:52 am »
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.  >:D

In the "Win32WSDialogs" unit.. Around line 500 or so,

Code: Pascal  [Select][+][-]
  1. function OpenFileDialogCallBack(Wnd: HWND; uMsg: UINT; wParam: WPARAM;
  2.  

 Down a little bit..

Code: Pascal  [Select][+][-]
  1. begin
  2.   Result := 0;
  3.   if uMsg = WM_INITDIALOG then
  4.   begin
  5.     // Windows asks us to initialize dialog. At this moment controls are not
  6.     // arranged and this is that moment when we should set bounds of our dialog
  7.     //Reposition(GetParent(Wnd));  << Commented this out ! JP
  8.      Reposition(Wnd); //Added this JP
  9.   end
  10.   else
  11.   if uMsg = WM_NOTIFY then
  12.   begin                          
  13.  

Why do you get the parent of a dialog box when you are suppose to be adjusted the dialog box itself ?
« Last Edit: September 27, 2020, 04:02:39 am by jamie »
The only true wisdom is knowing you know nothing

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Bug in OpenPictureDialog
« Reply #6 on: September 27, 2020, 03:45:46 pm »
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... ?

The only true wisdom is knowing you know nothing

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Bug in OpenPictureDialog
« Reply #7 on: September 27, 2020, 08:21:32 pm »
I have submitted the patch to the bug page..
https://bugs.freepascal.org/view.php?id=37821
The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018