Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 1570 - Embedded editor raises an "COntrol has no parent window" error (incl fix)
Summary: Embedded editor raises an "COntrol has no parent window" error (incl fix)
Status: CONFIRMED
Alias: None
Product: VCL TeeChart
Classification: Unclassified
Component: Editors (show other bugs)
Version: 150901
Hardware: PC Windows
: High major
Target Milestone: ---
Assignee: Steema Issue Manager
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-28 07:13 EDT by h.hasenack
Modified: 2016-07-14 05:07 EDT (History)
2 users (show)

See Also:
Chart Series: ---
Delphi / C++ Builder RAD IDE Version:


Attachments
a demo case and a patched TeeEdit.Pas (57.35 KB, patch)
2016-07-04 11:41 EDT, h.hasenack
Details

Note You need to log in before you can comment on or make changes to this bug.
Description h.hasenack 2016-06-28 07:13:05 EDT
reproduce:
create new delphi project
add tee editor panel
from main source remove/comment line 
//  Application.MainFormOnTaskbar := True;

run the app

There's the error.

Problem is caused by the TChartEditorPanel setting the parent of the FEditor (through the AddFormTo call) of the editor form.

Solution:

Delay Calling the AddFormTo call to the SetParentControl when the Parent is actually assigned. Like this:

constructor code:
Constructor TChartEditorPanel.Create(AOwner:TComponent);
begin
  inherited;

  {$IFNDEF FMX}
  BevelOuter:=bvLowered;
  {$ENDIF}

  Width :=409;
  Height:=291;

  if not (csDesigning in ComponentState) then
  begin
    FEditor:=TChartEditForm.Create(Self);

    {$IFNDEF FMX}
    FEditor.Align:=alClient;
    {$ENDIF}

    TeeTranslateControl(FEditor);

    FEditor.RememberPosition:=False;
    FEditor.RememberSize:=False;
    FEditor.PanBottom.Visible:=False;

{$ifndef HH_PATCH_TEEEDITORPANEL} // Code moved to SetParent
    {$IFDEF FMX}
    EmbeddForm(FEditor,Self);
    {$ELSE}
    AddFormTo(FEditor,Self);
    {$ENDIF}
{$endif}
  end;
end;

SetParent code:

{$ifdef HH_PATCH_TEEEDITORPANEL} // Code moved from constructor
procedure TChartEditorPanel.SetParent(AParent: TWinControl);
begin
  inherited;
  if Assigned(Parent) then
  begin
{$IFDEF FMX}
    EmbeddForm(FEditor,Self);
{$ELSE}
    AddFormTo(FEditor,Self);
{$ENDIF}
  end;
end;
{$endif}

I ran into this problem creating the edtor runtime, but it even happens designtime making delphi close to unusable due to the error geting reported over and over again. or your form resource gets to be mangled.
Comment 1 h.hasenack 2016-06-28 07:14:44 EDT
I work in RS10.1 Berlin, but I have seen the seame error on seattle and earlier editions. Please fix this in the next release!
Comment 2 h.hasenack 2016-06-28 07:25:02 EDT
Off course, the SetParent signature has to match the FMX or VCL platform. Is I currently do not use the FMX platform I have simply disabled my patch for the FMX platform.
Comment 3 sandra pazos 2016-07-04 05:56:46 EDT
Hello,

Unfortunately, the problem you are experiencing doesn't appear for us using latest Teechart Pro VCL/FMX v2016.18. To reproduce the problem, I have followed your instructions: 

1- Add TeeChartEditorPanel
2- I have removed/commented from main source the <<Aplication.MainFormOnTaskbar := True>> line
3- Run the application.

The application works for me without problems. 
I have done the test using Rad Studio 10.1 Berlin and Rad Studio 10 Seattle. 

Are you using latest TeeChart Por VCL/FMX v2016.18? 


Thanks in advance
Regards
Sandra
Comment 4 h.hasenack 2016-07-04 11:41:38 EDT
Created attachment 613 [details]
a demo case and a patched TeeEdit.Pas

I have created a demo case (RS10.Berlin).

You will preobably have problems opening the main form due to the crash in the tee editor panel. This is the problem I am aiming to fix!

Please find attached also a patched TeeEdit.pas. You will have to activa the HH_PATCH_TEEEDITORPANEL through the TeeDefs.ini to try the patched code.

Strange behavior: when the patch is active, the form loads fine both runtime and designtime. But the MainPage of the editor is somehow hidden. When switching between the text tab and the editor tab on the main form, the mainpage gets to be visible. I have not found out how and why this happens.

Unfortunately large attachments (6MByte) are not allowed so I cannot send you the compiled code :(

Please take the issue seriously ast I already invested over 8 hrs getting around this.

I can be reached by Skype (screen sharing!) to demonstrate the issue and the fix easily. h.hasenack(at)sg-assetmanagement.nl

Regards, Hans