[Lazarus] Extending the IDE

Reinier Napoles Martinez rnapoles at hlg.uci.cu
Mon Jan 30 06:08:41 CET 2012


Martin how can use the property TextBetweenPoints to exchange lines.
I tried but not work me.

I have this code:
tempStr := ASynEdit.LineText;
ASynEdit.TextBetweenPoints[Point(1, ASynEdit.CaretY), Point(1, ASynEdit.CaretY)]:= ASynEdit.Lines.Strings[ASynEdit.CaretY - 2] +LineEnding;
ASynEdit.TextBetweenPoints[Point(1, ASynEdit.CaretY-1), Point(1, ASynEdit.CaretY-1)]:=tempStr+LineEnding;   

previously used this code:

 procedure MoveLineUp(Sender: TObject);
 begin
  if CustSynEdit.CaretY -1 >= 1 then
   begin
    CustSynEdit.Lines.Exchange(CustSynEdit.CaretY -1 ,CustSynEdit.CaretY-2);
    CustSynEdit.CaretY:=CustSynEdit.CaretY-1;
   end;
 end;
 

 procedure MoveLineDown(Sender: TObject);
 begin
  if ( CustSynEdit.CaretY + 1 <= CustSynEdit.Lines.Count) then
   begin
    CustSynEdit.Lines.Exchange(CustSynEdit.CaretY-1,CustSynEdit.CaretY);
    CustSynEdit.CaretY:=CustSynEdit.CaretY+1;
   end;
 end;

which has the same problem as you pointed out to me.

thanks.


-- 
*********************************************************************
En la tierra hace falta personas que trabajen más y critiquen menos,
que construyan más y destruyan menos, que prometan menos y
resuelvan más que esperen recibir menos y dar más que digan mejor
ahora que mañana.
                                                 Che
*********************************************************************




More information about the Lazarus mailing list