0

I am building an application with a TPageControl.

This is used to dock forms. The user may use the form inside or outside the TPageControl.

Some times, the application may start with the form on the desktop, other times inside the TPageControl.

Forms are automatically created at startup.

This is the code I use to load the form in at runtime:

fPanelLights.ManualDock(pcMain);
fPanelLights.Show;

The problem is when I take the form out of the TPageControl manually at runtime, I get a stack overflow error.

Not sure why this is happening since the form is owned by the application.

How do I solve this?

Cheers, E.

E Demers
  • 103
  • 1
  • 8
  • When it happens, go to View | Debug Windows | Call Stack in the IDE and inspect the call stack entries (from top, working downwards). This should tell you what it is what is causing the stack to overflow - usually, it is something which directly or indirectly calls itself. One remedy is to set a flag which says the app is busy doing something and which prevents the something from being called again. – MartynA Apr 17 '20 at 11:51
  • 1
    How about showing the code that takes out the form from the `TPageControl` for a starter. Better yet is to provide a [mre]. – Tom Brunberg Apr 17 '20 at 11:56

1 Answers1

2

This error occurred because I was putting the main form in the TPageControl...

E Demers
  • 103
  • 1
  • 8