I am developing a component acting as a frame and containing several functions buttons bold, italic, foreground colour, Font selection and relevant size etc.
The idea is to drop this component in a form and then drop one of the TCustomRichView descendents. This way you can pilot all TCustomRichView descendants by one component.
My component is a TFrame descendant and the following is the object declaration:
type
TRVEditFrame = class(TFrame)
.....
private
{ Private declarations }
FRVEditor:TCustomRichView;
public
{ Public declarations }
FButtonSaveClick:TNotifyEvent;
protected
procedure notification(
acomponent:TComponent;aoperation:TOperation);override;
published
end;
I started developing the component and when it comes to associate RVFontComboBox1.Editor and RVFontSizeComboBox1.Editor to the TCustomRichView dropped the component crashes.
Below you will see the code. If I comment the two lines, as below, the component works fine but I don't have RVFontComboBox1.Editor and RVFontSizeComboBox1.Editor associated to TCustomRichView. That means you cannot see the list of the fonts and size as soon as the component is shown.
Code: Select all
procedure TRVEditFrame.notification(acomponent: TComponent;
aoperation: TOperation);
begin
inherited;
if acomponent is TCustomRichView then
if aoperation=opRemove then begin
if acomponent=FRVEditor then
FRVEditor:=nil;
end
else begin
FRVEditor:=TCustomRichView(acomponent);
// RVFontComboBox1.Editor:=FRVEditor;
// RVFontSizeComboBox1.Editor:=FRVEditor;
end;
How can I solve this ?
Many thanks
Pio Pio