RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomRichEdit.OnResizeRequest Event

Occurs when the text has grown either smaller or larger than the control's window size.

Pascal
property OnResizeRequest: TRichEditResizeEvent;
C++
__property TRichEditResizeEvent OnResizeRequest;

Write an OnResizeRequest event handler to respond to notifications that the edit control is trying to resize due to changes in the text. The Rect parameter gives the desired bounding rectangle that will display all the text, in screen coordinates.  

C++ Examples: 

 

/*
The following code resizes the rich edit control to
accommodate growing or shrinking lines of text.  This
example requires a button, a TEdit and a TRichEdit.
Double click on the TRichEdit OnResizeRequest event
to create the event handler.
*/
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  RichEdit1->Lines->Add(Edit1->Text);
}

void __fastcall TForm1::RichEdit1ResizeRequest(TObject *Sender, TRect &Rect)
{
  (dynamic_cast<TRichEdit *>(Sender))->BoundsRect = Rect;
}

 

Delphi Examples: 

{
The following code resizes the rich edit control to
accommodate growing or shrinking lines of text.  This
example requires a button, a TEdit and a TRichEdit.
Double click on the TRichEdit OnResizeRequest event
to create the event handler.
} 
procedure TForm1.Button1Click(Sender: TObject);
begin
  RichEdit1.Lines.Add(Edit1.Text);
end;

procedure TForm1.RichEdit1ResizeRequest(Sender: TObject; Rect: TRect);
begin
  (Sender as TRichEdit).BoundsRect := Rect;
end;

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!