[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Need help with TRichEdit

Posted on 1998-02-02
3
Medium Priority
?
257 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 100 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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 I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Loops Section Overview
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

865 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