Home General

Rich Text Error -Control has no parent

edited February 2016 in General
RB 16.03 Ent and Delphi XE7

I have an application where whenever a RichEdit or dbRichEdit component is
used i get a "Control has no parent" error. The error is confined to these
two components and ONLY happens if a Windows Style is loaded. The
application used to run ok but has recently developed this error and i can
not work out what has changed. I have replaced the ppReport and ppDesigner
components and tried various options but this error always occurs with
RichEdit components when Styles are on.

I have tried to replicate the error with a new application but cannot do so.
The application that has the problem is a largish bespoke application
developed over the last 8 years and it would be difficult to rebuild it. I
had a similar problem to this back in Sept 2015 but found at that time that
removing MidasLib from my uses clause resolved the problem. That is not the
problem in this case.

I suppose the question is what is different about the RichEdit and
dbRichEdit components. Is there something in their constructor that works
differently? Or is the problem elsewhere?

Regards

Tim Murfitt

Comments

  • edited February 2016
    Hi Tim,

    This is not a known issue.

    Internally TppRichText/DBRichText rely on a Delphi TRichEdit descendant. The
    default is TppRichEdit defined in ppRichTxDrwCmd.pas. However, the
    architecture also supports using a replacement, such as InfoPower. Are you
    using the InfoPower plug-in?

    TppRichEdit has some code in the constructor to override the default
    ControlStyle, this code was added in 2013. There is also some code in
    CreateParams to handle the case when Parent is nil - but that code has
    existed for many years.




    Best regards,

    -
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited February 2016
    Nard

    Yes i am using the InfoPower plug-in. I will remove that first and see if
    that makes any difference. By the way the problem is the same with both
    TRichEdit and TDBRichEdit.

    Regards

    Tim


  • edited February 2016
    Nard

    The problem is the ppWWRichEd unit. Removing that from my uses clause fixed
    the problem. I will contact Roy Woll at Woll2Woll and let him know of the
    problem.

    Thanks for pointing me in the right direction.

    Regards

    Tim



    "Tim Murfitt" wrote in message news:56b31715$1@mail....

    Nard

    Yes i am using the InfoPower plug-in. I will remove that first and see if
    that makes any difference. By the way the problem is the same with both
    TRichEdit and TDBRichEdit.

    Regards

    Tim


  • edited February 2016
    Hi Tim,

    I compared TppWWRichEdit to the TppRichEdit class.

    Try the following:

    - open ppWWRichEd.pas

    - add a constructor override

    - implement the constructor override as follows

    constructor TppWWRichEdit.Create(AOwner: TComponent);
    begin

    inherited Create(AOwner);

    ControlStyle := ControlStyle + [csOverrideStylePaint];

    end;


    We'll add that code to the ppWWRichEd.pas going forward.




    Best regards,

    -
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited February 2016
    Nard

    I used the replacement ppWWRichEd.pas that you emailed me and i confirm that
    it has worked. Thanks very much.

    Regards

    Tim



This discussion has been closed.