Forum > SynEdit

Synedit question (porting delphi app)

(1/3) > >>

I am porting a delphi app that uses synapse and the Lazarus version is missing BufferToDisplayPos.  Anyone know if the Lazarus version can do this?

Also in the BufferToDisplayPos function is a reference to a WordWrapPlugin which does not seem to exist in Lazarus Synedit.

I am trying to port the search and replace demo from the Delphi version of Synapse.

Maybe CharIndexToRowCol from TSynMemo?
TSynMemo is kind of deprecated, it is more or less a copy, with 4 added functions....

Note the Column is the byte in text. That differs from the pos on sreen (tab= 1 byte, but several pos on screen / utf8 = several byte, but 1 pos / full width char...)
See LogicalToPhysical

WordWrap is not yet implemented.

There is a port of the original SynEdit. But I know little about it.

Hi Martin,
The actual line I am having issue with is:

APos := SynEditor.ClientToScreen(SynEditor.RowColumnToPixels(SynEditor.BufferToDisplayPos(BufferCoord(Column, Line) ) ) );

It gets the screen cursor position so the replace prompt dialog displays under the word to be replaced.

Hey, I got it working :-)

apos:= editor.ClientToScreen(Editor.RowColumnToPixels(editor.BlockBegin));

I thought hey it's selecting the word to be replaced and saw the BlockBegin returns a tpoint, so I tried it and it works exactly the same.

Afaik RowColumnToPixels takes a ScreenPos (called Physical)

BlockBegin is "Logical" that is bytePos. So I a mno sure this works, if there are tabs, or accented chars....

CaretXY is "Physical" (sreenpos)

Or try LogicalToPhysical(BlockBegin)

Also test, if horiz scrolled


[0] Message Index

[#] Next page

Go to full version