?
Solved

find dialog onfind event

Posted on 2002-06-23
6
Medium Priority
?
598 Views
Last Modified: 2008-02-01
hi everyone, i've a find dialog and a richedit, below is the code for onfind, this code find the text, marks the text but it doesn;t scroll the richedit, if the found text is out of view (need to scroll to reach) then this code won't do it.

any ideas why? (ActiveRich us a trichedit) thx!

procedure TForm1.FindDialog1Find(Sender: TObject);
var
  FoundAt: longint;
  SearchType: TSearchTypes;
  SearchStart: integer;
begin
    finddialog1.CloseDialog;

with ActiveRich do
  begin

  if frWholeWord in FindDialog1.Options then
    SearchType:=[stWholeWord]
  else
    SearchType:=[];

  if SelLength > 0 then
    SearchStart:=SelStart + SelLength//1
  else
    SearchStart:=SelStart;

  Screen.Cursor:=crHourGlass;
  Application.ProcessMessages;
  FoundAt:=FindText(FindDialog1.FindText, SearchStart,  
                Length(Text)-SearchStart,
                              SearchType);

  Screen.Cursor:=crDefault;
  Application.ProcessMessages;
  if FoundAt < 1 then
    MessageDlg('Unable to find "'+ FindDialog1.FindText +
               '"', mtInformation, [mbOK], 0)
  else
    begin
    SetFocus;
    SelStart:=FoundAt;
    SelLength:=Length(FindDialog1.FindText);

    end;
  end;
end;
0
Comment
Question by:urif
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 7

Accepted Solution

by:
Motaz earned 200 total points
ID: 7101548
Turn HideSelection property of RichEdit to False.
0
 

Author Comment

by:urif
ID: 7101550
this is the 1st thing i did, still...
0
 
LVL 7

Expert Comment

by:Motaz
ID: 7101551
But it works here,
did you changed any thing else
I added a new RichEdit, Turing HideSelection to false, and ScroolBar to Both
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:urif
ID: 7101558
nope, the only thing is that i am creating the richedit at run time, but nothing else
0
 
LVL 7

Expert Comment

by:Motaz
ID: 7101560
I used this code and it works fine:

begin
  if not Assigned(RichEdit1) then
  begin
    RichEdit1:= TRichEdit.Create(nil);
    RichEdit1.Parent:= Self;
    RichEdit1.HideSelection:= False;
  end;
  FindDialog1.Execute;
end;

Motaz
0
 

Author Comment

by:urif
ID: 7101563
ok, thanks, there must be something weird going on then...

but thanks for the help
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses
Course of the Month10 days, 18 hours left to enroll

770 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