Page 1 of 1

TChartEditorPanel will not display on complex form.

Posted: Thu Dec 14, 2006 10:26 pm
by 9346326
I have created a complex form. It has several panels and a Page Control. On one of the panels I placed a TChart, and on one of the pages of the Page Control I have placed the TChartEditorPanel (and hooked it to the TChart).

When I open the window during execution, the TChart displays, but the TChartEditorPanel does not.

I am currently using TChartPro 7.08.

Test case available: Reference Test Case 4.

Posted: Fri Dec 15, 2006 9:58 am
by narcis
Hi RGSMike,

Where have you posted the example project you mention, I'm unable to find it.

Thanks in advance.

Posted: Fri Dec 15, 2006 5:53 pm
by 9346326
I have posted the test case 4 at the attachments location.

Posted: Wed Dec 20, 2006 8:12 am
by narcis
Hi RGSMike,

Thanks for the example. Your problem seems related to what's described here.

Posted: Wed Dec 20, 2006 4:25 pm
by 9346326
Based on your information, I have tried some different things in the example. You are indeed correct that the Editor Panel is being placed behind the parent panel. I cannot understand why the processing would do that. I even tried setting the parent at create time, and this does not work.

As one more alternative, I tried creating the Editor Panel control at run time. The processing gives me a "Control has no Parent" error. Given the information, I see no way around this situation. I suppose that you have submitted this problem to Borland.

It is interesting that it only occurs for this one component. I suspect that you have already looked at creating the component differently so that this situation would not occur.

Fortunately I have moved ahead and was able to create the desired processing through another means. It was not elegant, but I was able to get the Chart on the chart panel, and the Editor Panel on the desired page of the Page Table, and they are linked. Further, these two items are separate forms and are contained in another DLL.

Thanks for your time and effort on this.

TChartEditorPanel on a TabSheet

Posted: Tue Feb 13, 2007 3:56 pm
by 9346326
This is a followup to the original submission. Since I needed to still use this type of processing, it was necessary for me to find a way around this situation. I found two way to enable this type of processing (ChartEditorPanel on TabSheets), and I thought you might be interested in case someone else tries to use it.

The reason for the behaviour has something to do with the way the ChartEditorPanel is configured. (I did not look into detail on this). For tab sheet processing, the VCL environment puts all the forms in the background. Then as the tab sheet is enabled by the user, the forms are brought forward in the zlist. For some reason, VCL will not bring this Panel forward. I suspect that VCL expects the TChart folks to bring it forward since the form has no components on it at the time of initialization. It might have something to do with user drawing or something like that.

At any rate, the processing can be setup in the user program to perform the needed processing. For the tab sheet that contains the control, you add an OnShow and OnHide event. For the OnShow, the following will position the control at (12,12) on the parent tab sheet (TabSheetEditor):

-----------------------------------------------------------
TPoint base_point,
screen;
base_point = this->ClientToScreen (TPoint (0, 0));
screen = TabSheetEditor->ClientToScreen (TPoint (12, 12));
screen.x -= base_point.x;
screen.y -= base_point.y;
SetWindowPos (ChartEditorPanel->Handle, HWND_TOP, screen.x, screen.y,
0, 0, SWP_NOSIZE);
-----------------------------------------------------------

For the OnHide code, all you need is:

------------------------------------------------------------
SetWindowPos (ChartEditorPanel->Handle, HWND_BOTTOM, 0, 0, 0, 0,
SWP_NOMOVE + SWP_NOSIZE);
------------------------------------------------------------

The second method to enable this type of processing is the one that I prefer. This method is to create a TChartEditForm on the fly during the creation of the Form. In this way you can have the same type of processing as the Editor Panel, but it is attached to the Tab Sheet and its processing s handled within the VCL code. This method does not require using the SetWindowPos call. I don't like having to call any Windows entry points if I don't have to.