Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scroll Up / Down To Selected Text 2

Status
Not open for further replies.

BobbaFet

Programmer
Feb 25, 2001
903
NL
I have a richedit, and a finddialog. how can i make
the richedit scroll up or down to the selected text?
I also want to do for a goto line function.

I have read about the ScrollBy procedure, but I dont
understand how I can make it work for me.

I dont need a seperate function for the goto line one
because it makes use of finddialog function.

Thanx allot,

BobbaFet Everyone has a right to my opinion.
E-mail me at cwcon@programmer.net
 
Hi Bobbafet
This is part of some code I adapted to find errors in a 'C'listing.
Code editor is a TRichedit.
It gets the pixel position of selected text in a richedit which I assume you will need to do to use scrollby.


procedure TCodeEd.UpdateCursorPos;
var
CharPos: TPoint;
name: string;
FirstQuote,LastQuote, Line, Spc, code: integer;
value, temp: string;
begin
CharPos.Y := SendMessage(CodeEditor.Handle, EM_EXLINEFROMCHAR, 0,
CodeEditor.SelStart);
CharPos.X := (CodeEditor.SelStart -
SendMessage(CodeEditor.Handle, EM_LINEINDEX, CharPos.Y, 0));

It might give you some ideas.
Steve.

 
Hi,

Sorry for the late reply but I've been sick recently. Anyway, I'm not at all sure if this would apply to you since the solution is pretty simple you probably would have found it yourself, but in the version of Delphi I'm using (6) there is a ScrollBars property which you can set.
 
Hi bearsite4,

What I want is that if selected text is off the screen I
want to scroll up or down towards it....

BobbaFet Everyone has a right to my opinion.
E-mail me at cwcon@programmer.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top