View Issue Details

IDProjectCategoryView StatusLast Update
0037820LazarusLCLpublic2020-09-27 16:49
Reporterwinni Assigned ToJuha Manninen  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformLinux 64OSSuse 
Product Version2.0.10 
Summary0037820: TOpenPictureDialog - bug with ofAutoPreview
DescriptionIn 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.

Winni
Steps To ReproduceA Form, a TOpenPictureDialog and a Button.

Set ofAutoPreview in the Dialog to true.
The button executes the Dialog.

First Time : No Preview icture.
>= Second Time: Preview Picture exists.

TagsofAutoPreview, openPictureDialog
Fixed in Revisionr63926
LazTarget-
WidgetsetGTK 2
Attached Files

Activities

winni

2020-09-27 03:04

reporter   ~0125890

Due to forum there are also problems in Windows:

https://forum.lazarus.freepascal.org/index.php/topic,51578.msg378794.html#msg378794

Anton Kavalenka

2020-09-27 11:09

reporter   ~0125894

Amazingly, this is LCL problem. Patch attached fixes the logic.
extdlgs.diff (1,109 bytes)   
Index: lcl/extdlgs.pas
===================================================================
--- lcl/extdlgs.pas	(revision 63925)
+++ lcl/extdlgs.pas	(working copy)
@@ -51,6 +51,7 @@
   TPreviewFileDialog = class(TOpenDialog)
   private
     FPreviewFileControl: TPreviewFileControl;
+    function GetPreviewFileControl:TPreviewFileControl;
   protected
     class procedure WSRegisterClass; override;
     procedure CreatePreviewControl; virtual;
@@ -58,7 +59,7 @@
     function DoExecute: boolean; override;
   public
     constructor Create(TheOwner: TComponent); override;
-    property PreviewFileControl: TPreviewFileControl read FPreviewFileControl;
+    property PreviewFileControl: TPreviewFileControl read GetPreviewFileControl;
   end;
 
   { TOpenPictureDialog }
@@ -279,6 +280,13 @@
 
 { TPreviewFileDialog }
 
+function TPreviewFileDialog.GetPreviewFileControl: TPreviewFileControl;
+begin
+  if not Assigned(fPreviewFileControl) then
+    Self.CreatePreviewControl;
+  Result:=fPreviewFileControl;
+end;
+
 class procedure TPreviewFileDialog.WSRegisterClass;
 begin
   inherited WSRegisterClass;
extdlgs.diff (1,109 bytes)   

Anton Kavalenka

2020-09-27 11:53

reporter   ~0125898

Test app attached. It takes me wasting 1 minute of time which can be spent on bug fixing.

Anton Kavalenka

2020-09-27 11:53

reporter   ~0125899

openpic.zip (108,510 bytes)

Juha Manninen

2020-09-27 16:49

developer   ~0125901

Applied, thanks.

Issue History

Date Modified Username Field Change
2020-09-26 22:24 winni New Issue
2020-09-26 22:26 winni Tag Attached: openPictureDialog
2020-09-26 22:26 winni Tag Attached: ofAutoPreview
2020-09-27 03:04 winni Note Added: 0125890
2020-09-27 11:09 Anton Kavalenka Note Added: 0125894
2020-09-27 11:09 Anton Kavalenka File Added: extdlgs.diff
2020-09-27 11:53 Anton Kavalenka Note Added: 0125898
2020-09-27 11:53 Anton Kavalenka Note Added: 0125899
2020-09-27 11:53 Anton Kavalenka File Added: openpic.zip
2020-09-27 16:47 Juha Manninen Assigned To => Juha Manninen
2020-09-27 16:47 Juha Manninen Status new => assigned
2020-09-27 16:49 Juha Manninen Status assigned => resolved
2020-09-27 16:49 Juha Manninen Resolution open => fixed
2020-09-27 16:49 Juha Manninen Fixed in Revision => r63926
2020-09-27 16:49 Juha Manninen LazTarget => -
2020-09-27 16:49 Juha Manninen Widgetset GTK 2 => GTK 2
2020-09-27 16:49 Juha Manninen Note Added: 0125901