Solved

Need help with TRichEdit

Posted on 1998-02-02
3
246 Views
Last Modified: 2010-04-04
Is there a way to get the character index of the top left corner and bottom right corner of the TRichEdit Client Rectangle?

I'm using Delphi 3.0 for my development

Thanks in Advance
Ermac
0
Comment
Question by:ermac
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
JimBob091197 earned 50 total points
ID: 1358124
Hi

You use the EM_CHARFROMPOS message.

E.g.  For top left:
var
  ChPos: DWord;
  ChIx: Word;
begin
  ChPos := SendMessage(MyRichEdit.Handle, EM_CHARFROMPOS, 0, MakeLParam(1, 1));
  ChIx := LoWord(ChPos);
  Etc...
end;

Thus, to get character at top left:
  TopLeftCh := Copy(MyRichEdit, ChIx + 1, 1);


(My riched32.dll appears to cause an access violation if invalid coordinates are given...)

Regards,
JB
0
 

Author Comment

by:ermac
ID: 1358125
It doesn't return me the correct character index and I can't get the character index of the bottom right also (It gives me an access violation)

Any ideas?
0
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1358126
Mmm...  I think this API call is buggy.  I have heard from a colleague that he also couldn't get it to work properly.  (Mine did work, though, for the top-left char index.  Are you using different fonts?  I tried with default font only.)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now