Hello Stefan,

You wrote at 4/27/2000, 10:45 PM

PG>> 3.
PG>> Ctrl-Shift-Arrows in headers still work strange. Please correct this
PG>> thing.

ST> I would love to. But: does anybody know how to obtain the caret
ST> position (not current selection) in an input line? Maybe it is a
ST> trivial thing, but I've spent too much time looking where it is
ST> and still did not find it... :-(

My friend Daniel Marczisovszky, Delphi Master Programmer wrote:

-------------------------><8---------CUT HERE------------------------------
>From Win32.hlp:

The GetCaretPos function copies the caret's position, in client coordinates, to the 
specified
POINT structure.

BOOL GetCaretPos(

    LPPOINT lpPoint     // address of structure to receive coordinates
   );   
 

Parameters

lpPoint

Points to the POINT structure that is to receive the client coordinates of the caret. 

****************************************************

Finding the Line Number of the Caret Position
---------------------------------------------

Perform the following two steps:

1. Send the EM_GETSEL message to the edit control. The high-order word
   of the return value is the character position of the caret relative
   to the first character in the control.

2. Send the EM_LINEFROMCHAR message to the edit control and specify the
   value returned from step 1 as wParam. Add 1 to the return value to
   get the line number of the caret position because Windows numbers
   the lines starting at zero.

Finding the Column Number of the Caret Position
-----------------------------------------------

Perform the following three steps:

1. Send the EM_GETSEL message to the edit control. The high-order word
   of the return value is the character position of the caret relative

   to the first character in the control.

2. Send the EM_LINEINDEX message with wParam set to -1. The value
   returned is the count of characters that precede the first
   character in the line containing the caret.

3. Subtract the value returned in step 2 from the value in step 1 and
   add 1 because Windows numbers the columns starting at zero. This
   result is the column number of the caret position.
-------------------------><8---------CUT HERE------------------------------


-- 
Cheers, SyP

You never know what is enough unless you know what is more than enough. (William Blake)

-- 
--------------------------------------------------------------
View the TBBETA archive at http://tbbeta.thebat.dutaint.com
To send a message to the list moderation team double-click HERE:
   <mailto:[EMAIL PROTECTED]>
To Unsubscribe from TBBETA, double-click HERE:
   <mailto:[EMAIL PROTECTED]>
--------------------------------------------------------------


You are subscribed as : [email protected]


Reply via email to