Recent

Author Topic: Porting SynEdit Delphi Application to Lazarus  (Read 6487 times)

Uto

  • New Member
  • *
  • Posts: 30
Porting SynEdit Delphi Application to Lazarus
« on: March 22, 2008, 04:07:44 pm »
Hi,

I'm trying to port an application using SynMemo and SynAnySyn from Delphi to Lazarus. I was using v 2.0.5 on Delphi (I build the application like 18 months ago) and I'm using last version of Lazarus (but I can't find which version of SynEdit is the one included on the Lazarus package).

The problems I have is that these properties of tsynmemo seem to be unknown:

.ActiveLineColor
.SelAvail
.SearchEngine

I can see some sarch types exist, but it seems the search, selection, etc. should be done in a different way.

Anyone can help me to understand what is the changes situation and how should I approach to a solution?

many thanks :)

Bart

  • Hero Member
  • *****
  • Posts: 3546
    • Bart en Mariska's Webstek
RE: Porting SynEdit Delphi Application to Lazarus
« Reply #1 on: March 23, 2008, 11:46:43 pm »
TSynMemo in lazarus does have the SelAvail property.

Bart

Uto

  • New Member
  • *
  • Posts: 30
Re: RE: Porting SynEdit Delphi Application to Lazarus
« Reply #2 on: March 24, 2008, 02:37:16 pm »
Quote from: "Bart"
TSynMemo in lazarus does have the SelAvail property.


You're right, I got an error on this line

Code: [Select]
if SynEditor.SelAvail and (SynEditor.BlockBegin.Line = SynEditor.BlockEnd.Line)

and I tought it was the SelAvail, but actually is the BlockBegin.Line, that I guess I will be able to replace with BlockBegin.Y

Thanks.

Still trying to figrue out hou to search/replace on Synmemo though :(

Bart

  • Hero Member
  • *****
  • Posts: 3546
    • Bart en Mariska's Webstek
Porting SynEdit Delphi Application to Lazarus
« Reply #3 on: March 25, 2008, 06:27:22 pm »
From one of my Delphi projects (not ported to Lazarus yet).
TEditor is TSynMemo derived (it has one property extra that I needed)
First bit of code is translating FindReplaceOptions to TSynSearchOptions.

Code: [Select]
procedure TForm1.Find(Sender: TObject);
var sOptions: TSynSearchOptions;
var Editor: TEditor;
begin
  Editor := ActiveEditor;
  if Editor <> nil then with Editor do

  begin
    with (Sender as TFindDialog) do
    begin//with
      sOptions := [];
      if not (frDown in Options) then sOptions := sOptions + [ssoBackWards];
      if (frMatchCase in Options) then sOptions := sOptions + [ssoMatchCase];
      if (frWholeWord in Options) then sOptions := sOptions + [ssoWholeWord];

      if Editor.SearchReplace(FindText,'',sOptions) = 0 then
        MessageDlg(Format(msgTextNotFound,[FindText]),mtInformation,[mbOk],0);
    end;//with
  end;
end;


So you need to look at TSynMemo.SearchReplace. If it returns 0 then no matches are found.

Bart