Forum > LCL
Find/replace dialogs, with synMemo - help
mike parr:
Hi (my first post)
I'm trying to convert delphi code - with find/replace dialogs and a richEdit - to Lazarus, and also use a synMemo..
I think that the main problem is find/replace (I know richEdit differs from synmemo, but I can handle that, I think.
I'm looking for some standard code which links to the find/replace dialogs, and have done lots of searches (including the laz source itself) - nothing helps me.
(This question has been asked before - I found an answer, but it is 5 years old, and uses different components.
Thanks in advance - Mike
Martin_fr:
In Lazarus the Find Replace dialog is shown by the source-editor (ide\sourceeditor.pp). The source Editor is a wrapper around SynEdit dealing with all the functions that SynEdit does not have itself.
The Replace is called from TSourceEditor.DoFindAndReplace :
Result:=EditorComponent.SearchReplace(
LazFindReplaceDialog.FindText,LazFindReplaceDialog.ReplaceText,
LazFindReplaceDialog.Options);
The actual replace is done in function TCustomSynEdit.SearchReplaceEx(const ASearch, AReplace: string;
AOptions: TSynSearchOptions; AStart: TPoint): integer;
The Confirm dialog (pronpt) is shown in a callback in OnReplaceText (Only if the prompt flag is given)
mike parr:
Thanks Martin
I'm investigating, but am having trouble using units in the IDE.
I have used Projects - Compiler - paths, and added all the Lazarus paths that are suggested, but this does not seem to overcome the compilation errors. Any suggestions?
Mike
Martin_fr:
It would help to know which compilation error?
You will rarely have to change path info yourself (if you do, you usualy already did something wrong)
If you upgraded lazarus, and have a new fpc version or the fpc path changed for other reasons, then you need to change this in the environment options.
Or do a clean install, after you removed your old settings files from your home/user directory (on windows C:\Users\martin\AppData\Local\lazarus)
If you use components (like SynEdit) the IDe normally adds requirements. Check in the Project-Inspector. The package should be listed as requirement (never add the path to a package, always add the package)
mike parr:
The error was about unit: LazarusIdeStrConsts
Anyway, I was looking through the synedit examples (in the downloaded synedit package) and I found a search/replace example in Delphi, which is just what I need - so - for this project - I will switch back to delphi - sorry!
Navigation
[0] Message Index
[#] Next page