Hi!I double checked it and made sure that it was, and it was, but then I moved it to a different procedure (instead of FormCreate), and now it works. Do you know how I can keep the formatting of the other text in the RichMemo?
'String to replace' is not contained in your RichMemo1.Lines.Text.
Winni
Put a Button on Form1 for find/replace.
Create a small second Form with one Edit for search and another for replace.
Put a Button on the second from with find/replace.
What do you want to do? More find and replace?The StringReplace works now, but it removes all existing Rtf formatting in the RichMemo. I was wondering if there is a way to preserve this formatting, and Replace the string with the same font as the string that is being replaced? Thanks.
The StringReplace works now, but it removes all existing Rtf formatting in the RichMemo. I was wondering if there is a way to preserve this formatting, and Replace the string with the same font as the string that is being replaced? Thanks.StringReplace does what it says, it replaces the string. But it does not know anything about the formatting that RichMemo would like to apply to the text in the string.
So I have a question about the TReplaceDialog , since I've never used it. I just checked it and it gives you a option to search entire file ? How do you specify a file path\name ?
I think that is a little misleading wouldn't you say ?
what os?I'm on Windows 10. Thanks for testing it on your end - did you do your procedure the same as me? In the background there, it looks like you haven't declared the InsertStyledText procedure, but it might just be out of view.
it looks like you haven't declared the InsertStyledText procedure, but it might just be out of view.you don't need to declare the procedure. It's declared and implemented in richmemoutils.
Thank you very much, I missed out the RichMemoUtils unit - it's working perfectly now.it looks like you haven't declared the InsertStyledText procedure, but it might just be out of view.you don't need to declare the procedure. It's declared and implemented in richmemoutils.
all you need is to add the unit to the uses section
uses Classes, SysUtils, ..., Dialogs, RichMemo, RichMemoUtils;
Hi!I've always used FormCreate to execute code in pretty much the same manner before, this is the first time it has not worked - what other procedure can I use to execute code as soon as the form (and it's components) have initialized?
FormCreate exists to iniialize your component - not to execute some cod that relies that everything is already initialized.
I've always used FormCreate to execute code in pretty much the same manner before, this is the first time it has not worked - what other procedure can I use to execute code as soon as the form (and it's components) have initialized?
This handler is called when the form receives focus for the first time at application start up and then subsequently each time focus is changed from another window of the same application to this window.So be carefull, that FormActivate() can be called more then once. If I have code there, that should be executed only once, I use a local typed const for that:
For focus changes between different applications the Application.OnActivate handler is called instead.
Thank you, I did see that on the wiki, but I didn't know how to only call something once only [...]
Wow, neat trick !
procedure TForm1.FormActivate(Sender: TObject); begin OnActivate := Nil; {So it's never called again} { ... do whatever else ... } end;
Wow, neat trick !
What happened to the wiki page we talked about listing clever tricks like this ?
What happened to the wiki page we talked about listing clever tricks like this ?
Dunno. I don't remember having ever talked about it. :-[
Sound like a good idea though it would need quite some maintenance.
What do you want to do? More find and replace?The StringReplace works now, but it removes all existing Rtf formatting in the RichMemo. I was wondering if there is a way to preserve this formatting, and Replace the string with the same font as the string that is being replaced? Thanks.