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.
TChartEditorPanel will not display on complex form.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi RGSMike,
Where have you posted the example project you mention, I'm unable to find it.
Thanks in advance.
Where have you posted the example project you mention, I'm unable to find it.
Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
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.
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
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.
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.