Link to home
Start Free TrialLog in
Avatar of Peter Kiers
Peter KiersFlag for Netherlands

asked on

A dbrichedit question.

Hi,

I have these procedures and they use the dbrichedit1.
The dbrichedit1 is on the PageControl's tab with align = alClient.

procedure TMainForm.PlayBtnClick(Sender: TObject);
begin
  if not BeenPaused then
    SpVoice1.Speak(DBRichEdit1.Text, SVSFlagsAsync)   <=====
  else
  begin
   SpVoice1.Resume;
    BeenPaused := False
   end
end;

procedure TMainForm.SetTextHilite(FirstChar, Len: Integer);
begin
  DBRichEdit1.SelStart := FirstChar;  <========
  DBRichEdit1.SelLength := Len;       <=========
end;

procedure TMainForm.SetTextStyle(FirstChar, Len: Integer; Styles: TFontStyles);
begin
  with DBRichEdit1 do   <=========
  begin
    Lines.BeginUpdate;
    try
      SelStart := FirstChar;
      SelLength := Len;
      SelLength := 0;
    finally
      Lines.EndUpdate
    end
  end
end;

But know I made a button that creates the tabs of the pagecontrol (and the dbrichedit on it) dynamicly.
What do I have to alter in the code to get the active dbrichedit .

Peter
ASKER CERTIFIED SOLUTION
Avatar of Ferruccio Accalai
Ferruccio Accalai
Flag of Italy image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Peter Kiers

ASKER

Can you please help me with these procedures:

procedure TMainForm.PlayBtnClick(Sender: TObject);
begin
  if not BeenPaused then
    SpVoice1.Speak(DBRichEdit1.Text, SVSFlagsAsync)   <=====
  else
  begin
   SpVoice1.Resume;
    BeenPaused := False
   end
end;

procedure TMainForm.SetTextStyle(FirstChar, Len: Integer; Styles: TFontStyles);
begin
  with DBRichEdit1 do   <=========
  begin
    Lines.BeginUpdate;
    try
      SelStart := FirstChar;
      SelLength := Len;
      SelLength := 0;
    finally
      Lines.EndUpdate
    end
  end
end;

Peter
and i get incompatible types:  TDBRichedit and TComponent
at line:   Redit := PageControl1.ActivePage.Components[i];

P.
I got it. 500 points are comming to you.

Greetings, Peter Kiers
Sorry for the delay, I was busy and not on line.
I coded on the fly so there was a typo (missing the typecast TDBRichedit(PageControl1.ActivePage.Components[i])
I'm glad that you solved it the same by you (maybe looking at the prevoius code ;-))
Thanx fo the points and best regards.

Ferruccio