22.09.2019
Posted by 

Cursor (caret) positioning in TEdit programatically. Hello experts, I want to reposition the cursor in TEdit at a position other than its present position within TEdit. Jun 7, 2011 - How do I find the current position of the cursor in an edit box? Edit1.SelStart is not updated when you use the arrows to move the cursor around.

  1. Delphi Caret Position Tedit 10

I want to get the caret position of my TMemo. What I want is the position of the actual blinking caret, with no regard to if there is any text selected or not. For example if I select a word in a TMemo, the blinking caret can be on the left or right side of the selected word depending on if I selected from right or left.All functions I've found just gives the position of the first char in the selection no matter were the caret is. I've tried TCustomMemo.SelStart, TCustomMemo.CaretPos and the EMGETSEL message but they all give the same response.Any help appreciated, thanks. Anders wrote: Hmm, interesting, I use cbuilder XE2 (Win7 64bit)So do I.

I would expect the caret index to be 5 for the left image and 0 for the right one, I highlighted the caret with an arrow. Are you saying you get a different result on your machine?With your code, I am getting the same result as you (using the keyboard tohighlight text in either direction). When the caret is at the front of theselection, the resulting index is the value of the end of the selection,presumably because that is the 'start' of the selection. When the caretis at the end of the selection, the resulting index follows the caret asexpected.In my earlier test, I was invoking the CaretPos calculation in a TButtonOnClick event instead, and the resulting index followed the actual caretas expected, regardless of selection.

Delphi Caret Position Tedit 10

But when I try it again, it is notfollowing anymore.-Remy Lebeau (TeamB). Mark Jacobs wrote: wrote in message news:497658@forums.embarcadero.com. I have this nice code hack to work around that, charPos will not overflow just wrap around. I didn't add it to my first code as it wasn't part of the original problem.

Trader dante swing trading forex and financial futures download site

Tricky stuff. Which only goes to prove, 'Where there's a will, there's a way!' Regards,Where there's a Will, there's a Wheaton.-Rudy Velthuis'The rights of women are sacred. See that women are maintainedin the rights attributed to them.' - Prophet Muhammed.

Greetings collective wonderfolk of the internet.I'm trying to underline specific words in a TEdit (actually a TNxEdit from Berg NextSuite - but it's a derivative of TEdit). However in order to do this I need to know the pixel coordinates of said word.This is fairly easy to do if the start of the text is visible, however I can't work out how to do it if the start of the text has been scrolled off the end.Is there some way of determining the exact coordinates of a given word directly? Failing that, determining which text is visible in the edit and which isn't? Or some other ingenious method.Edit1: To cover some of the current answers:The requirements are to implement a spell checker on a column of a TNxGrid component, which limits me to TNxEdit.

Delphi caret position tedit for macTedit

If I could choose which component I used I would have switched by now:(I can do the drawing the line. TNxEdit has a canvas that allows me to draw the underline quite happily providing I can work out the correct coordinates.If the start of the edit text is visible, i.e. There's no scrolling off the front, then I can determine the correct start position and the length of the line using TextExtent.The issue comes in the scenario where the start of the text has scrolled off the front. Not being able to determine how much is scrolled off the front means I can't work out the starting position for the line. The length of the line becomes a problem if the word I want to highlight is also partially scrolled. TEdit is a Delphi wrapper for system Win32 Edit class and it doesn't provide any functions to set underline attribute on a specific word, neither TEdit add such a feature. I suggest you consider using a more powerful class, component in delphi, as TRichEditSaid that, if you like to face complex task, try calculating string extent given a font (see GetTextExtentExPoint and similar) to get the x start/end position of the line, (also consider the border of Edit to add some x offset) and draw a line on the HDC (TCanvas).