- - * - WhiteUnicorn - * - -




* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >


Frequently Asked Questions

Avoiding an Application Error when using EM_POSFROMCHAR

Question:

How can I avoid an Application Error when using the EM_POSFROMCHAR and EM_POSFROMCHAR in a RichEdit control?

Answer:

The definitions for EM_CHARFROMPOS and EM_POSFROMCHAR are different
in the RichEdit and Messages units:

RichEdit unit:
  EM_POSFROMCHAR         = WM_USER + 38;
  EM_CHARFROMPOS         = WM_USER + 39;

Messages unit:
  EM_POSFROMCHAR         = 214;
  EM_CHARFROMPOS         = 215;

To avoid confusion, these constants have been removed from the
RichEdit unit in Delphi 3.

When using the EM_POSFROMCHAR message, WParam should contain the
address of the point structure that will receive the coordinates,
and LParam should contain the zero based offset of the character. The
return value is not initialized. Note that the y coordinate can be
zero or negative.

When using  EM_CHARFROMPOS, wparam is not used, and LParam should
contain the address of the point structure that will receive the
coordinates. The return value should contain the required character
index.




* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >



- - * - Anastasija aka WhiteUnicorn - * - - LJLiveJournal
PFPhotoFile