Using FindDialog and ReplaceDialog with a SynEdit component lazarus / 8-Other ---------------------------------------------------------------------- Zomis · 2007-02-19 20:21 I just added a FindDialog and a ReplaceDialog to my program, but now I wonder, how to use them on my SynEdit component? Any code examples? I wish those Dialogs just simply had a "Component" property and everything would be pre-written code for the Dialogs, but that doesn't seem to be the case :roll: ---------------------------------------------------------------------- Bart · 2007-02-21 13:25 It seems to me that TFindDialog and TReplaceDialog are broken (at least in Win32 Lazarus 0.9.20). Since I could not find a bugrep, so I just posted one  (0008370). Bart ---------------------------------------------------------------------- Bart · 2007-02-28 17:49 I just posted a (partial) solution to this in the bugrep on Mantis (see link in the message above). [Edit] And I just added a proposal to get the helpbutton working as well. [/Edit] Bart ---------------------------------------------------------------------- Bart · 2007-03-04 17:32 I just proposed a fix for TFindDialog and TReplaceDialog that  should solve the problems mentioned before. Made the dialog a non-modal one, while I was at it. Hope it gets picked up soon (or dismissed as rubbish, since I'm not soo very good at this ;-). Bart ---------------------------------------------------------------------- Vincent Snijders · 2007-03-04 23:04 I will look at it in the coming weeks. Why did you make this dialog non-modal? ---------------------------------------------------------------------- Bart · 2007-03-07 15:40 Hi Vincent, Quote from: "Vincent"I will look at it in the coming weeks. That would be nice. I'ld really like to contribute to Lazarus, but I run into things that are just a little bit too complex for me. I'm just a "for fun" programmer. I mostly do stuf that uses simple VCL (LCL) components and most of my apps use edit-like controls and dialogs. So I need them to behave well, if ever I'm gonna switch to Lazarus, as I intend to do (cannot affor Delphi anymore, Turbo Delphi wil not even let me install SynEdit package, which I really love, and I'm gonna have a go at Linux and want to be able to make programs there as well). Since this dialog was broken and the roadmap claims "Difficulty Level:   low", I thought I would give it a go. Quote from: "Vincent"Why did you make this dialog non-modal? For several reasons: 1: Delphi does it this way, so for compatibility reasons. (Actually Delphi launches a Windows built-in Find/Replace dialog (AFAIK) that behaves like that.) (The execute result in Delphi (3) is always true if it succeeds in displaying the dialog, it does not depend on a ModalResult, so I wanted to keep that also, but that can be implemented independant of the modality of the dialog of course.) 2. It gives users the option to find the next occurence simply by pressing Find (Find More) again, and keep the dialog visible while  they are editing their text. I use this quite a lot. I know one can implement a "Find again" feature (and I do that in my apps), but for the common end user it is simpler that way. Most Windows users hardly ever use keyboard shortcuts, they'll walk the menu with their mouse, so keeping the dialog visible is a service to the user (I know Linux users are not so daft...) 3. Most Office like apps do it this way AFAIK (at least M$ Office and OpenOffice.org), so the user is probably expecting it to behave like that (I know I was, I was rather stumped that clicking Find closed the dialog, and I could not leave the dialog without closing it). I feel dialogs should behave as users expect them to. The latter two argument are the important ones for me. I hope I made myself clear (this is not my native language). (Regarding Delphi compatibility I would even suggest that the TSearchReplaceOptions could do with an extra option: frPromptOnReplace, (and the ofcourse also frHidePromptOnRepalce and frDisablePromptOnReplace) to give users control (in the dialog) over wether or not to prompt before replacing text if he presses Replace All.) However making it non-modal creates problems (but then again, it would be rather boring if no problems arose, would it now). If the dialog looses focus, then it disappears behind the "calling" app/form. This is not what should happen. Setting the dialogs formstyle to fsStayOnTop partially solves this in Win32 (but it does not behave as Delphi does this), in Linux it does nothing at all (see my remarks on this in http://www.lazarus.freepasca l.org/index.php?name=PNphpBB2&file=viewtopic&t=3489) Bart