I am trying to create an TCustomRichEdit with some speedbuttons above it. How can I accomplish this behaviour? The height of the component needs to be the buttons + the richedit.
[B][I][U]
+-------+
|A1REdit|
| |
+-------+
Currently I have the following code:
private
FBoldButton: TSpeedButton;
constructor TA1RichEdit.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FBoldButton := TSpeedButton.Create(Self);
FBoldButton.Parent := Self;
end;
destructor TA1RichEdit.Destroy;
begin
FreeAndNil(FBoldButton);
inherited;
end;
This paints the speedbutton on the richedit (because the richedit is the parent), I need the button to be above the richedit. The richedit doesnt paint itself like it should be after this piece of code.
Use a
TToolbar.Also put a
TImageListand aTActionListon your form.Assign the ImageList to your ActionList and ToolBar.
Then you can add some so called standard actions to your ActionList (the drop down menu on the “New Action” Button).
In the
Formatcategory you will findTRichEditBold,TRichEditItalicandTRichEditUnderline. Select them and clickOK.Then you add 3 tool buttons to your toolbar and assign your actions to them.
Everything like the pressed state when something is selected that has this state and automatically setting bold, italic or underlined will be handled without writing any code.