0

I am building a re-usable TFrame which contains a TcxPageControl. The idea is the frame is dropped onto the form and then I can add pages specific to that form.

This works fine, I can successfully add pages through the designer and at runtime those tab pages appear. However, the problem is any components that are dropped onto the TcxTabSheet don't.

If I add a page on the Frame itself (i.e. the base Frame, not the one dropped onto the form) and drop components on that, those show. However, if I drop components onto that same page from the form they don't.

I am clearly missing something here but I would have thought the page control would just work as it would on any form (regardless if it's being surfaced from a TFrame) but clearly there seems to be something it doesn't like.

Is this a bug or am I just not doing it right?

Note - I am using the "Add to Palette" option to add the Frame as a component as I want to surface the TPageControl properties (incase that matters)

James
  • 80,725
  • 18
  • 167
  • 237
  • What happens when using standard `TPageControl`? – LU RD Sep 24 '14 at 14:47
  • @LURD weirdly the option to add a new page control is disabled (through the designer) hence why I am using a `TcxPageControl`. Another oddity with this scenario is if I add a component to the `TcxTabSheet` at design time, view the DFM file (Alt+12) and then switch back, the component is no longer there but it's still declared in the form. When I save I am prompted to remove it as there is no declaration for it :S There definitely appears to be some jittery behaviour with this on a `TFrame`. – James Sep 24 '14 at 14:49
  • In our app we are using a `TcxPageControl` in the `main form`. `TcxTabSheets` are created during runtime and get a `TFrame` descendant assigned. Some of those `TFrame` have a `TcxPageControl` with `TcxTabsheet` components created at design time. This schema works flawlessly. I think there must be something else at hand. We are using `Delphi XE5` and `devExpress 13.2.3` if that matters. – Guillem Vicens Sep 24 '14 at 14:56
  • @GuillemVicens I was able to reproduce this with nothing but a `TFrame` with a `TcxPageControl` - I have reported the issue to the DevExpress team and provided a [sample app](https://www.devexpress.com/Support/Center/Attachment/GetAttachmentFile/97c0ba16-43fc-11e4-80b8-00155d624807), you can try running it yourself to see if the behaviour is consistent on your build. FYI I am on `v14.1.4` & `Delphi XE3`. – James Sep 24 '14 at 15:12
  • @James, I can confirm the same happens on my environment. My guess is this happens because Delphi compiles the "original" `TFrame` into the form and ignores the one you have on the `form`. Not sure if or how it can solved, sorry. – Guillem Vicens Sep 24 '14 at 15:37
  • @GuillemVicens no worries, I suspect it's a bug. However, I am not sure if it's a bug with Delphi itself or a bug with the `TcxPageControl` component - given the fact you can't add pages to a `TPageControl` if it's on a Frame then I suspect it's a bug with the `TcxPageControl` (since they appear to surface this option). – James Sep 24 '14 at 15:41

1 Answers1

0

As it turns out this behaviour is actually a VCL limitation and not a limitation on the TcxPageControl component itself. The difference here was the TcxPageControl allows the ability to add pages from the Frame instance which is kind of misleading.

A workaround is to simply inherit from the TFrame instance which contains the TcxPageControl (or even just a standard TPageControl) and add the pages in there. Not ideal as it means I am effectively creating a separate TFrame per page but at least it means I can re-use common code which was the goal.

Clarification from DevExpress.

James
  • 80,725
  • 18
  • 167
  • 237