Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 464
  • Last Modified:

get SynEdit text position from BuffCoordinate position

Hello Experts,
Using Delphi 7

How can I get the the text position from a TBuffCoordinate on a SynEdit?

I have for example a buffcoordinate that says "Char 4, line 10"
how can I find that its the 73rd char on my text so I assign it at SelStart or SelEnd??!!?
0
Ioannis Anifantakis
Asked:
Ioannis Anifantakis
  • 3
  • 2
1 Solution
 
diniludCommented:
Sorry didn't get you
0
 
diniludCommented:
Or you want to set the cursor position.

SynEdit1.CaretXY:=BufferCoord(xCharPos,yLinePos);
0
 
Ioannis AnifantakisSoftware EngineerAuthor Commented:
its ok, I found it

myTextPosition:=SynEdit1.RowColToCharIndex(myBufferCoord);

:)
0
 
Ioannis AnifantakisSoftware EngineerAuthor Commented:
What I wanted was to return the text position, not a line and char on the text.

E.g.

abcdef
ghijklmnop

the third char on the 2nd line is the integer 9 and not Line2, Char3
so I get the letter "i"
:)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now