View Issue Details

IDProjectCategoryView StatusLast Update
0034297LazarusIDEpublic2018-09-19 14:56
Reporterwp Assigned ToBart Broersma  
Status closedResolutionfixed 
Target Version1.8.6Fixed in Version1.8.6 
Summary0034297: Issues with testing TFindDialog and TReplaceDialog in form designer
DescriptionThe descendants of TCommonDialog have a component editor which allows testing the corresponding dialog at designtime when the dialog is double-clicked in the form designer. This does not work correctly for TFindDialog and TReplaceDialog:

- TFindDialog: the dialog is not centered vertically but is at the top of the screen, the title bar is even above the screen top such that only a thin stripe is available for grabbing with the mouse.

- TReplaceDialog: the dialog cannot be closed any more. In Laz trunk, the dialog is at position (0, 0), in older versions it is again at the screen top such that the title bar is no longer visible at all and the form cannot be moved to another place. The dialog is poorly designed (overlapping controls - see attached screenshot) in contrast to run time.

This description is for Windows 10. On Linux I see essentially the same issues, except for the top position of the dialog which does not reach beyond the screen top.
Steps To ReproduceAt design time, drop a TFindDialog on a form. Double-click on the component and see the bug.

Repeat with TReplaceDialog.
Additional InformationI looked at older Lazarus installations on my system: Version 1.2 was the last one on my system which was still ok. The next installation 1.4.4 already has the bug.

TagsNo tags attached.
Fixed in Revisionr59083
Attached Files


related to 0033528 closedBart Broersma The Position property of the TFindDialog or TReplaceDialog components is ignored 



2018-09-18 22:37


replacedlg.png (5,110 bytes)   
replacedlg.png (5,110 bytes)   

Bart Broersma

2018-09-19 12:42

developer   ~0110875

Last edited: 2018-09-19 12:43

View 2 revisions

Yeah, it's horrible indeed.
Not sure it's related to 0033528 though.


2018-09-19 13:22

developer   ~0110876

It is related to 0033528 in the sense that now the top position of the ReplaceDialog is at (0, 0) and the dialog can be moved with the mouse. But you are right, 0033528 certainly did not cause the issue because it has been there for a long time.

Bart Broersma

2018-09-19 13:55

developer   ~0110879

Last edited: 2018-09-19 13:56

View 2 revisions

There is something iffy going on with TReplaceDialog in the IDE.
If you test the dialog then this happens with TFindDialog:
- Execute is called
- Execute calls CalcPosition (in CalcPosition I now have a check for csDesigning and simply set Position to poScreenCenter)
- After CalcPosition Execute calls FFindForm.Show

Now I put in a blocking ShowMessage in CalcPosition for quick debugging.
For TFindDialog this works as expected.
I see the ShowMessage and the dialog only appears after I click the ShowMessage away.

For TReplaceDialog however this does NOT happen.
Execute is called, the ShowMessage appears, but simultaneously (?) the TReplaceDialog is shown.
And by the look of that form SetLayout has not been called yet, which is rather strange, since that should be called in the CreateNew constructor for TReplaceDialogForm.

Bart Broersma

2018-09-19 14:27

developer   ~0110883

Inside CalcPosition I can see that aForm.Showing is False in the case of TFindDialog (as expected) but True for TReplaceDialog.
The TReplaceDialog seems to be shown before CalcPosition returns.
I also can see that TReplaceDialog.SetLayout is being called, which makes this even more a mystery to me.

Bart Broersma

2018-09-19 14:34

developer   ~0110884

And all this insanity goes away by changing this in TReplaceDialog.CreateForm:
  Result := TReplaceDialogForm.CreateNew(Self,Options);
  Result := TReplaceDialogForm.CreateNew(nil,Options);

And yes, in TFindDialog.CreateForm you find:
  // do not use Self as Owner, otherwise as desgntime this will not work
  Result := TFindDialogForm.CreateNew(nil,Options);

I really don't know how this (retruning prematurely from a function that has a blocking showmessage) can happen though.

Bart Broersma

2018-09-19 14:40

developer   ~0110885

Please test and close if OK.


2018-09-19 14:56

developer   ~0110886

Wow! Thank you.

Issue History

Date Modified Username Field Change
2018-09-18 22:36 wp New Issue
2018-09-18 22:36 wp Summary Issues with testing TFindDialog and TReplaceDialog in desinger => Issues with testing TFindDialog and TReplaceDialog in form designer
2018-09-18 22:37 wp File Added: replacedlg.png
2018-09-18 22:38 wp Description Updated View Revisions
2018-09-18 22:39 wp Description Updated View Revisions
2018-09-19 10:12 wp Relationship added related to 0033528
2018-09-19 12:42 Bart Broersma Note Added: 0110875
2018-09-19 12:42 Bart Broersma Status new => confirmed
2018-09-19 12:43 Bart Broersma Note Edited: 0110875 View Revisions
2018-09-19 13:22 wp Note Added: 0110876
2018-09-19 13:55 Bart Broersma Note Added: 0110879
2018-09-19 13:56 Bart Broersma Note Edited: 0110879 View Revisions
2018-09-19 14:27 Bart Broersma Note Added: 0110883
2018-09-19 14:34 Bart Broersma Note Added: 0110884
2018-09-19 14:35 Bart Broersma Assigned To => Bart Broersma
2018-09-19 14:35 Bart Broersma Status confirmed => assigned
2018-09-19 14:40 Bart Broersma Fixed in Revision => r59083
2018-09-19 14:40 Bart Broersma LazTarget - => 1.8.6
2018-09-19 14:40 Bart Broersma Note Added: 0110885
2018-09-19 14:40 Bart Broersma Status assigned => resolved
2018-09-19 14:40 Bart Broersma Fixed in Version => 1.8.6
2018-09-19 14:40 Bart Broersma Resolution open => fixed
2018-09-19 14:40 Bart Broersma Target Version => 1.8.6
2018-09-19 14:56 wp Note Added: 0110886
2018-09-19 14:56 wp Status resolved => closed